kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
  2022-06-07  0:59 [PATCH v2] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots() shaoqin.huang
@ 2022-06-06 16:56 ` Sean Christopherson
  2022-06-07 15:00   ` Huang, Shaoqin
  2022-06-07 15:14 ` Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Sean Christopherson @ 2022-06-06 16:56 UTC (permalink / raw)
  To: shaoqin.huang
  Cc: pbonzini, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Ben Gardon, kvm, linux-kernel

On Mon, Jun 06, 2022, shaoqin.huang@intel.com wrote:
> From: Shaoqin Huang <shaoqin.huang@intel.com>
> 
> When freeing obsolete previous roots, check prev_roots as intended, not
> the current root.
> 
> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
> Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")

Because KVM patches aren't guaranteed to be backported without it (though it's
"only" v5.18 that's affected), this needs:

  Cc: stable@vger.kernel.org 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
@ 2022-06-07  0:59 shaoqin.huang
  2022-06-06 16:56 ` Sean Christopherson
  2022-06-07 15:14 ` Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: shaoqin.huang @ 2022-06-07  0:59 UTC (permalink / raw)
  To: pbonzini
  Cc: Shaoqin Huang, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Ben Gardon,
	kvm, linux-kernel

From: Shaoqin Huang <shaoqin.huang@intel.com>

When freeing obsolete previous roots, check prev_roots as intended, not
the current root.

Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
---
Changes in v2:
  - Make the commit message more clearer.
  - Fixed the missing idx.

 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 f4653688fa6d..e826ee9138fa 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
 		roots_to_free |= KVM_MMU_ROOT_CURRENT;
 
 	for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
-		if (is_obsolete_root(kvm, mmu->root.hpa))
+		if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
 			roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
  2022-06-06 16:56 ` Sean Christopherson
@ 2022-06-07 15:00   ` Huang, Shaoqin
  0 siblings, 0 replies; 4+ messages in thread
From: Huang, Shaoqin @ 2022-06-07 15:00 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: pbonzini, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Ben Gardon, kvm, linux-kernel

Thanks Sean!

On 6/7/2022 12:56 AM, Sean Christopherson wrote:
> On Mon, Jun 06, 2022, shaoqin.huang@intel.com wrote:
>> From: Shaoqin Huang <shaoqin.huang@intel.com>
>>
>> When freeing obsolete previous roots, check prev_roots as intended, not
>> the current root.
>>
>> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
>> Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
> 
> Because KVM patches aren't guaranteed to be backported without it (though it's
> "only" v5.18 that's affected), this needs:
> 
>    Cc: stable@vger.kernel.org
> 
> Reviewed-by: Sean Christopherson <seanjc@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
  2022-06-07  0:59 [PATCH v2] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots() shaoqin.huang
  2022-06-06 16:56 ` Sean Christopherson
@ 2022-06-07 15:14 ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2022-06-07 15:14 UTC (permalink / raw)
  To: shaoqin.huang
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Ben Gardon, kvm, linux-kernel

On 6/7/22 02:59, shaoqin.huang@intel.com wrote:
> From: Shaoqin Huang <shaoqin.huang@intel.com>
> 
> When freeing obsolete previous roots, check prev_roots as intended, not
> the current root.
> 
> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com>
> Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
> ---
> Changes in v2:
>    - Make the commit message more clearer.
>    - Fixed the missing idx.
> 
>   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 f4653688fa6d..e826ee9138fa 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
>   		roots_to_free |= KVM_MMU_ROOT_CURRENT;
>   
>   	for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
> -		if (is_obsolete_root(kvm, mmu->root.hpa))
> +		if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
>   			roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
>   	}
>   

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-07 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07  0:59 [PATCH v2] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots() shaoqin.huang
2022-06-06 16:56 ` Sean Christopherson
2022-06-07 15:00   ` Huang, Shaoqin
2022-06-07 15:14 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).