Generic Linux architectural discussions
 help / color / mirror / Atom feed
From: xinhui <xinhui.pan@linux.vnet.ibm.com>
To: Will Deacon <will.deacon@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	ingo@redhat.com, peterz@infradead.org, arnd@arndb.de,
	Waiman.Long@hpe.com
Subject: Re: [PATCH] locking/qrwlock: Let qrwlock has same layout regardless of the endian
Date: Wed, 15 Jun 2016 17:28:17 +0800	[thread overview]
Message-ID: <57611FB1.8050205@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160615092051.GC24029@arm.com>



On 2016年06月15日 17:20, Will Deacon wrote:
> 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...
>
oh... I am really in rush. sorry. will fix it and seed patch v2 soon.

thank you for pointing it out.

> Will
>

  reply	other threads:[~2016-06-15  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15  9:16 [PATCH] locking/qrwlock: Let qrwlock has same layout regardless of the endian Pan Xinhui
2016-06-15  9:16 ` Pan Xinhui
2016-06-15  9:20 ` Will Deacon
2016-06-15  9:28   ` xinhui [this message]
2016-06-15  9:28     ` xinhui
2016-06-15  9:46 ` kbuild test robot
2016-06-15  9:46   ` kbuild test robot
2016-06-15  9:49 ` kbuild test robot
2016-06-15  9:49   ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57611FB1.8050205@linux.vnet.ibm.com \
    --to=xinhui.pan@linux.vnet.ibm.com \
    --cc=Waiman.Long@hpe.com \
    --cc=arnd@arndb.de \
    --cc=ingo@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox