* [PATCH v2] KVM:nVMX: Make setup/unsetup under the same conditions
@ 2022-02-22 10:40 Peng Hao
2022-02-22 15:19 ` Sean Christopherson
2022-02-24 14:23 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Peng Hao @ 2022-02-22 10:40 UTC (permalink / raw)
To: pbonzini, seanjc; +Cc: kvm, linux-kernel
From: Peng Hao <flyingpeng@tencent.com>
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 75ed7d6f35cc..9fad3c73395a 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM:nVMX: Make setup/unsetup under the same conditions
2022-02-22 10:40 [PATCH v2] KVM:nVMX: Make setup/unsetup under the same conditions Peng Hao
@ 2022-02-22 15:19 ` Sean Christopherson
2022-02-24 14:23 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2022-02-22 15:19 UTC (permalink / raw)
To: Peng Hao; +Cc: pbonzini, kvm, linux-kernel
Needs a space added as fixup.
On Tue, Feb 22, 2022, Peng Hao wrote:
> From: Peng Hao <flyingpeng@tencent.com>
>
> 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 75ed7d6f35cc..9fad3c73395a 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM:nVMX: Make setup/unsetup under the same conditions
2022-02-22 10:40 [PATCH v2] KVM:nVMX: Make setup/unsetup under the same conditions Peng Hao
2022-02-22 15:19 ` Sean Christopherson
@ 2022-02-24 14:23 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-02-24 14:23 UTC (permalink / raw)
To: Peng Hao, seanjc; +Cc: kvm, linux-kernel
On 2/22/22 11:40, Peng Hao wrote:
> From: Peng Hao <flyingpeng@tencent.com>
>
> 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 75ed7d6f35cc..9fad3c73395a 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);
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-24 14:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 10:40 [PATCH v2] KVM:nVMX: Make setup/unsetup under the same conditions Peng Hao
2022-02-22 15:19 ` Sean Christopherson
2022-02-24 14:23 ` Paolo Bonzini
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.