From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v5 08/17] vmx: Suppress posting interrupts when 'SN' is set Date: Wed, 12 Aug 2015 13:03:23 -0400 Message-ID: <20150812170323.GL17650@l.oracle.com> References: <1439346938-31824-1-git-send-email-feng.wu@intel.com> <1439346938-31824-9-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1439346938-31824-9-git-send-email-feng.wu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu Cc: Andrew Cooper , Kevin Tian , Keir Fraser , Jan Beulich , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Aug 12, 2015 at 10:35:29AM +0800, 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. > > CC: Kevin Tian > CC: Keir Fraser > CC: Jan Beulich > CC: Andrew Cooper > Signed-off-by: Feng Wu > --- > v5: > - keep the vcpu_kick() at the end of vmx_deliver_posted_intr() > - Keep the 'return' after calling __vmx_deliver_posted_interrupt() > > v4: > - Coding style. > - V3 removes a vcpu_kick() from the eoi_exitmap_changed path > incorrectly, fix it. > > v3: > - use cmpxchg to test SN/ON and set ON > > xen/arch/x86/hvm/vmx/vmx.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c > index c32d863..d2a4cfb 100644 > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -1701,8 +1701,35 @@ static void vmx_deliver_posted_intr(struct vcpu *v, u8 vector) > */ > pi_set_on(&v->arch.hvm_vmx.pi_desc); > } > - else if ( !pi_test_and_set_on(&v->arch.hvm_vmx.pi_desc) ) > + else > { > + struct pi_desc old, new, prev; > + Could you add a comment saying: /* To skip over first check in the loop below. */ just to easy somebody in reading the code. > + prev.control = 0; > + > + do { > + /* > + * 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. > + * Besides that, if 'ON' is already set, we cannot set > + * posted-interrupts as well. > + */ > + if ( pi_test_sn(&prev) || pi_test_on(&prev) ) > + { > + vcpu_kick(v); > + return; > + } > + > + old.control = v->arch.hvm_vmx.pi_desc.control & > + ~( 1 << POSTED_INTR_ON | 1 << POSTED_INTR_SN ); > + new.control = v->arch.hvm_vmx.pi_desc.control | > + 1 << POSTED_INTR_ON; > + > + prev.control = cmpxchg(&v->arch.hvm_vmx.pi_desc.control, > + old.control, new.control); > + } while ( prev.control != old.control ); > + > __vmx_deliver_posted_interrupt(v); > return; > } Otherwise: Reviewed-by: Konrad Rzeszutek Wilk > -- > 2.1.0 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel