From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
Jens Axboe <axboe@kernel.dk>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH] percpu-rwsem: use barrier in unlock path
Date: Wed, 17 Oct 2012 13:58:05 +0800 [thread overview]
Message-ID: <507E48ED.8060809@cn.fujitsu.com> (raw)
In-Reply-To: <CA+55aFyZ9uq_yfHn9PwpmM77X3xVd+xseEbjJmeCCqbFddtjWA@mail.gmail.com>
On 10/17/2012 10:23 AM, Linus Torvalds wrote:
> [ Architecture people, note the potential new SMP barrier! ]
>
> On Tue, Oct 16, 2012 at 4:30 PM, Mikulas Patocka <mpatocka@redhat.com> wrote:
>> + /*
>> + * The lock is considered unlocked when p->locked is set to false.
>> + * Use barrier prevent reordering of operations around p->locked.
>> + */
>> +#if defined(CONFIG_X86) && (!defined(CONFIG_X86_PPRO_FENCE) && !defined(CONFIG_X86_OOSTORE))
>> + barrier();
>> +#else
>> + smp_mb();
>> +#endif
>> p->locked = false;
>
> Ugh. The #if is too ugly to live.
Even the previous patch is applied, percpu_down_read() still
needs mb() to pair with it.
>
> This is a classic case of "people who write their own serialization
> primitives invariably get them wrong". And this fix is just horrible,
> and code like this should not be allowed.
One of the most major problems of 62ac665ff9fc07497ca524bd20d6a96893d11071 is that
it is merged without Ackeds or Revieweds from Paul or Peter or someone else
who are expert at synchronization/arch memory models.
I suggest any new synchronization should stay in -tip for 2 or more cycles
before merged to mainline.
Thanks,
Lai
next prev parent reply other threads:[~2012-10-17 5:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.64.1210151716310.10685@file.rdu.redhat.com>
[not found] ` <Pine.LNX.4.64.1210161924350.20581@file.rdu.redhat.com>
2012-10-17 2:23 ` [PATCH] percpu-rwsem: use barrier in unlock path Linus Torvalds
2012-10-17 5:58 ` Lai Jiangshan [this message]
2012-10-17 5:58 ` Lai Jiangshan
2012-10-17 15:07 ` Mikulas Patocka
2012-10-17 20:28 ` Steven Rostedt
2012-10-17 20:28 ` Steven Rostedt
2012-10-18 2:18 ` Lai Jiangshan
2012-10-18 4:13 ` Steven Rostedt
2012-10-18 16:17 ` Mikulas Patocka
2012-10-18 15:32 ` Mikulas Patocka
2012-10-18 19:56 ` Mikulas Patocka
2012-10-18 16:05 ` Mikulas Patocka
2012-10-17 9:56 ` Alan Cox
2012-10-18 16:00 ` Mikulas Patocka
2012-10-19 18:48 ` Linus Torvalds
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=507E48ED.8060809@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=axboe@kernel.dk \
--cc=eric.dumazet@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).