From: Sean Christopherson <seanjc@google.com>
To: Peng Hao <flyingpenghao@gmail.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm/vmx: Make setup/unsetup under the same conditions
Date: Fri, 18 Feb 2022 16:17:30 +0000 [thread overview]
Message-ID: <Yg/GmgbmLKTRqUbo@google.com> (raw)
In-Reply-To: <20220218111113.11861-1-flyingpeng@tencent.com>
"KVM: VMX" for the scope, or maybe even "KVM: nVMX:" despite this not touching
vmx/nested.c. Either way (but not "kvm/vmx:").
On Fri, Feb 18, 2022, Peng Hao wrote:
> Make sure nested_vmx_hardware_setup/unsetup are called in pairs under
> the same conditions.
Probably worth adding a sentence to clarify that the existing code isn't buggy
only because free_page() plays nice with getting passed '0' and vmx_bitmap is
initialized to zero. Something like:
Make sure nested_vmx_hardware_setup/unsetup() are called in pairs under
the same conditions. Calling nested_vmx_hardware_unsetup() when nested
is false "works" right now because it only calls free_page() on zero-
initialized pointers, but it's possible that more code will be added to
nested_vmx_hardware_unsetup() in the future.
Reviewed-by: Sean Christopherson <seanjc@google.com>
>
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
> arch/x86/kvm/vmx/vmx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 0ffcfe54eea5..5392def71093 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -7852,7 +7852,7 @@ static __init int hardware_setup(void)
> vmx_set_cpu_caps();
>
> r = alloc_kvm_area();
> - if (r)
> + if (r && nested)
> nested_vmx_hardware_unsetup();
>
> kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
> --
> 2.27.0
>
prev parent reply other threads:[~2022-02-18 16:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 11:11 [PATCH] kvm/vmx: Make setup/unsetup under the same conditions Peng Hao
2022-02-18 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=Yg/GmgbmLKTRqUbo@google.com \
--to=seanjc@google.com \
--cc=flyingpenghao@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.