From: Greg Kroah-Hartman Date: Fri, 8 Feb 2019 07:30:24 +0000 (+0100) Subject: 4.19-stable patches X-Git-Tag: v4.4.174~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9c047086aec95acc8468efdd046747b5a9551b9;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: devres-align-data-to-arch_kmalloc_minalign.patch --- diff --git a/queue-4.19/devres-align-data-to-arch_kmalloc_minalign.patch b/queue-4.19/devres-align-data-to-arch_kmalloc_minalign.patch new file mode 100644 index 00000000000..855f080fbc7 --- /dev/null +++ b/queue-4.19/devres-align-data-to-arch_kmalloc_minalign.patch @@ -0,0 +1,57 @@ +From a66d972465d15b1d89281258805eb8b47d66bd36 Mon Sep 17 00:00:00 2001 +From: Alexey Brodkin +Date: Wed, 31 Oct 2018 18:25:47 +0300 +Subject: devres: Align data[] to ARCH_KMALLOC_MINALIGN + +From: Alexey Brodkin + +commit a66d972465d15b1d89281258805eb8b47d66bd36 upstream. + +Initially we bumped into problem with 32-bit aligned atomic64_t +on ARC, see [1]. And then during quite lengthly discussion Peter Z. +mentioned ARCH_KMALLOC_MINALIGN which IMHO makes perfect sense. +If allocation is done by plain kmalloc() obtained buffer will be +ARCH_KMALLOC_MINALIGN aligned and then why buffer obtained via +devm_kmalloc() should have any other alignment? + +This way we at least get the same behavior for both types of +allocation. + +[1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004009.html +[2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004036.html + +Signed-off-by: Alexey Brodkin +Cc: Greg Kroah-Hartman +Cc: Geert Uytterhoeven +Cc: David Laight +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Cc: Vineet Gupta +Cc: Will Deacon +Cc: Greg KH +Cc: # 4.8+ +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/devres.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/base/devres.c ++++ b/drivers/base/devres.c +@@ -24,8 +24,14 @@ struct devres_node { + + struct devres { + struct devres_node node; +- /* -- 3 pointers */ +- unsigned long long data[]; /* guarantee ull alignment */ ++ /* ++ * Some archs want to perform DMA into kmalloc caches ++ * and need a guaranteed alignment larger than ++ * the alignment of a 64-bit integer. ++ * Thus we use ARCH_KMALLOC_MINALIGN here and get exactly the same ++ * buffer alignment as if it was allocated by plain kmalloc(). ++ */ ++ u8 __aligned(ARCH_KMALLOC_MINALIGN) data[]; + }; + + struct devres_group { diff --git a/queue-4.19/series b/queue-4.19/series new file mode 100644 index 00000000000..4bd34c08f02 --- /dev/null +++ b/queue-4.19/series @@ -0,0 +1 @@ +devres-align-data-to-arch_kmalloc_minalign.patch