Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-02-18 Thread Srivatsa Vaddagiri
> On Mon, Jan 24, 2011 at 01:56:53PM -0800, Jeremy Fitzhardinge wrote: For some reason, I seem to be missing emails from your id/domain and hence had missed this completely! > > * bits. However, we need to be careful about this because someone > > * may just be entering as we leave, and ente

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-24 Thread Jeremy Fitzhardinge
On 01/19/2011 08:23 AM, Srivatsa Vaddagiri wrote: > On Mon, Jan 17, 2011 at 08:52:22PM +0530, Srivatsa Vaddagiri wrote: >> I think this is still racy .. >> >> Unlocker Locker >> >> >> test slowpath >> -> false >> >>

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-20 Thread Jan Beulich
>>> On 19.01.11 at 19:55, Jeremy Fitzhardinge wrote: > On 01/19/2011 10:39 AM, Srivatsa Vaddagiri wrote: >> I have tested quite extensively with booting a 16-vcpu guest (on a 16-pcpu > host) >> and running kernel compine (with 32-threads). Without this patch, I had >> difficulty booting/shutting-

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-19 Thread Srivatsa Vaddagiri
On Wed, Jan 19, 2011 at 10:55:10AM -0800, Jeremy Fitzhardinge wrote: > On 01/19/2011 10:39 AM, Srivatsa Vaddagiri wrote: > > I have tested quite extensively with booting a 16-vcpu guest (on a 16-pcpu > > host) > > and running kernel compine (with 32-threads). Without this patch, I had > > difficul

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-19 Thread Jeremy Fitzhardinge
On 01/19/2011 10:39 AM, Srivatsa Vaddagiri wrote: > I have tested quite extensively with booting a 16-vcpu guest (on a 16-pcpu > host) > and running kernel compine (with 32-threads). Without this patch, I had > difficulty booting/shutting-down successfully (it would hang mid-way). Sounds good. B

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-19 Thread Srivatsa Vaddagiri
On Wed, Jan 19, 2011 at 10:31:06AM -0800, Jeremy Fitzhardinge wrote: > I think you're probably right; when I last tested this code, it was > hanging in at about the rate this kind of race would cause. And in my > previous analysis of similar schemes (the current pv spinlock code), it > was always

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-19 Thread Jeremy Fitzhardinge
On 01/17/2011 07:22 AM, Srivatsa Vaddagiri wrote: > On Tue, Nov 16, 2010 at 01:08:44PM -0800, Jeremy Fitzhardinge wrote: >> From: Jeremy Fitzhardinge >> >> Maintain a flag in both LSBs of the ticket lock which indicates whether >> anyone is in the lock slowpath and may need kicking when the curren

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-19 Thread Srivatsa Vaddagiri
On Mon, Jan 17, 2011 at 08:52:22PM +0530, Srivatsa Vaddagiri wrote: > I think this is still racy .. > > Unlocker Locker > > > test slowpath > -> false > > set slowpath flag >

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2011-01-17 Thread Srivatsa Vaddagiri
On Tue, Nov 16, 2010 at 01:08:44PM -0800, Jeremy Fitzhardinge wrote: > From: Jeremy Fitzhardinge > > Maintain a flag in both LSBs of the ticket lock which indicates whether > anyone is in the lock slowpath and may need kicking when the current > holder unlocks. The flags are set when the first l

Re: [Xen-devel] Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Jeremy Fitzhardinge
On 11/17/2010 04:21 AM, Peter Zijlstra wrote: > On Tue, 2010-11-16 at 13:08 -0800, Jeremy Fitzhardinge wrote: >> Maintain a flag in both LSBs of the ticket lock which indicates whether >> anyone is in the lock slowpath and may need kicking when the current >> holder unlocks. The flags are set when

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Peter Zijlstra
On Tue, 2010-11-16 at 13:08 -0800, Jeremy Fitzhardinge wrote: > Maintain a flag in both LSBs of the ticket lock which indicates whether > anyone is in the lock slowpath and may need kicking when the current > holder unlocks. The flags are set when the first locker enters > the slowpath, and cleare

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Jan Beulich
>>> On 17.11.10 at 10:08, Jeremy Fitzhardinge wrote: > On 11/17/2010 12:56 AM, Jeremy Fitzhardinge wrote: >> On 11/17/2010 12:52 AM, Jeremy Fitzhardinge wrote: >>> But, yes, %z0 sounds interesting. Is it documented anywhere? I think >>> I've tried to use it in the past and run into gcc bugs. >>

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Avi Kivity
On 11/17/2010 11:05 AM, Jeremy Fitzhardinge wrote: > On 11/17/2010 12:58 AM, Avi Kivity wrote: > >> Actually in this case I'm pretty sure there's already a "set bit" > >> function which will do the job. set_bit(), I guess, though it takes a > >> bit number rather than a mask... > >> > > > > > >

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Jeremy Fitzhardinge
On 11/17/2010 12:56 AM, Jeremy Fitzhardinge wrote: > On 11/17/2010 12:52 AM, Jeremy Fitzhardinge wrote: >> But, yes, %z0 sounds interesting. Is it documented anywhere? I think >> I've tried to use it in the past and run into gcc bugs. > This one: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39590

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Jeremy Fitzhardinge
On 11/17/2010 12:58 AM, Avi Kivity wrote: >> Actually in this case I'm pretty sure there's already a "set bit" >> function which will do the job. set_bit(), I guess, though it takes a >> bit number rather than a mask... >> > > > set_bit() operates on a long, while the intel manuals recommend > aga

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Avi Kivity
On 11/17/2010 10:52 AM, Jeremy Fitzhardinge wrote: > On 11/17/2010 12:31 AM, Jan Beulich wrote: > On 16.11.10 at 22:08, Jeremy Fitzhardinge wrote: > >> +static inline void __ticket_enter_slowpath(struct arch_spinlock *lock) > >> +{ > >> + if (sizeof(lock->tickets.tail) == sizeof(u8)) > >>

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Jeremy Fitzhardinge
On 11/17/2010 12:52 AM, Jeremy Fitzhardinge wrote: > But, yes, %z0 sounds interesting. Is it documented anywhere? I think > I've tried to use it in the past and run into gcc bugs. This one: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39590 Should be OK in this case because there's no 64-bit valu

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Jeremy Fitzhardinge
On 11/17/2010 12:31 AM, Jan Beulich wrote: On 16.11.10 at 22:08, Jeremy Fitzhardinge wrote: >> +static inline void __ticket_enter_slowpath(struct arch_spinlock *lock) >> +{ >> +if (sizeof(lock->tickets.tail) == sizeof(u8)) >> +asm (LOCK_PREFIX "orb %1, %0" >> +

Re: [PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-17 Thread Jan Beulich
>>> On 16.11.10 at 22:08, Jeremy Fitzhardinge wrote: > +static inline void __ticket_enter_slowpath(struct arch_spinlock *lock) > +{ > + if (sizeof(lock->tickets.tail) == sizeof(u8)) > + asm (LOCK_PREFIX "orb %1, %0" > + : "+m" (lock->tickets.tail) > +

[PATCH 13/14] x86/ticketlock: add slowpath logic

2010-11-16 Thread Jeremy Fitzhardinge
From: Jeremy Fitzhardinge Maintain a flag in both LSBs of the ticket lock which indicates whether anyone is in the lock slowpath and may need kicking when the current holder unlocks. The flags are set when the first locker enters the slowpath, and cleared when unlocking to an empty queue. In th