From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v8 12/13] KVM: Warn if 'SN' is set during posting interrupts by software Date: Wed, 16 Sep 2015 11:32:35 +0200 Message-ID: <55F93733.2010403@redhat.com> References: <1442393409-2623-1-git-send-email-feng.wu@intel.com> <1442393409-2623-13-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org To: Feng Wu , alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org, mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org Return-path: In-Reply-To: <1442393409-2623-13-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: kvm.vger.kernel.org On 16/09/2015 10:50, Feng Wu wrote: > Currently, we don't support urgent interrupt, all interrupts > are recognized as non-urgent interrupt, so we cannot post > interrupts when 'SN' is set. > > If the vcpu is in guest mode, it cannot have been scheduled out, > and that's the only case when SN is set currently, warning if > SN is set. > > Signed-off-by: Feng Wu > Reviewed-by: Paolo Bonzini Please fold this into patch 10. Paolo > --- > arch/x86/kvm/vmx.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 9888c43..58fbbc6 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -4498,6 +4498,22 @@ static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu) > { > #ifdef CONFIG_SMP > if (vcpu->mode == IN_GUEST_MODE) { > + struct vcpu_vmx *vmx = to_vmx(vcpu); > + > + /* > + * Currently, we don't support urgent interrupt, > + * all interrupts are recognized as non-urgent > + * interrupt, so we cannot post interrupts when > + * 'SN' is set. > + * > + * If the vcpu is in guest mode, it means it is > + * running instead of being scheduled out and > + * waiting in the run queue, and that's the only > + * case when 'SN' is set currently, warning if > + * 'SN' is set. > + */ > + WARN_ON_ONCE(pi_test_sn(&vmx->pi_desc)); > + > apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), > POSTED_INTR_VECTOR); > return true; >