[PATCH] KVM: x86: mmu: trace kvm_mmu_set_spte after the new SPTE was set

Maxim Levitsky posted 1 patch 4 years, 3 months ago
arch/x86/kvm/mmu/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] KVM: x86: mmu: trace kvm_mmu_set_spte after the new SPTE was set
Posted by Maxim Levitsky 4 years, 3 months ago
It makes more sense to print new SPTE value than the
old value.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
 arch/x86/kvm/mmu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 94f077722b290..0e209f0b2e1d2 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -2690,8 +2690,8 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,
 	if (*sptep == spte) {
 		ret = RET_PF_SPURIOUS;
 	} else {
-		trace_kvm_mmu_set_spte(level, gfn, sptep);
 		flush |= mmu_spte_update(sptep, spte);
+		trace_kvm_mmu_set_spte(level, gfn, sptep);
 	}
 
 	if (wrprot) {
-- 
2.26.3
Re: [PATCH] KVM: x86: mmu: trace kvm_mmu_set_spte after the new SPTE was set
Posted by Paolo Bonzini 4 years, 3 months ago
Queued, thanks.

Paolo
Re: [PATCH] KVM: x86: mmu: trace kvm_mmu_set_spte after the new SPTE was set
Posted by Sean Christopherson 4 years, 3 months ago
On Wed, Mar 02, 2022, Maxim Levitsky wrote:
> It makes more sense to print new SPTE value than the
> old value.
> 

  Fixes: d786c7783b01 ("KVM: MMU: inline set_spte in mmu_set_spte")

And arguably even Cc: stable@vger.kernel.org, though that's unnecessary if this
gets into 5.17, which it should.

Reviewed-by: Sean Christopherson <seanjc@google.com>

> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
>  arch/x86/kvm/mmu/mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 94f077722b290..0e209f0b2e1d2 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -2690,8 +2690,8 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,
>  	if (*sptep == spte) {
>  		ret = RET_PF_SPURIOUS;
>  	} else {
> -		trace_kvm_mmu_set_spte(level, gfn, sptep);
>  		flush |= mmu_spte_update(sptep, spte);
> +		trace_kvm_mmu_set_spte(level, gfn, sptep);
>  	}
>  
>  	if (wrprot) {
> -- 
> 2.26.3>