From: "Jan Beulich" Subject: [PATCH 2/2] x86/IRQ: consolidate IRQ disabling when acquiring vector lock Date: Thu, 03 Nov 2011 14:27:27 +0000 Message-ID: <4EB2B2DF020000780005EBF0@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartEFC01EDF.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" 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. --=__PartEFC01EDF.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline x86/IRQ: consolidate IRQ disabling when acquiring vector lock __assign_irq_vector() doesn't need to disable interrupts (its callers are required to when acquiring the lock), and set_desc_affinity() can use the normal spin lock primitives. Signed-off-by: Jan Beulich --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -429,7 +429,6 @@ static int __assign_irq_vector( static int current_vector =3D FIRST_DYNAMIC_VECTOR, current_offset = =3D 0; unsigned int old_vector; int cpu, err; - unsigned long flags; cpumask_t tmp_mask; vmask_t *irq_used_vectors =3D NULL; =20 @@ -493,7 +492,6 @@ next: /* Found one! */ current_vector =3D vector; current_offset =3D offset; - local_irq_save(flags); if (old_vector) { desc->arch.move_in_progress =3D 1; cpumask_copy(desc->arch.old_cpu_mask, desc->arch.cpu_mask); @@ -521,7 +519,6 @@ next: } =20 err =3D 0; - local_irq_restore(flags); break; } return err; @@ -720,11 +717,9 @@ unsigned int set_desc_affinity(struct ir =20 irq =3D desc->irq; =20 - local_irq_save(flags); - lock_vector_lock(); + spin_lock_irqsave(&vector_lock, flags); ret =3D __assign_irq_vector(irq, desc, mask); - unlock_vector_lock(); - local_irq_restore(flags); + spin_unlock_irqrestore(&vector_lock, flags); =20 if (ret < 0) return BAD_APICID; --=__PartEFC01EDF.0__= Content-Type: text/plain; name="x86-vector-lock-flags.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-vector-lock-flags.patch" x86/IRQ: consolidate IRQ disabling when acquiring vector lock=0A=0A__assign= _irq_vector() doesn't need to disable interrupts (its callers=0Aare = required to when acquiring the lock), and set_desc_affinity() can=0Ause = the normal spin lock primitives.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/irq.c=0A+++ b/xen/arch/x86/irq.c=0A@@ = -429,7 +429,6 @@ static int __assign_irq_vector(=0A static int = current_vector =3D FIRST_DYNAMIC_VECTOR, current_offset =3D 0;=0A = unsigned int old_vector;=0A int cpu, err;=0A- unsigned long = flags;=0A cpumask_t tmp_mask;=0A vmask_t *irq_used_vectors =3D = NULL;=0A =0A@@ -493,7 +492,6 @@ next:=0A /* Found one! */=0A = current_vector =3D vector;=0A current_offset =3D offset;=0A- = local_irq_save(flags);=0A if (old_vector) {=0A = desc->arch.move_in_progress =3D 1;=0A cpumask_copy(desc->arch.o= ld_cpu_mask, desc->arch.cpu_mask);=0A@@ -521,7 +519,6 @@ next:=0A = }=0A =0A err =3D 0;=0A- local_irq_restore(flags);=0A = break;=0A }=0A return err;=0A@@ -720,11 +717,9 @@ unsigned int = set_desc_affinity(struct ir=0A =0A irq =3D desc->irq;=0A =0A- = local_irq_save(flags);=0A- lock_vector_lock();=0A+ spin_lock_irqsave(= &vector_lock, flags);=0A ret =3D __assign_irq_vector(irq, desc, = mask);=0A- unlock_vector_lock();=0A- local_irq_restore(flags);=0A+ = spin_unlock_irqrestore(&vector_lock, flags);=0A =0A if (ret < 0)=0A = return BAD_APICID;=0A --=__PartEFC01EDF.0__= 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.xensource.com http://lists.xensource.com/xen-devel --=__PartEFC01EDF.0__=--