From: Sean Christopherson <seanjc@google.com>
To: shaoqin.huang@intel.com
Cc: pbonzini@redhat.com, Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
Date: Mon, 23 May 2022 16:17:34 +0000 [thread overview]
Message-ID: <YouznrVYM7H5IoMK@google.com> (raw)
In-Reply-To: <20220523010948.2018342-1-shaoqin.huang@intel.com>
On Sun, May 22, 2022, shaoqin.huang@intel.com wrote:
> From: Shaoqin Huang <shaoqin.huang@intel.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@vger.kernel.org
>
> Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.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
>
prev parent reply other threads:[~2022-05-23 16:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 1:09 [PATCH] KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots() shaoqin.huang
2022-05-23 16:17 ` Sean Christopherson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YouznrVYM7H5IoMK@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=shaoqin.huang@intel.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox