Re: [PATCH v2] KVM: x86: check PIR even for vCPUs with disabled APICv
From: Maxim Levitsky
Date: Thu Nov 18 2021 - 06:18:33 EST
On Thu, 2021-11-18 at 12:11 +0100, Paolo Bonzini wrote:
> On 11/18/21 10:56, Maxim Levitsky wrote:
> > vmx_sync_pir_to_irr has 'if (KVM_BUG_ON(!vcpu->arch.apicv_active,
> > vcpu->kvm))' That has to be removed I think for this to work.
>
> Good point.
>
> > Plus the above calls now can happen when APICv is fully disabled (and
> > not just inhibited), which is also something that I think that
> > vmx_sync_pir_to_irr should be fixed to be aware of.
>
> No, that works because sync_pir_to_irr is set to NULL as you point out
> below. static_call sites are updated right after ops->hardware_setup(),
> in kvm_arch_hardware_setup.
I understand now. Thanks!
Best regards,
Maxim Levitsky
>
> Paolo
>
> > Also note that VMX has code that sets vmx_x86_ops.sync_pir_to_irr to
> > NULL in its 'hardware_setup' if APICv is disabled. I wonder if that
> > done befor or after the static_call_cond sites are updated.
> >
> > I think that this code should be removed as well, and
> > vmx_sync_pir_to_irr should just do nothing when APICv is fully
> > disabled.