Skip to content

Unify asm/unaligned.h around struct helper

Arnd Bergmann linux-alpha linux-arch linux-arm-kernel linux-block linux-crypto linux-ia64 linux-m68k linux-mips linux-parisc linux-security-module linux-sh linux-wireless linuxppc-dev lkml netdev openrisc sparclinux 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 35 repliesIn review
  2. v1 RFC0 of 12 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13asm-generic: use asm-generic/unaligned.h for most architecturesarch/alpha/include/asm/unaligned.h arch/ia64/include/asm/unaligned.h arch/m68k/include/asm/unaligned.h +5 more+2 -1190 replies
2/13openrisc: always use unaligned-struct headerarch/openrisc/include/asm/unaligned.h include/linux/unaligned/be_memmove.h include/linux/unaligned/le_memmove.h +1 more+0 -1670 replies
3/13sh: remove unaligned access for sh4aarch/sh/include/asm/unaligned-sh4a.h arch/sh/include/asm/unaligned.h+0 -2124 replies
4/13m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESSarch/m68k/Kconfig arch/m68k/include/asm/unaligned.h+1 -190 replies
5/13powerpc: use linux/unaligned/le_struct.h on LE power7arch/powerpc/include/asm/unaligned.h+0 -222 replies
6/13asm-generic: unaligned: remove byteshift helpersarch/arm/include/asm/unaligned.h include/asm-generic/unaligned.h include/linux/unaligned/be_byteshift.h +3 more+60 -1460 replies
7/13asm-generic: unaligned always use struct helpersarch/arm/include/asm/unaligned.h arch/mips/crypto/crc32-mips.c include/asm-generic/unaligned.h +1 more+3 -1059 replies
8/13partitions: msdos: fix one-byte get_unaligned()block/partitions/ldm.h block/partitions/msdos.c+2 -22 replies
9/13apparmor: use get_unaligned() only for multi-byte wordssecurity/apparmor/policy_unpack.c+1 -10 replies
10/13mwifiex: re-fix for unaligned accessesdrivers/net/wireless/marvell/mwifiex/pcie.c+4 -63 replies
11/13netpoll: avoid put_unaligned() on single characternet/core/netpoll.c+2 -20 replies
12/13asm-generic: uaccess: 1-byte access is always alignedinclude/asm-generic/uaccess.h+2 -22 replies
13/13asm-generic: simplify asm/unaligned.hinclude/asm-generic/unaligned.h include/linux/unaligned/be_struct.h include/linux/unaligned/generic.h +1 more+117 -2621 reply

Reviews trailers per patch

5 of 13 patches have a Reviewed-by or Acked-by.

PatchThomas GleixnerGeert UytterhoevenStafford HorneJohn JohansenKalle Valo
1/13R-b R-b A-b
2/13A-b
3/13
4/13R-b A-b
5/13
6/13
7/13
8/13
9/13A-b
10/13A-b
11/13
12/13
13/13

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

Read the v2 thread

Cover letter [PATCH v2 00/13] Unify asm/unaligned.h around struct helper

From: Arnd Bergmann <[email protected]>

The get_unaligned()/put_unaligned() helpers are traditionally architecture specific, with the two main variants being the "access-ok.h" version that assumes unaligned pointer accesses always work on a particular architecture, and the "le-struct.h" version that casts the data to a byte aligned type before dereferencing, for architectures that cannot always do unaligned accesses in hardware.

Based on the discussion linked below, it appears that the access-ok version is not realiable on any architecture, but the struct version probably has no downsides. This series changes the code to use the same implementation on all architectures, addressing the few exceptions separately.

I've included this version in the asm-generic tree for 5.14 already, addressing the few issues that were pointed out in the RFC. If there are any remaining problems, I hope those can be addressed as follow-up patches.

Arnd

Link git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git unaligned-rework-v2

