Skip to contentSkip to conversation

Driver core fix for 4.20-rc5

GIT PULL Merged Greg KH 3 participants 3 messages Nov 30, 2018

lore
Share & tools
lore

Greg KH

author
#0 lore raw

The following changes since commit 651022382c7f8da46cb4872a545ee1da6d097d2a:

Linux 4.20-rc1 (2018-11-04 15:37:52 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git tags/driver-core-4.20-rc5

for you to fetch changes up to a66d972465d15b1d89281258805eb8b47d66bd36:

devres: Align data[] to ARCH_KMALLOC_MINALIGN (2018-11-11 11:40:04 -0800)

----------------------------------------------------------------
Driver core fix for 4.20-rc5

Here is a single driver core fix for 4.20-rc5

It resolves an issue with the data alignment in 'struct devres' for the ARC platform. The full details are in the commit changelog, but the short summary is the change is a single line:
- unsigned long long data[]; /* guarantee ull alignment */
+ u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];

This has been in linux-next for a while with no reported issues.

----------------------------------------------------------------
Alexey Brodkin (1):

      devres: Align data[] to ARCH_KMALLOC_MINALIGN
 drivers/base/devres.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
#1 lore raw

Review

Quoted 7 lines · Greg KH

It resolves an issue with the data alignment in 'struct devres' for the ARC platform. The full details are in the commit changelog, but the short summary is the change is a single line:

(quoted diff) +1 -1
-       unsigned long long              data[]; /* guarantee ull alignment */
+       u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];

Hmm.

Are you aware that this is up to 128 bytes? Including on common architectures like ARM64?

I've done the pull, but honestly, that seems a bit excessive, when a fair amount of devres users seem to have fairly small data (ie looking at "size", I see things like

    p = devres_alloc(dmam_device_release, sizeof(void *), GFP_KERNEL);

or

    dr = devres_alloc(devm_gpio_release, sizeof(unsigned), GFP_KERNEL);

that have allocations of a couple of bytes, and the new model means that those allocations will be aligned to 128-byte boundaries, and then (because ARCH_KMALLOC_MINALIGN, again) you'll end up actually wasting 256 bytes for a tiny structure on ARM64.

Maybe it doesn't matter. But it does seem somewhat excessive to do things like this.

Yeah, on x86, the alignment isn't even noticeable, being just 8 bytes.

Linus

merge bot Merged
#2 lore raw
In reply to Greg KH
The pull request you sent on Fri, 30 Nov 2018 17:06:05 +0100:

The pull request you sent on Fri, 30 Nov 2018 17:06:05 +0100:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git tags/driver-core-4.20-rc5

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/d7aca8a78c8bc5d3707691aab13cb4f7f6de696f

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker