From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753775AbbIPJcl (ORCPT ); Wed, 16 Sep 2015 05:32:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60775 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752262AbbIPJck (ORCPT ); Wed, 16 Sep 2015 05:32:40 -0400 Subject: Re: [PATCH v8 12/13] KVM: Warn if 'SN' is set during posting interrupts by software To: Feng Wu , alex.williamson@redhat.com, joro@8bytes.org, mtosatti@redhat.com References: <1442393409-2623-1-git-send-email-feng.wu@intel.com> <1442393409-2623-13-git-send-email-feng.wu@intel.com> Cc: eric.auger@linaro.org, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: <55F93733.2010403@redhat.com> Date: Wed, 16 Sep 2015 11:32:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1442393409-2623-13-git-send-email-feng.wu@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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; >