From: "Jan Beulich" Subject: Re: [PATCH 09/14] xen/pvticketlock: Xen implementation for PV ticket locks Date: Wed, 17 Nov 2010 08:11:24 +0000 Message-ID: <4CE39C3C0200007800022AE2@vpn.id2.novell.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jeremy Fitzhardinge Cc: Jeremy Fitzhardinge , Mathieu Desnoyers , Nick Piggin , Peter Zijlstra , Linux Kernel Mailing List , Srivatsa Vaddagiri , Eric Dumazet , Xen-devel , Avi Kivity , "H. Peter Anvin" , xiyou.wangcong@gmail.com, Linux Virtualization List-Id: xen-devel@lists.xenproject.org >>> On 16.11.10 at 22:08, Jeremy Fitzhardinge wrote: > +static void xen_lock_spinning(struct arch_spinlock *lock, unsigned = want) > { > - struct xen_spinlock *xl =3D (struct xen_spinlock *)lock; > - struct xen_spinlock *prev; > int irq =3D __get_cpu_var(lock_kicker_irq); > - int ret; > + struct xen_lock_waiting *w =3D &__get_cpu_var(lock_waiting); > + int cpu =3D smp_processor_id(); > u64 start; > =20 > /* If kicker interrupts not initialized yet, just spin */ > if (irq =3D=3D -1) > - return 0; > + return; > =20 > start =3D spin_time_start(); > =20 > - /* announce we're spinning */ > - prev =3D spinning_lock(xl); > + w->want =3D want; > + w->lock =3D lock; > + > + /* This uses set_bit, which atomic and therefore a barrier */ > + cpumask_set_cpu(cpu, &waiting_cpus); Since you don't allow nesting, don't you need to disable interrupts before you touch per-CPU state? Jan