Skip to content

Rework READ_ONCE() to improve codegen

Will Deacon lkml 5 versions – Applied

Status from this message: The following commit has been merged into the locking/kcsan branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest18 patches 87 repliesApplied
  2. v411 patches 23 repliesSuperseded
  3. v312 patches 13 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v210 patches30 repliesSuperseded
v1 RFC8 patches23 repliesSuperseded

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/18sparc32: mm: Fix argument checking in __srmmu_get_nocache()arch/sparc/mm/srmmu.c+6 -60 replies
2/18sparc32: mm: Restructure sparc32 MMU page-table layoutarch/sparc/include/asm/page_32.h arch/sparc/include/asm/pgalloc_32.h arch/sparc/include/asm/pgtable_32.h +6 more+58 -1030 replies
3/18sparc32: mm: Change pgtable_t type to pte_t * instead of struct page *arch/sparc/include/asm/page_32.h arch/sparc/include/asm/pgalloc_32.h arch/sparc/include/asm/pgtable_32.h +1 more+24 -240 replies
4/18sparc32: mm: Reduce allocation size for PMD and PTE tablesarch/sparc/include/asm/pgtsrmmu.h+2 -225 replies
5/18compiler/gcc: Raise minimum GCC version for kernel builds to 4.8Documentation/process/changes.rst arch/arm/crypto/Kconfig crypto/Kconfig +3 more+10 -130 replies
6/18netfilter: Avoid assigning 'const' pointer to non-const pointernet/netfilter/core.c+1 -10 replies
7/18net: tls: Avoid assigning 'const' pointer to non-const pointernet/tls/tls_main.c+1 -10 replies
8/18fault_inject: Don't rely on "return value" from WRITE_ONCE()lib/fault-inject.c+3 -10 replies
9/18arm64: csum: Disable KASAN for do_csum()arch/arm64/lib/csum.c+12 -80 replies
10/18READ_ONCE: Simplify implementations of {READ,WRITE}_ONCE()include/linux/compiler.h+55 -860 replies
11/18READ_ONCE: Enforce atomicity for {READ,WRITE}_ONCE() memory accessesdrivers/xen/time.c include/linux/compiler.h+37 -50 replies
12/18READ_ONCE: Drop pointer qualifiers when reading from scalar typesinclude/linux/compiler.h include/linux/compiler_types.h+29 -30 replies
13/18locking/barriers: Use '__unqual_scalar_typeof' for load-acquire macrosinclude/asm-generic/barrier.h+8 -80 replies
14/18arm64: barrier: Use '__unqual_scalar_typeof' for acquire/release macrosarch/arm64/include/asm/barrier.h+8 -80 replies
15/18gcov: Remove old GCC 3.4 supportkernel/gcov/Kconfig kernel/gcov/Makefile kernel/gcov/gcc_3_4.c+1 -5990 replies
16/18kcsan: Rework data_race() so that it can be used by READ_ONCE()include/linux/compiler.h+9 -80 replies
17/18READ_ONCE: Use data_race() to avoid KCSAN instrumentationinclude/linux/compiler.h+24 -297 replies
18/18linux/compiler.h: Remove redundant '#else'include/linux/compiler.h+0 -20 replies

Reviews trailers per patch

6 of 18 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchNick DesaulniersRobin MurphyMark RutlandMasahiro YamadaPeter OberparleiterArnd BergmannPeter Zijlstra (Intel)Guenter Roeck
SeriesA-b
1/18
2/18
3/18
4/18T-b
5/18R-b R-b A-b
6/18R-b
7/18
8/18
9/18A-b A-b
10/18A-b
11/18
12/18
13/18
14/18A-b
15/18R-b R-b A-b
16/18
17/18
18/18

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/18] Rework READ_ONCE() to improve codegen

Hi folks,

(trimmed CC list since v4 since this is largely just a rebase)

This is version five of the READ_ONCE() codegen improvement series that I've previously posted here:

