Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-14 Thread panxinhui
在 16/7/14 17:37, Peter Zijlstra 写道: On Thu, Jul 14, 2016 at 03:44:42PM +0800, xinhui wrote: OK, so I poked at this a bit and I ended up with the below; but now qrwlock and qspinlock are inconsistent; although I suspect qspinlock is similarly busted wrt endian muck. Not sure what to do.. Let

Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-14 Thread Boqun Feng
On Thu, Jul 14, 2016 at 11:46:26AM +0200, Peter Zijlstra wrote: > On Thu, Jul 14, 2016 at 11:37:33AM +0200, Peter Zijlstra wrote: > > static inline u8 *__qspinlock_lock_byte(struct qspinlock *lock) > > { > > return (u8 *)lock + 3 * IS_BUILTIN(__BIG_ENDIAN); > > } > > Bugger, that doesn't actua

Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-14 Thread Peter Zijlstra
On Thu, Jul 14, 2016 at 11:37:33AM +0200, Peter Zijlstra wrote: > static inline u8 *__qspinlock_lock_byte(struct qspinlock *lock) > { > return (u8 *)lock + 3 * IS_BUILTIN(__BIG_ENDIAN); > } Bugger, that doesn't actually work. IS_BUILTIN expects the symbol to be defined to "1" and __BIG_ENDIA

Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-14 Thread Peter Zijlstra
On Thu, Jul 14, 2016 at 03:44:42PM +0800, xinhui wrote: > >OK, so I poked at this a bit and I ended up with the below; but now > >qrwlock and qspinlock are inconsistent; although I suspect qspinlock is > >similarly busted wrt endian muck. > > > >Not sure what to do.. > > > Lets talk about the qspin

Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-14 Thread xinhui
On 2016年07月14日 03:54, Peter Zijlstra wrote: On Mon, Jun 20, 2016 at 02:20:52PM +0800, Pan Xinhui wrote: This patch aims to get rid of endianness in queued_write_unlock(). We want to set __qrwlock->wmode to NULL, however the address is not &lock->cnts in big endian machine. That causes queued_

Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-13 Thread Waiman Long
On 07/13/2016 03:54 PM, Peter Zijlstra wrote: On Mon, Jun 20, 2016 at 02:20:52PM +0800, Pan Xinhui wrote: This patch aims to get rid of endianness in queued_write_unlock(). We want to set __qrwlock->wmode to NULL, however the address is not &lock->cnts in big endian machine. That causes queued_

Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-13 Thread Peter Zijlstra
On Wed, Jul 13, 2016 at 09:54:23PM +0200, Peter Zijlstra wrote: > Urgh, I hate this stuff :/ > + * Writer states & reader shift and bias. > + * > + * | +0 | +1 | +2 | +3 | > + * +++++ > + *LE | 12 | 34 | 56 | 78 | 0x12345678 > + * +++++ > + *

Re: [PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-07-13 Thread Peter Zijlstra
On Mon, Jun 20, 2016 at 02:20:52PM +0800, Pan Xinhui wrote: > This patch aims to get rid of endianness in queued_write_unlock(). We > want to set __qrwlock->wmode to NULL, however the address is not > &lock->cnts in big endian machine. That causes queued_write_unlock() > write NULL to the wrong fi

[PATCH v3] locking/qrwlock: Let qrwlock has same layout regardless of the endian

2016-06-19 Thread Pan Xinhui
This patch aims to get rid of endianness in queued_write_unlock(). We want to set __qrwlock->wmode to NULL, however the address is not &lock->cnts in big endian machine. That causes queued_write_unlock() write NULL to the wrong field of __qrwlock. Actually qrwlock can have same layout, IOW we can