From: Will Deacon <will.deacon@arm.com>
To: xinhui <xinhui.pan@linux.vnet.ibm.com>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
arnd@arndb.de, waiman.long@hp.com, peterz@infradead.org
Subject: Re: [PATCH] locking/qrwlock: fix write unlock issue in big endian
Date: Tue, 14 Jun 2016 11:40:33 +0100 [thread overview]
Message-ID: <20160614104032.GE19407@arm.com> (raw)
In-Reply-To: <575FA024.7060608@linux.vnet.ibm.com>
On Tue, Jun 14, 2016 at 02:11:48PM +0800, xinhui wrote:
>
> On 2016年06月08日 17:22, Will Deacon wrote:
> >On Thu, Jun 02, 2016 at 06:09:08PM +0800, Pan Xinhui wrote:
> >>strcut __qrwlock has different layout in big endian machine. we need set
> >>the __qrwlock->wmode to NULL, and the address is not &lock->cnts in big
> >>endian machine.
> >>
> >>Do as what read unlock does. we are lucky that the __qrwlock->wmode's
> >>val is _QW_LOCKED.
> >
> >Doesn't this have wider implications for the qrwlocks, for example:
> >
> > while ((cnts & _QW_WMASK) == _QW_LOCKED) { ... }
> >
> >would actually end up looking at the wrong field of the lock?
> >
> I does not clearly understand your idea. :(
That's because I'm talking rubbish :) Sorry, I completely confused myself.
Locking is bad enough on its own, but add big-endian to the mix and I'm
all done.
> >Shouldn't we just remove the #ifdef __LITTLE_ENDIAN stuff from __qrwlock,
> >given that all the struct members are u8?
> >
> No. that makes codes complex. for example
>
> struct __qrwlock lock;
>
> WRITE_ONCE(lock->wmode, _QW_WAITING);
> if (atomic_(&lock->cnts) == _QW_WAITING) {
> do_something();
> }
>
> IF you remove the #ifdef __LITTLE_ENDIAN stuff from __qrwlock.
> codes above obviously will break. And we already have such code.
I was wondering more along the lines of having one definition of the data
structure, but then defining _QW_* differently depending on endianness
(i.e. add a << 24 when big-endian). That way queued_write_unlock can
stay like it is (having an arch override to handle the big-endian case
is incredibly ugly).
Will
next prev parent reply other threads:[~2016-06-14 10:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 10:09 [PATCH] locking/qrwlock: fix write unlock issue in big endian Pan Xinhui
2016-06-02 10:44 ` Arnd Bergmann
2016-06-02 11:01 ` xinhui
2016-06-02 11:15 ` Peter Zijlstra
2016-06-03 7:20 ` xinhui
2016-06-02 11:02 ` Peter Zijlstra
2016-06-03 7:17 ` xinhui
2016-06-03 7:17 ` xinhui
[not found] ` <201606030718.u537FQg0009963@mx0a-001b2d01.pphosted.com>
2016-06-03 20:57 ` Waiman Long
2016-06-03 20:57 ` Waiman Long
2016-06-06 3:15 ` xinhui
2016-06-06 3:15 ` xinhui
2016-06-08 9:22 ` Will Deacon
2016-06-14 6:11 ` xinhui
2016-06-14 10:40 ` Will Deacon [this message]
2016-06-15 3:47 ` xinhui
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=20160614104032.GE19407@arm.com \
--to=will.deacon@arm.com \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=waiman.long@hp.com \
--cc=xinhui.pan@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.