From: Peter Zijlstra <peterz@infradead.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
Will Deacon <will.deacon@arm.com>, Jiri Slaby <jslaby@suse.com>
Subject: Re: [PATCH 1/7] atomics/tty: add missing atomic_long_t * cast
Date: Tue, 5 Jun 2018 16:43:04 +0200 [thread overview]
Message-ID: <20180605144304.GW12180@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180605142051.GB12925@kroah.com>
On Tue, Jun 05, 2018 at 04:20:51PM +0200, Greg Kroah-Hartman wrote:
> I think Peter Hurley was just trying to hid the atomic mess behind
> function calls, which is why he didn't open-code it like you did here.
No reason to then not use the right types though. I mean, you can still
use the helper functions, but I figured they weren't worth the bother.
Esp. then using try_cmpxchg (which is relatively new) the helpers became
very thin.
> But this makes it a bit more obvious as to what "magic" is happening, so
> I like it.
Well, it also fixes one additional bug in that the old code used a
regular unsigned long load of the value:
- long count = sem->count;
+ long count = atomic_long_read(&sem->count);
which doesn't guarantee enough. The atomic_long_read() thing implies
READ_ONCE() which ensures the load is single copy atomic (GCC used to
guarantee that for regular loads/stores to naturally aligned native
words, but no longer).
> Care to turn it into a real patch so I can queue it up after 4.18-rc1 is
> out? Or do you want me to do that?
I can make a proper patch, hold on.
next prev parent reply other threads:[~2018-06-05 14:43 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 18:07 [PATCH 0/7] atomics: generate atomic headers Mark Rutland
2018-05-29 18:07 ` [PATCH 1/7] atomics/tty: add missing atomic_long_t * cast Mark Rutland
2018-05-29 18:35 ` Greg Kroah-Hartman
2018-06-05 12:00 ` Peter Zijlstra
2018-06-05 14:20 ` Greg Kroah-Hartman
2018-06-05 14:43 ` Peter Zijlstra [this message]
2018-06-05 14:53 ` Peter Zijlstra
2018-06-06 13:55 ` Mark Rutland
2018-06-06 14:00 ` Greg Kroah-Hartman
2018-06-22 16:55 ` Mark Rutland
2018-06-28 12:07 ` Greg Kroah-Hartman
2018-05-29 18:07 ` [PATCH 2/7] atomics/treewide: rework ordering barriers Mark Rutland
2018-06-05 12:16 ` Peter Zijlstra
2018-06-05 13:28 ` Mark Rutland
2018-06-05 13:56 ` Peter Zijlstra
2018-06-05 14:02 ` Mark Rutland
2018-06-05 14:15 ` Peter Zijlstra
2018-05-29 18:07 ` [PATCH 3/7] atomics: separate basic {cmp,}xchg() Mark Rutland
2018-05-29 18:07 ` [PATCH 4/7] atomics: add common header generation files Mark Rutland
2018-06-05 12:25 ` Peter Zijlstra
2018-06-05 12:52 ` Mark Rutland
2018-05-29 18:07 ` [PATCH 5/7] atomics: switch to generated fallbacks Mark Rutland
2018-05-29 18:07 ` [PATCH 6/7] atomics: switch to generated atomic-long Mark Rutland
2018-05-29 18:07 ` [PATCH 7/7] atomics: switch to generated instrumentation Mark Rutland
2018-06-04 16:21 ` [PATCH 0/7] atomics: generate atomic headers Dmitry Vyukov
2018-06-05 5:56 ` Mark Rutland
2018-06-05 13:31 ` Peter Zijlstra
2018-06-05 13:29 ` Peter Zijlstra
2018-06-05 13:58 ` Mark Rutland
2018-06-05 14:14 ` Peter Zijlstra
2018-06-05 14:23 ` Mark Rutland
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=20180605144304.GW12180@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=boqun.feng@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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
all inboxes | Powered by JetHome®