Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1422820

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

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] locking/qrwlock: Let qrwlock has same layout regardless of the endian
Date 2016-06-15 11:30 +0200
Message-ID <rKfj3-Ig-7@gated-at.bofh.it> (permalink)
References <rKf9o-F4-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jun 15, 2016 at 05:16:17PM +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 field of __qrwlock.
> 
> Actually qrwlock can have same layout, IOW we can remove the #if
> __little_endian in struct __qrwlock. With such modification, we only
> need define some _QW* and _QR* with corresponding values in different
> endian systems.
> 
> Suggested-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
> ---
>  include/asm-generic/qrwlock.h | 15 +++++++++++----
>  kernel/locking/qrwlock.c      | 10 ++++------
>  2 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h
> index 54a8e65..b135c11 100644
> --- a/include/asm-generic/qrwlock.h
> +++ b/include/asm-generic/qrwlock.h
> @@ -27,11 +27,18 @@
>  /*
>   * Writer states & reader shift and bias
>   */
> -#define	_QW_WAITING	1		/* A writer is waiting	   */
> -#define	_QW_LOCKED	0xff		/* A writer holds the lock */
> -#define	_QW_WMASK	0xff		/* Writer mask		   */
> +#ifdef	__LITTLE_ENDIAN
>  #define	_QR_SHIFT	8		/* Reader count shift	   */
> -#define _QR_BIAS	(1U << _QR_SHIFT)
> +#define	_QW_SHIFF	0		/* Writer mode shift	*/

Well, there are other typos that could've been worse, but you probably
want to fix this...

Will

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] locking/qrwlock: Let qrwlock has same layout regardless of the endian Pan Xinhui <xinhui.pan@linux.vnet.ibm.com> - 2016-06-15 11:20 +0200
  Re: [PATCH] locking/qrwlock: Let qrwlock has same layout regardless  of the endian xinhui <xinhui.pan@linux.vnet.ibm.com> - 2016-06-15 11:30 +0200
  Re: [PATCH] locking/qrwlock: Let qrwlock has same layout regardless  of the endian Will Deacon <will.deacon@arm.com> - 2016-06-15 11:30 +0200
  Re: [PATCH] locking/qrwlock: Let qrwlock has same layout regardless  of the endian kbuild test robot <lkp@intel.com> - 2016-06-15 12:00 +0200

csiph-web