Arnd Bergmann (13):
asm-generic: use asm-generic/unaligned.h for most architectures
openrisc: always use unaligned-struct header
sh: remove unaligned access for sh4a
m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
powerpc: use linux/unaligned/le_struct.h on LE power7
asm-generic: unaligned: remove byteshift helpers
asm-generic: unaligned always use struct helpers
partitions: msdos: fix one-byte get_unaligned()
apparmor: use get_unaligned() only for multi-byte words
mwifiex: re-fix for unaligned accesses
netpoll: avoid put_unaligned() on single character
asm-generic: uaccess: 1-byte access is always aligned
asm-generic: simplify asm/unaligned.h

 arch/alpha/include/asm/unaligned.h          |  12 --
 arch/arm/include/asm/unaligned.h            |  27 ---
 arch/ia64/include/asm/unaligned.h           |  12 --
 arch/m68k/Kconfig                           |   1 +
 arch/m68k/include/asm/unaligned.h           |  26 ---
 arch/microblaze/include/asm/unaligned.h     |  27 ---
 arch/mips/crypto/crc32-mips.c               |   2 +-
 arch/openrisc/include/asm/unaligned.h       |  47 -----
 arch/parisc/include/asm/unaligned.h         |   6 +-
 arch/powerpc/include/asm/unaligned.h        |  22 ---
 arch/sh/include/asm/unaligned-sh4a.h        | 199 --------------------
 arch/sh/include/asm/unaligned.h             |  13 --
 arch/sparc/include/asm/unaligned.h          |  11 --
 arch/x86/include/asm/unaligned.h            |  15 --
 arch/xtensa/include/asm/unaligned.h         |  29 ---
 block/partitions/ldm.h                      |   2 +-
 block/partitions/msdos.c                    |   2 +-
 drivers/net/wireless/marvell/mwifiex/pcie.c |  10 +-
 include/asm-generic/uaccess.h               |   4 +-
 include/asm-generic/unaligned.h             | 141 +++++++++++---
 include/linux/unaligned/access_ok.h         |  68 -------
 include/linux/unaligned/be_byteshift.h      |  71 -------
 include/linux/unaligned/be_memmove.h        |  37 ----
 include/linux/unaligned/be_struct.h         |  37 ----
 include/linux/unaligned/generic.h           | 115 -----------
 include/linux/unaligned/le_byteshift.h      |  71 -------
 include/linux/unaligned/le_memmove.h        |  37 ----
 include/linux/unaligned/le_struct.h         |  37 ----
 include/linux/unaligned/memmove.h           |  46 -----
 net/core/netpoll.c                          |   4 +-
 security/apparmor/policy_unpack.c           |   2 +-
 31 files changed, 131 insertions(+), 1002 deletions(-)
 delete mode 100644 arch/alpha/include/asm/unaligned.h
 delete mode 100644 arch/arm/include/asm/unaligned.h
 delete mode 100644 arch/ia64/include/asm/unaligned.h
 delete mode 100644 arch/m68k/include/asm/unaligned.h
 delete mode 100644 arch/microblaze/include/asm/unaligned.h
 delete mode 100644 arch/openrisc/include/asm/unaligned.h
 delete mode 100644 arch/powerpc/include/asm/unaligned.h
 delete mode 100644 arch/sh/include/asm/unaligned-sh4a.h
 delete mode 100644 arch/sh/include/asm/unaligned.h
 delete mode 100644 arch/sparc/include/asm/unaligned.h
 delete mode 100644 arch/x86/include/asm/unaligned.h
 delete mode 100644 arch/xtensa/include/asm/unaligned.h
 delete mode 100644 include/linux/unaligned/access_ok.h
 delete mode 100644 include/linux/unaligned/be_byteshift.h
 delete mode 100644 include/linux/unaligned/be_memmove.h
 delete mode 100644 include/linux/unaligned/be_struct.h
 delete mode 100644 include/linux/unaligned/generic.h
 delete mode 100644 include/linux/unaligned/le_byteshift.h
 delete mode 100644 include/linux/unaligned/le_memmove.h
 delete mode 100644 include/linux/unaligned/le_struct.h
 delete mode 100644 include/linux/unaligned/memmove.h
Signature · 46 lines
2.29.2

Cc: Amitkumar Karwar <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Ganapathi Bhat <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: James Morris <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: John Johansen <[email protected]>
Cc: Jonas Bonn <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: "Richard Russon (FlatCap)" <[email protected]>
Cc: Russell King <[email protected]>
Cc: "Serge E. Hallyn" <[email protected]>
Cc: Sharvari Harisangam <[email protected]>
Cc: Stafford Horne <[email protected]>
Cc: Stefan Kristiansson <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Vladimir Oltean <[email protected]>
Cc: Xinming Hu <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: x86 at kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-m68k at lists.linux-m68k.org
Cc: linux-crypto at vger.kernel.org
Cc: openrisc at lists.librecores.org
Cc: linuxppc-dev at lists.ozlabs.org
Cc: linux-sh at vger.kernel.org
Cc: sparclinux at vger.kernel.org
Cc: linux-ntfs-dev at lists.sourceforge.net
Cc: linux-block at vger.kernel.org
Cc: linux-wireless at vger.kernel.org
Cc: netdev at vger.kernel.org
Cc: linux-arch at vger.kernel.org
Cc: linux-security-module at vger.kernel.org