From: "Jan Beulich" Subject: [PATCH] x86: don't change affinity with interrupt unmasked Date: Fri, 20 Mar 2015 15:40:02 +0000 Message-ID: <550C4D62020000780006C258@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4C781842.1__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYz1o-0003qy-Gs for xen-devel@lists.xenproject.org; Fri, 20 Mar 2015 15:40:04 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4C781842.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline With ->startup unmasking the IRQ, setting the affinity afterwards without masking the IRQ again is invalid namely for MSI (which can't have their affinity updated atomically). Signed-off-by: Jan Beulich --- Changing the affinity of non-maskable MSI IRQs seems bogus too, but I can't immediately see what we can do about this (better than disabling affinity changes for them). --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1608,12 +1608,13 @@ int pirq_guest_bind(struct vcpu *v, stru init_timer(&action->eoi_timer, irq_guest_eoi_timer_fn, desc, 0); =20 desc->status |=3D IRQ_GUEST; - desc->status &=3D ~IRQ_DISABLED; - desc->handler->startup(desc); =20 /* Attempt to bind the interrupt target to the correct CPU. */ if ( !opt_noirqbalance && (desc->handler->set_affinity !=3D NULL) = ) desc->handler->set_affinity(desc, cpumask_of(v->processor)); + + desc->status &=3D ~IRQ_DISABLED; + desc->handler->startup(desc); } else if ( !will_share || !action->shareable ) { --=__Part4C781842.1__= Content-Type: text/plain; name="x86-initial-IRQ-affinity.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-initial-IRQ-affinity.patch" x86: don't change affinity with interrupt unmasked=0A=0AWith ->startup = unmasking the IRQ, setting the affinity afterwards=0Awithout masking the = IRQ again is invalid namely for MSI (which can't=0Ahave their affinity = updated atomically).=0A=0ASigned-off-by: Jan Beulich =0A= ---=0AChanging the affinity of non-maskable MSI IRQs seems bogus too, but = I=0Acan't immediately see what we can do about this (better than = disabling=0Aaffinity changes for them).=0A=0A--- a/xen/arch/x86/irq.c=0A+++= b/xen/arch/x86/irq.c=0A@@ -1608,12 +1608,13 @@ int pirq_guest_bind(struct = vcpu *v, stru=0A init_timer(&action->eoi_timer, irq_guest_eoi_timer= _fn, desc, 0);=0A =0A desc->status |=3D IRQ_GUEST;=0A- = desc->status &=3D ~IRQ_DISABLED;=0A- desc->handler->startup(desc);= =0A =0A /* Attempt to bind the interrupt target to the correct = CPU. */=0A if ( !opt_noirqbalance && (desc->handler->set_affinity = !=3D NULL) )=0A desc->handler->set_affinity(desc, cpumask_of(v-= >processor));=0A+=0A+ desc->status &=3D ~IRQ_DISABLED;=0A+ = desc->handler->startup(desc);=0A }=0A else if ( !will_share || = !action->shareable )=0A {=0A --=__Part4C781842.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part4C781842.1__=--