linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mingo@kernel.org (Ingo Molnar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv4 01/12] atomic/tty: Fix up atomic abuse in ldsem
Date: Tue, 24 Jul 2018 13:13:13 +0200	[thread overview]
Message-ID: <20180724111313.GA14212@gmail.com> (raw)
In-Reply-To: <20180724092324.vnfowffsla4kja5c@lakrids.cambridge.arm.com>


* Mark Rutland <mark.rutland@arm.com> wrote:

> On Tue, Jul 24, 2018 at 11:20:36AM +0200, Peter Zijlstra wrote:
> > On Tue, Jul 24, 2018 at 09:15:18AM +0200, Ingo Molnar wrote:
> > > 
> > > * Mark Rutland <mark.rutland@arm.com> wrote:
> > > 
> > > > From: Peter Zijlstra <peterz@infradead.org>
> > > > 
> > > > Mark found ldsem_cmpxchg() needed an (atomic_long_t *) cast to keep
> > > > working after making the atomic_long interface type safe.
> > > > 
> > > > Needing casts is bad form, which made me look at the code. There are no
> > > > ld_semaphore::count users outside of these functions so there is no
> > > > reason why it can not be an atomic_long_t in the first place, obviating
> > > > the need for this cast.
> > > > 
> > > > That also ensures the loads use atomic_long_read(), which implies (at
> > > > least) READ_ONCE() in order to guarantee single-copy-atomic loads.
> > > > 
> > > > When using atomic_long_try_cmpxchg() the ldsem_cmpxchg() wrapper gets
> > > > very thin (the only difference is not changing *old on success, which
> > > > most callers don't seem to care about).
> > > > 
> > > > So rework the whole thing to use atomic_long_t and its accessors
> > > > directly.
> > > > 
> > > > While there, fixup all the horrible comment styles.
> > > > 
> > > > Cc: Peter Hurley <peter@hurleysoftware.com>
> > > > Acked-by: Will Deacon <will.deacon@arm.com>
> > > > Reported-by: Mark Rutland <mark.rutland@arm.com>
> > > > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > > > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > ---
> > > >  drivers/tty/tty_ldsem.c   | 82 ++++++++++++++++++++---------------------------
> > > >  include/linux/tty_ldisc.h |  4 +--
> > > >  2 files changed, 37 insertions(+), 49 deletions(-)
> > > > 
> > > > Note: Greg has queued this via the in the tty tree for v4.19, which can be seen at: 
> > > > 
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/commit/?h=tty-next&id=5fd691afdf929061c391d897fa627822c3b2fd5a
> > > 
> > > Can this patch be skipped, or do the others depend on it?
> > 
> > IIRC it depends on it, without this patch you get build issues due to
> > atomic_long_cmpxchg() getting picky about it's arguments (type safety
> > improved).
> 
> Yup. Without this patch, there will be a build regression at patch 9,
> when we move to generated atomic_long_*() wrappers.

Ok, then these bits will have to wait until Greg's tree goes upstream
in about two weeks.

Which patches can I apply as a preparatory step?

Thanks,

	Ingo

  reply	other threads:[~2018-07-24 11:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 11:30 [PATCHv4 00/12] atomics: generate atomic headers / instrument arm64 Mark Rutland
2018-07-16 11:30 ` [PATCHv4 01/12] atomic/tty: Fix up atomic abuse in ldsem Mark Rutland
2018-07-24  7:15   ` Ingo Molnar
2018-07-24  9:20     ` Peter Zijlstra
2018-07-24  9:23       ` Mark Rutland
2018-07-24 11:13         ` Ingo Molnar [this message]
2018-07-24 13:05           ` Mark Rutland
2018-07-24 13:40             ` Ingo Molnar
2018-07-24 15:06               ` Mark Rutland
2018-07-16 11:30 ` [PATCHv4 02/12] atomics/x86: reduce arch_cmpxchg64*() instrumentation Mark Rutland
2018-07-16 19:23   ` Thomas Gleixner
2018-07-16 11:30 ` [PATCHv4 03/12] atomics: simplify cmpxchg() instrumentation Mark Rutland
2018-07-16 11:30 ` [PATCHv4 04/12] atomics/treewide: instrument xchg() Mark Rutland
2018-07-16 11:30 ` [PATCHv4 05/12] atomics: instrument cmpxchg_double*() Mark Rutland
2018-07-16 11:30 ` [PATCHv4 06/12] atomics/treewide: rework ordering barriers Mark Rutland
2018-07-16 11:30 ` [PATCHv4 07/12] atomics: add common header generation files Mark Rutland
2018-07-16 11:30 ` [PATCHv4 08/12] atomics: switch to generated fallbacks Mark Rutland
2018-07-16 11:30 ` [PATCHv4 09/12] atomics: switch to generated atomic-long Mark Rutland
2018-07-16 11:30 ` [PATCHv4 10/12] atomics: switch to generated instrumentation Mark Rutland
2018-07-16 11:30 ` [PATCHv4 11/12] atomics: check generated headers are up-to-date Mark Rutland
2018-07-16 11:30 ` [PATCHv4 12/12] arm64: use instrumented atomics Mark Rutland
2018-07-23  9:57 ` [PATCHv4 00/12] atomics: generate atomic headers / instrument arm64 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=20180724111313.GA14212@gmail.com \
    --to=mingo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.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).