android_kernel_xiaomi_sm8350/arch/powerpc/sysdev
Mike Rapoport 7e1c4e2792 memblock: stop using implicit alignment to SMP_CACHE_BYTES
When a memblock allocation APIs are called with align = 0, the alignment
is implicitly set to SMP_CACHE_BYTES.

Implicit alignment is done deep in the memblock allocator and it can
come as a surprise.  Not that such an alignment would be wrong even
when used incorrectly but it is better to be explicit for the sake of
clarity and the prinicple of the least surprise.

Replace all such uses of memblock APIs with the 'align' parameter
explicitly set to SMP_CACHE_BYTES and stop implicit alignment assignment
in the memblock internal allocation functions.

For the case when memblock APIs are used via helper functions, e.g.  like
iommu_arena_new_node() in Alpha, the helper functions were detected with
Coccinelle's help and then manually examined and updated where
appropriate.

The direct memblock APIs users were updated using the semantic patch below:

@@
expression size, min_addr, max_addr, nid;
@@
(
|
- memblock_alloc_try_nid_raw(size, 0, min_addr, max_addr, nid)
+ memblock_alloc_try_nid_raw(size, SMP_CACHE_BYTES, min_addr, max_addr,
nid)
|
- memblock_alloc_try_nid_nopanic(size, 0, min_addr, max_addr, nid)
+ memblock_alloc_try_nid_nopanic(size, SMP_CACHE_BYTES, min_addr, max_addr,
nid)
|
- memblock_alloc_try_nid(size, 0, min_addr, max_addr, nid)
+ memblock_alloc_try_nid(size, SMP_CACHE_BYTES, min_addr, max_addr, nid)
|
- memblock_alloc(size, 0)
+ memblock_alloc(size, SMP_CACHE_BYTES)
|
- memblock_alloc_raw(size, 0)
+ memblock_alloc_raw(size, SMP_CACHE_BYTES)
|
- memblock_alloc_from(size, 0, min_addr)
+ memblock_alloc_from(size, SMP_CACHE_BYTES, min_addr)
|
- memblock_alloc_nopanic(size, 0)
+ memblock_alloc_nopanic(size, SMP_CACHE_BYTES)
|
- memblock_alloc_low(size, 0)
+ memblock_alloc_low(size, SMP_CACHE_BYTES)
|
- memblock_alloc_low_nopanic(size, 0)
+ memblock_alloc_low_nopanic(size, SMP_CACHE_BYTES)
|
- memblock_alloc_from_nopanic(size, 0, min_addr)
+ memblock_alloc_from_nopanic(size, SMP_CACHE_BYTES, min_addr)
|
- memblock_alloc_node(size, 0, nid)
+ memblock_alloc_node(size, SMP_CACHE_BYTES, nid)
)

[mhocko@suse.com: changelog update]
[akpm@linux-foundation.org: coding-style fixes]
[rppt@linux.ibm.com: fix missed uses of implicit alignment]
  Link: http://lkml.kernel.org/r/20181016133656.GA10925@rapoport-lnx
Link: http://lkml.kernel.org/r/1538687224-17535-1-git-send-email-rppt@linux.vnet.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Suggested-by: Michal Hocko <mhocko@suse.com>
Acked-by: Paul Burton <paul.burton@mips.com>	[MIPS]
Acked-by: Michael Ellerman <mpe@ellerman.id.au>	[powerpc]
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Richard Weinberger <richard@nod.at>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-31 08:54:16 -07:00
..
ge
xics powerpc: Add -Werror at arch/powerpc level 2018-10-19 00:56:17 +11:00
xive powerpc: Add -Werror at arch/powerpc level 2018-10-19 00:56:17 +11:00
6xx-suspend.S
cpm1.c powerpc: remove unnecessary inclusion of asm/tlbflush.h 2018-07-30 22:48:20 +10:00
cpm2_pic.c
cpm2_pic.h
cpm2.c
cpm_common.c powerpc/cpm1: fix compilation error with CONFIG_PPC_EARLY_DEBUG_CPM 2018-08-10 22:12:33 +10:00
cpm_gpio.c
dart_iommu.c memblock: rename memblock_alloc{_nid,_try_nid} to memblock_phys_alloc* 2018-10-31 08:54:15 -07:00
dart.h
dcr-low.S
dcr.c
ehv_pic.c
fsl_85xx_cache_ctlr.h
fsl_85xx_cache_sram.c powerpc: don't use ioremap_prot() nor __ioremap() unless really needed. 2018-10-14 18:04:09 +11:00
fsl_85xx_l2ctlr.c
fsl_gtm.c
fsl_lbc.c
fsl_mpic_err.c powerpc/mpic: Pass first free vector number to mpic_setup_error_int() 2018-07-19 21:58:09 +10:00
fsl_mpic_timer_wakeup.c
fsl_msi.c
fsl_msi.h
fsl_pci.c
fsl_pci.h
fsl_pmc.c
fsl_rcpm.c
fsl_rio.c
fsl_rio.h
fsl_rmu.c
fsl_soc.c
fsl_soc.h
grackle.c
i8259.c
indirect_pci.c
ipic.c powerpc/sysdev/ipic: check primary_ipic NULL pointer before using it 2018-10-20 13:26:47 +11:00
ipic.h
Kconfig powerpc: remove redundant 'default n' from Kconfig-s 2018-10-13 22:21:25 +11:00
Makefile powerpc: Add -Werror at arch/powerpc level 2018-10-19 00:56:17 +11:00
micropatch.c
mmio_nvram.c
mpc5xxx_clocks.c
mpic_msgr.c powerpc: Fix size calculation using resource_size() 2018-08-10 22:12:33 +10:00
mpic_msi.c
mpic_timer.c
mpic_u3msi.c
mpic.c powerpc/mpic: Pass first free vector number to mpic_setup_error_int() 2018-07-19 21:58:09 +10:00
mpic.h
msi_bitmap.c memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
of_rtc.c
pmi.c
rtc_cmos_setup.c
scom.c
simple_gpio.c
simple_gpio.h
tsi108_dev.c
tsi108_pci.c
udbg_memcons.c
xilinx_intc.c
xilinx_pci.c