RFC: https://lore.kernel.org/lkml/[email protected]
v2:  https://lore.kernel.org/lkml/[email protected]
v3:  https://lore.kernel.org/lkml/[email protected]
v4:  https://lore.kernel.org/lkml/[email protected]

The main change since v4 is that this is now based on top of the KCSAN changes queued in -tip (locking/kcsan) and therefore contains the patches necessary to avoid breaking sparc32 as well as some cleanups to consolidate {READ,WRITE}_ONCE() and data_race().

Other changes include:

* Treat 'char' as distinct from 'signed char' and 'unsigned char' for __builtin_types_compatible_p()

* Add a compile-time assertion that the argument to READ_ONCE_NOCHECK() points at something the same size as 'unsigned long'

I'm happy for all of this to go via -tip, or I can take it via arm64.

Please let me know.

Cheers,

Will

Cc Marco Elver <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>

--->8

Will Deacon (18):
sparc32: mm: Fix argument checking in __srmmu_get_nocache()
sparc32: mm: Restructure sparc32 MMU page-table layout
sparc32: mm: Change pgtable_t type to pte_t * instead of struct page *
sparc32: mm: Reduce allocation size for PMD and PTE tables compiler/gcc: Raise minimum GCC version for kernel builds to 4.8
netfilter: Avoid assigning 'const' pointer to non-const pointer
net: tls: Avoid assigning 'const' pointer to non-const pointer
fault_inject: Don't rely on "return value" from WRITE_ONCE()
arm64: csum: Disable KASAN for do_csum()
READ_ONCE: Simplify implementations of {READ,WRITE}_ONCE()
READ_ONCE: Enforce atomicity for {READ,WRITE}_ONCE() memory accesses
READ_ONCE: Drop pointer qualifiers when reading from scalar types locking/barriers: Use '__unqual_scalar_typeof' for load-acquire macros
arm64: barrier: Use '__unqual_scalar_typeof' for acquire/release
macros
gcov: Remove old GCC 3.4 support
kcsan: Rework data_race() so that it can be used by READ_ONCE()
READ_ONCE: Use data_race() to avoid KCSAN instrumentation linux/compiler.h: Remove redundant '#else'

 Documentation/process/changes.rst   |   2 +-
 arch/arm/crypto/Kconfig             |  12 +-
 arch/arm64/include/asm/barrier.h    |  16 +-
 arch/arm64/lib/csum.c               |  20 +-
 arch/sparc/include/asm/page_32.h    |  12 +-
 arch/sparc/include/asm/pgalloc_32.h |  11 +-
 arch/sparc/include/asm/pgtable_32.h |  40 +-
 arch/sparc/include/asm/pgtsrmmu.h   |  36 +-
 arch/sparc/include/asm/viking.h     |   5 +-
 arch/sparc/kernel/head_32.S         |   8 +-
 arch/sparc/mm/hypersparc.S          |   3 +-
 arch/sparc/mm/srmmu.c               |  95 ++---
 arch/sparc/mm/viking.S              |   5 +-
 crypto/Kconfig                      |   1 -
 drivers/xen/time.c                  |   2 +-
 include/asm-generic/barrier.h       |  16 +-
 include/linux/compiler-gcc.h        |   5 +-
 include/linux/compiler.h            | 207 +++++-----
 include/linux/compiler_types.h      |  26 ++
 init/Kconfig                        |   1 -
 kernel/gcov/Kconfig                 |  24 --
 kernel/gcov/Makefile                |   3 +-
 kernel/gcov/gcc_3_4.c               | 573 ----------------------------
 lib/fault-inject.c                  |   4 +-
 net/netfilter/core.c                |   2 +-
 net/tls/tls_main.c                  |   2 +-
 scripts/gcc-plugins/Kconfig         |   2 +-
 27 files changed, 257 insertions(+), 876 deletions(-)
 delete mode 100644 kernel/gcov/gcc_3_4.c
Signature · 1 line
2.26.2.645.ge9eca65c58-goog