lkml.org 
[lkml]   [2021]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 4/4] KVM: VMX: Register posted interrupt wakeup handler iff APICv is enabled
From
On 09/10/21 02:11, Sean Christopherson wrote:
> Don't bother registering a posted interrupt wakeup handler if APICv is
> disabled, KVM utilizes the wakeup vector if and only if APICv is enabled.
> Practically speaking, there's no meaningful functional change as KVM's
> wakeup handler is a glorified nop if there are no vCPUs using posted
> interrupts, not to mention that nothing in the system should be sending
> wakeup interrupts when APICv is disabled.
>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> arch/x86/kvm/vmx/vmx.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 9164f1870d49..df9ad4675215 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -7553,7 +7553,8 @@ static void vmx_migrate_timers(struct kvm_vcpu *vcpu)
>
> static void hardware_unsetup(void)
> {
> - kvm_unregister_posted_intr_wakeup_handler(pi_wakeup_handler);
> + if (enable_apicv)
> + kvm_unregister_posted_intr_wakeup_handler(pi_wakeup_handler);
>
> if (nested)
> nested_vmx_hardware_unsetup();
> @@ -7907,7 +7908,8 @@ static __init int hardware_setup(void)
> if (r)
> nested_vmx_hardware_unsetup();
>
> - kvm_register_posted_intr_wakeup_handler(pi_wakeup_handler);
> + if (enable_apicv)
> + kvm_register_posted_intr_wakeup_handler(pi_wakeup_handler);
>
> return r;
> }

Also adds unnecessary complexity (you have to ensure the condition
cannot change from one call to the other), so I am only queuing patches
1 and 2.

Paolo

\
 
 \ /
  Last update: 2021-10-21 21:44    [W:0.048 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site