From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Levitsky Date: Thu, 28 Oct 2021 09:12:13 +0000 Subject: Re: [PATCH v2 20/43] KVM: VMX: Skip Posted Interrupt updates if APICv is hard disabled Message-Id: List-Id: References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-21-seanjc@google.com> In-Reply-To: <20211009021236.4122790-21-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang On Fri, 2021-10-08 at 19:12 -0700, Sean Christopherson wrote: > Explicitly skip posted interrupt updates if APICv is disabled in all of > KVM, or if the guest doesn't have an in-kernel APIC. The PI descriptor > is kept up-to-date if APICv is inhibited, e.g. so that re-enabling APICv > doesn't require a bunch of updates, but neither the module param nor the > APIC type can be changed on-the-fly. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/posted_intr.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c > index 3263056784f5..351666c41bbc 100644 > --- a/arch/x86/kvm/vmx/posted_intr.c > +++ b/arch/x86/kvm/vmx/posted_intr.c > @@ -28,11 +28,14 @@ void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu) > unsigned int dest; > > /* > - * In case of hot-plug or hot-unplug, we may have to undo > - * vmx_vcpu_pi_put even if there is no assigned device. And we > - * always keep PI.NDST up to date for simplicity: it makes the > - * code easier, and CPU migration is not a fast path. > + * To simplify hot-plug and dynamic toggling of APICv, keep PI.NDST and > + * PI.SN up-to-date even if there is no assigned device or if APICv is > + * deactivated due to a dynamic inhibit bit, e.g. for Hyper-V's SyncIC. > */ > + if (!enable_apicv || !lapic_in_kernel(vcpu)) > + return; > + > + /* Nothing to do if PI.SN=0 and the vCPU isn't being migrated. */ > if (!pi_test_sn(pi_desc) && vcpu->cpu = cpu) > return; > Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky