[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YouznrVYM7H5IoMK@google.com>
Date: Mon, 23 May 2022 16:17:34 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: shaoqin.huang@...el.com
Cc: pbonzini@...hat.com, Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86/mmu: Check every prev_roots in
__kvm_mmu_free_obsolete_roots()
On Sun, May 22, 2022, shaoqin.huang@...el.com wrote:
> From: Shaoqin Huang <shaoqin.huang@...el.com>
>
> Iterate every prev_roots and only zap obsoleted roots.
Better would be something like:
When freeing obsolete previous roots, check prev_roots as intended, not
the current root.
Ugh, my bad. This escaped into v5.18 :-(
Fixes: 527d5cd7eece ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
Cc: stable@...r.kernel.org
>
> Signed-off-by: Shaoqin Huang <shaoqin.huang@...el.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 45e1573f8f1d..22803916a609 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5168,7 +5168,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.hpa))
My version is bad, but at least it compiles ;-)
arch/x86/kvm/mmu/mmu.c: In function ‘__kvm_mmu_free_obsolete_roots’:
arch/x86/kvm/mmu/mmu.c:5182:58: error: ‘(struct kvm_mmu_root_info *)&mmu->prev_roots’ is a pointer; did you mean to use ‘->’?
5182 | if (is_obsolete_root(kvm, mmu->prev_roots.hpa))
| ^
| ->
if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
> roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
> }
>
> --
> 2.30.2
>
Powered by blists - more mailing lists