From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [v3 25/26] KVM: Suppress posted-interrupt when 'SN' is set Date: Wed, 17 Dec 2014 18:42:55 +0100 Message-ID: <5491C09F.9010409@redhat.com> References: <1418397300-10870-1-git-send-email-feng.wu@intel.com> <1418397300-10870-26-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , KVM list , Eric Auger To: kvm@vger.kernel.org Return-path: Received: from plane.gmane.org ([80.91.229.3]:34962 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbaLQRnL (ORCPT ); Wed, 17 Dec 2014 12:43:11 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Y1Icv-0001Cg-0O for kvm@vger.kernel.org; Wed, 17 Dec 2014 18:43:09 +0100 Received: from net-2-35-193-40.cust.vodafonedsl.it ([2.35.193.40]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2014 18:43:08 +0100 Received: from pbonzini by net-2-35-193-40.cust.vodafonedsl.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2014 18:43:08 +0100 In-Reply-To: <1418397300-10870-26-git-send-email-feng.wu@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/12/2014 16:14, Feng Wu wrote: > Currently, we don't support urgent interrupt, all interrupts > are recognized as non-urgent interrupt, so we cannot send > posted-interrupt when 'SN' is set. Can this happen? If the vcpu is in guest mode, it cannot have been scheduled out, and that's the only case when SN is set. Paolo > Signed-off-by: Feng Wu > --- > arch/x86/kvm/vmx.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index a1c83a2..0aee151 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -4401,15 +4401,22 @@ static int vmx_vm_has_apicv(struct kvm *kvm) > static void vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) > { > struct vcpu_vmx *vmx = to_vmx(vcpu); > - int r; > + int r, sn; > > if (pi_test_and_set_pir(vector, &vmx->pi_desc)) > return; > > + /* > + * Currently, we don't support urgent interrupt, all interrupts > + * are recognized as non-urgent interrupt, so we cannot send > + * posted-interrupt when 'SN' is set. > + */ > + sn = pi_test_sn(&vmx->pi_desc); > + > r = pi_test_and_set_on(&vmx->pi_desc); > kvm_make_request(KVM_REQ_EVENT, vcpu); > #ifdef CONFIG_SMP > - if (!r && (vcpu->mode == IN_GUEST_MODE)) > + if (!r && !sn && (vcpu->mode == IN_GUEST_MODE)) > apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), > POSTED_INTR_VECTOR); > else > --