All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 0/5] locking/atomic: generic arch__atomic_long_*() and arch_ bitops
Date: Tue, 13 Jul 2021 11:52:48 +0100	[thread overview]
Message-ID: <20210713105253.7615-1-mark.rutland@arm.com> (raw)

These patches (based on v5.14-rc1) add arch_*() forms of the atomic_long_*()
operations for all architectures, and build atop this to have the generic
bitops provide arch_*() forms, allowing for safe usage in `noinstr` code. For
example, I'd like to be able to use these in arm64's entry code.

The first three patches cleanup the current code, simplifiying this by removing
some ARCH_ATOMIC remnants and centralizing the generated headers under
include/linux/atomic/ for consistency.

Patch four adds arch_atomic_long_*(). This is almost entirely scripted (adding
~600 lines), with the only manual change being to the order of includes in
include/linux/atomic.h, as we must now include atomic-long.h before
atomic-instrumented.h.

Patch five updates the generic bitop implementaton to provide arch_* forms.
Since the non-atomic ops can be implicitly instrumented, some logic is added to
omit the redundant checks.

I've pushed the patches to my atomics/arch-atomic-bitops branch [1,2].

I've given this some light build and boot testing so far.

Thanks,
Mark.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=atomics/arch-atomic-bitops
[2] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git atomics/arch-atomic-bitops

Mark Rutland (5):
  locking/atomic: simplify ifdef generation
  locking/atomic: remove ARCH_ATOMIC remanants
  locking/atomic: centralize generated headers
  locking/atomic: add arch_atomic_long*()
  locking/atomic: add generic arch_*() bitops

 include/asm-generic/atomic-long.h                  | 1014 --------------------
 include/asm-generic/bitops/atomic.h                |   32 +-
 .../asm-generic/bitops/instrumented-non-atomic.h   |   21 +-
 include/asm-generic/bitops/lock.h                  |   39 +-
 include/asm-generic/bitops/non-atomic.h            |   41 +-
 include/linux/atomic.h                             |    7 +-
 include/linux/{ => atomic}/atomic-arch-fallback.h  |    0
 .../atomic}/atomic-instrumented.h                  |  586 ++++++++++-
 include/linux/atomic/atomic-long.h                 | 1014 ++++++++++++++++++++
 scripts/atomic/check-atomics.sh                    |    6 +-
 scripts/atomic/fallbacks/acquire                   |    4 +-
 scripts/atomic/fallbacks/add_negative              |    6 +-
 scripts/atomic/fallbacks/add_unless                |    6 +-
 scripts/atomic/fallbacks/andnot                    |    4 +-
 scripts/atomic/fallbacks/dec                       |    4 +-
 scripts/atomic/fallbacks/dec_and_test              |    6 +-
 scripts/atomic/fallbacks/dec_if_positive           |    6 +-
 scripts/atomic/fallbacks/dec_unless_positive       |    6 +-
 scripts/atomic/fallbacks/fence                     |    4 +-
 scripts/atomic/fallbacks/fetch_add_unless          |    8 +-
 scripts/atomic/fallbacks/inc                       |    4 +-
 scripts/atomic/fallbacks/inc_and_test              |    6 +-
 scripts/atomic/fallbacks/inc_not_zero              |    6 +-
 scripts/atomic/fallbacks/inc_unless_negative       |    6 +-
 scripts/atomic/fallbacks/read_acquire              |    2 +-
 scripts/atomic/fallbacks/release                   |    4 +-
 scripts/atomic/fallbacks/set_release               |    2 +-
 scripts/atomic/fallbacks/sub_and_test              |    6 +-
 scripts/atomic/fallbacks/try_cmpxchg               |    4 +-
 scripts/atomic/gen-atomic-fallback.sh              |   68 +-
 scripts/atomic/gen-atomic-instrumented.sh          |   11 +-
 scripts/atomic/gen-atomic-long.sh                  |   10 +-
 scripts/atomic/gen-atomics.sh                      |    6 +-
 33 files changed, 1772 insertions(+), 1177 deletions(-)
 delete mode 100644 include/asm-generic/atomic-long.h
 rename include/linux/{ => atomic}/atomic-arch-fallback.h (100%)
 rename include/{asm-generic => linux/atomic}/atomic-instrumented.h (68%)
 create mode 100644 include/linux/atomic/atomic-long.h

-- 
2.11.0


             reply	other threads:[~2021-07-13 10:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 10:52 Mark Rutland [this message]
2021-07-13 10:52 ` [PATCH 1/5] locking/atomic: simplify ifdef generation Mark Rutland
2021-07-27 13:58   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2021-07-13 10:52 ` [PATCH 2/5] locking/atomic: remove ARCH_ATOMIC remanants Mark Rutland
2021-07-27 13:58   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2021-07-13 10:52 ` [PATCH 3/5] locking/atomic: centralize generated headers Mark Rutland
2021-07-27 13:58   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2021-07-13 10:52 ` [PATCH 4/5] locking/atomic: add arch_atomic_long*() Mark Rutland
2021-07-27 13:58   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2021-07-13 10:52 ` [PATCH 5/5] locking/atomic: add generic arch_*() bitops Mark Rutland
2021-07-16 10:51   ` Marco Elver
2021-07-16 12:21     ` Mark Rutland
2021-07-16 13:02       ` Marco Elver
2021-07-27 13:58   ` [tip: locking/core] " tip-bot2 for 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=20210713105253.7615-1-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=linux-kernel@vger.kernel.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 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.