powerpc: Remove bootmem allocator
Subsystems (6)
PATCH 1/5 powerpc: Remove bootmem allocator
At the moment we transition from the memblock alloctor to the bootmem allocator. Gitting rid of the bootmem allocator removes a bunch of complicated code (most of which I owe the dubious honour of being responsible for writing).
--- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/setup.h | 3 +- arch/powerpc/kernel/setup_32.c | 5 +- arch/powerpc/kernel/setup_64.c | 3 +- arch/powerpc/mm/init_32.c | 9 -- arch/powerpc/mm/mem.c | 62 +---------- arch/powerpc/mm/numa.c | 224 ++++++--------------------------------- arch/powerpc/mm/pgtable_32.c | 3 +- arch/powerpc/mm/pgtable_64.c | 6 +- 9 files changed, 43 insertions(+), 273 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -148,6 +148,7 @@ config PPC select HAVE_ARCH_AUDITSYSCALL select ARCH_SUPPORTS_ATOMIC_RMW select HAVE_PERF_EVENTS_NMI if PPC64 + select NO_BOOTMEM config GENERIC_CSUM def_bool CPU_LITTLE_ENDIAN
arch/powerpc/include/asm/setup.h +1 -2
@@ -8,7 +8,6 @@ extern void ppc_printk_progress(char *s, unsigned short hex);extern unsigned int rtas_data;extern int mem_init_done;/* set on boot once kmalloc can be called */ -extern int init_bootmem_done;/* set once bootmem is available */ extern unsigned long long memory_limit;extern unsigned long klimit;extern void *zalloc_maybe_bootmem (size_t size,gfp_t mask);
@@ -24,7 +23,7 @@ extern void reloc_got2(unsigned long);#define PTRRELOC (x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))void check_for_initrd (void ); -void do_init_bootmem (void ); +void initmem_init (void );void setup_panic (void );#define ARCH_PANIC_TIMEOUT 180
arch/powerpc/kernel/setup_32.c +2 -3
@@ -311,9 +311,8 @@ void __init setup_arch(char **cmdline_p)irqstack_early_init (); -/* set up the bootmem stuff with available memory */ -do_init_bootmem (); -if ( ppc_md.progress ) ppc_md.progress ("setup_arch: bootmem" ,0x3eab ); +initmem_init (); +if ( ppc_md.progress ) ppc_md.progress ("setup_arch: initmem" ,0x3eab );#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;
arch/powerpc/kernel/setup_64.c +1 -2
@@ -681,8 +681,7 @@ void __init setup_arch(char **cmdline_p)exc_lvl_early_init ();emergency_stack_init (); -/* set up the bootmem stuff with available memory */ -do_init_bootmem (); +initmem_init ();sparse_init ();#ifdef CONFIG_DUMMY_CONSOLE
arch/powerpc/mm/init_32.c +0 -9
@@ -195,15 +195,6 @@ void __init MMU_init(void)memblock_set_current_limit (lowmem_end_addr); } -/* This is only called until mem_init is done. */ -void __init *early_get_page (void ) -{ -if (init_bootmem_done) -return alloc_bootmem_pages (PAGE_SIZE ); -else -return __va (memblock_alloc (PAGE_SIZE ,PAGE_SIZE )); -} -#ifdef CONFIG_8xx/* No 8xx specific .c file to put that in ... */ void setup_initial_memory_limit (phys_addr_t first_memblock_base,phys_addr_t first_memblock_size)
arch/powerpc/mm/mem.c +2 -60
100 lines not on this page · raw message
arch/powerpc/mm/numa.c +34 -190
260 lines not on this page · raw message
arch/powerpc/mm/pgtable_32.c +1 -2
@@ -100,12 +100,11 @@ __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add {pte_t *pte;extern int mem_init_done; -extern void *early_get_page (void );if (mem_init_done) { pte = (pte_t *)__get_free_page (GFP_KERNEL |__GFP_REPEAT|__GFP_ZERO); }else { - pte = (pte_t *)early_get_page (); + pte =__va (memblock_alloc (PAGE_SIZE ,PAGE_SIZE ));if (pte)clear_page (pte); }
arch/powerpc/mm/pgtable_64.c +1 -5
@@ -75,11 +75,7 @@ static __ref void *early_alloc_pgtable(unsigned long size) {void *pt; -if (init_bootmem_done) - pt =__alloc_bootmem (size, size,__pa (MAX_DMA_ADDRESS )); -else - pt =__va (memblock_alloc_base (size, size, -__pa (MAX_DMA_ADDRESS ))); + pt =__va (memblock_alloc_base (size, size,__pa (MAX_DMA_ADDRESS )));memset (pt,0 , size);return pt;
Signature · 1 line
1.9.1
PATCH 2/5 powerpc: Remove some old bootmem related comments
Now bootmem is gone from powerpc we can remove comments mentioning it.
--- arch/powerpc/kernel/prom.c | 5 +---- arch/powerpc/kernel/rtas.c | 4 ++-- arch/powerpc/kvm/book3s_hv_builtin.c | 2 +- arch/powerpc/mm/hugetlbpage.c | 4 ++-- arch/powerpc/mm/pgtable_64.c | 4 ---- 5 files changed, 6 insertions(+), 13 deletions(-)
arch/powerpc/kernel/prom.c +1 -4
@@ -698,10 +698,7 @@ void __init early_init_devtree(void *params)reserve_crashkernel ();early_reserve_mem (); -/* -* Ensure that total memory size is page-aligned, because otherwise -* mark_bootmem() gets upset. -*/ +/* Ensure that total memory size is page-aligned. */ limit =ALIGN (memory_limit ?:memblock_phys_mem_size (),PAGE_SIZE );memblock_enforce_memory_limit (limit);
arch/powerpc/kernel/rtas.c +2 -2
@@ -1091,8 +1091,8 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs) }/* -* Call early during boot, before mem init or bootmem, to retrieve the RTAS -* informations from the device-tree and allocate the RMO buffer for userland +* Call early during boot, before mem init, to retrieve the RTAS +* information from the device-tree and allocate the RMO buffer for userland * accesses. */ void __init rtas_initialize (void )
arch/powerpc/kvm/book3s_hv_builtin.c +1 -1
@@ -154,7 +154,7 @@ EXPORT_SYMBOL_GPL(kvm_release_hpt);* kvm_cma_reserve() - reserve area for kvm hash pagetable * * This function reserves memory from early allocator. It should be -* called by arch specific code once the early allocator (memblock or bootmem) +* called by arch specific code once the memblock allocator * has been activated and all other subsystems have already allocated/reserved * memory. */
arch/powerpc/mm/hugetlbpage.c +2 -2
@@ -276,7 +276,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz#ifdef CONFIG_PPC_FSL_BOOK3E /* Build list of addresses of gigantic pages. This function is used in early -* boot before the buddy or bootmem allocator is setup. +* boot before the buddy allocator is setup. */ void add_gpage (u64 addr,u64 page_size,unsigned long number_of_pages) {
@@ -399,7 +399,7 @@ void __init reserve_hugetlb_gpages(void)#else /* !PPC_FSL_BOOK3E */ /* Build list of addresses of gigantic pages. This function is used in early -* boot before the buddy or bootmem allocator is setup. +* boot before the buddy allocator is setup. */ void add_gpage (u64 addr,u64 page_size,unsigned long number_of_pages) {
arch/powerpc/mm/pgtable_64.c +0 -4
@@ -109,10 +109,6 @@ int map_kernel_page(unsigned long ea, unsigned long pa, int flags) __pgprot(flags))); }else { #ifdef CONFIG_PPC_MMU_NOHASH - /* Warning ! This will blow up if bootmem is not initialized - * which our ppc64 code is keen to do that, we'll need to - * fix it and/or be more careful - */ pgdp = pgd_offset_k(ea); #ifdef PUD_TABLE_SIZE if (pgd_none(*pgdp)) {
Signature · 1 line
1.9.1
PATCH 3/5 powerpc: Remove superfluous bootmem includes
In reply to Anton BlanchardLots of places included bootmem.h even when not using bootmem.
--- arch/powerpc/kernel/crash_dump.c | 1 - arch/powerpc/kernel/irq.c | 1 - arch/powerpc/kernel/pci_64.c | 1 - arch/powerpc/kernel/rtas_pci.c | 1 - arch/powerpc/kernel/setup_32.c | 1 - arch/powerpc/kernel/vdso.c | 1 - arch/powerpc/kvm/book3s_hv_builtin.c | 1 - arch/powerpc/mm/init_32.c | 1 - arch/powerpc/mm/init_64.c | 1 - arch/powerpc/mm/pgtable_64.c | 2 +- arch/powerpc/platforms/cell/celleb_scc_epci.c | 1 - arch/powerpc/platforms/cell/celleb_scc_pciex.c | 1 - arch/powerpc/platforms/maple/pci.c | 1 - arch/powerpc/platforms/powermac/pci.c | 1 - arch/powerpc/platforms/powernv/eeh-ioda.c | 1 - arch/powerpc/platforms/powernv/pci.c | 1 - arch/powerpc/sysdev/fsl_msi.c | 1 - arch/powerpc/sysdev/ipic.c | 1 - arch/powerpc/sysdev/mpic.c | 1 - arch/powerpc/sysdev/mpic_pasemi_msi.c | 1 - arch/powerpc/sysdev/mpic_u3msi.c | 1 - arch/powerpc/sysdev/ppc4xx_msi.c | 1 - arch/powerpc/sysdev/ppc4xx_pci.c | 1 - arch/powerpc/sysdev/qe_lib/qe.c | 1 - arch/powerpc/sysdev/qe_lib/qe_ic.c | 1 - arch/powerpc/sysdev/uic.c | 1 - 26 files changed, 1 insertion(+), 26 deletions(-)
arch/powerpc/kernel/crash_dump.c +0 -1
@@ -12,7 +12,6 @@#undef DEBUG#include <linux/crash_dump.h> -#include <linux/bootmem.h> #include <linux/memblock.h> #include <asm/code-patching.h> #include <asm/kdump.h>
arch/powerpc/kernel/irq.c +0 -1
@@ -50,7 +50,6 @@#include <linux/list.h> #include <linux/radix-tree.h> #include <linux/mutex.h> -#include <linux/bootmem.h> #include <linux/pci.h> #include <linux/debugfs.h> #include <linux/of.h>
arch/powerpc/kernel/pci_64.c +0 -1
@@ -17,7 +17,6 @@#include <linux/pci.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/export.h> #include <linux/mm.h> #include <linux/list.h>
arch/powerpc/kernel/rtas_pci.c +0 -1
@@ -26,7 +26,6 @@#include <linux/pci.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <asm/io.h> #include <asm/pgtable.h>
arch/powerpc/kernel/setup_32.c +0 -1
@@ -11,7 +11,6 @@#include <linux/delay.h> #include <linux/initrd.h> #include <linux/tty.h> -#include <linux/bootmem.h> #include <linux/seq_file.h> #include <linux/root_dev.h> #include <linux/cpu.h>
arch/powerpc/kernel/vdso.c +0 -1
@@ -20,7 +20,6 @@#include <linux/user.h> #include <linux/elf.h> #include <linux/security.h> -#include <linux/bootmem.h> #include <linux/memblock.h> #include <asm/pgtable.h>
arch/powerpc/kvm/book3s_hv_builtin.c +0 -1
@@ -12,7 +12,6 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/spinlock.h> -#include <linux/bootmem.h> #include <linux/init.h> #include <linux/memblock.h> #include <linux/sizes.h>
arch/powerpc/mm/init_32.c +0 -1
@@ -26,7 +26,6 @@#include <linux/mm.h> #include <linux/stddef.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/initrd.h> #include <linux/pagemap.h>
arch/powerpc/mm/init_64.c +0 -1
@@ -34,7 +34,6 @@#include <linux/vmalloc.h> #include <linux/init.h> #include <linux/delay.h> -#include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/idr.h> #include <linux/nodemask.h>
arch/powerpc/mm/pgtable_64.c +1 -1
@@ -33,7 +33,6 @@#include <linux/swap.h> #include <linux/stddef.h> #include <linux/vmalloc.h> -#include <linux/bootmem.h> #include <linux/memblock.h> #include <linux/slab.h>
@@ -51,6 +50,7 @@#include <asm/cputable.h> #include <asm/sections.h> #include <asm/firmware.h> +#include <asm/dma.h> #include "mmu_decl.h"
arch/powerpc/platforms/cell/celleb_scc_epci.c +0 -1
@@ -25,7 +25,6 @@#include <linux/pci.h> #include <linux/init.h> #include <linux/pci_regs.h> -#include <linux/bootmem.h> #include <asm/io.h> #include <asm/irq.h>
arch/powerpc/platforms/cell/celleb_scc_pciex.c +0 -1
@@ -25,7 +25,6 @@#include <linux/string.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/delay.h> #include <linux/interrupt.h>
arch/powerpc/platforms/maple/pci.c +0 -1
@@ -15,7 +15,6 @@#include <linux/delay.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/irq.h> #include <asm/sections.h>
arch/powerpc/platforms/powermac/pci.c +0 -1
@@ -15,7 +15,6 @@#include <linux/delay.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/irq.h> #include <linux/of_pci.h>
arch/powerpc/platforms/powernv/eeh-ioda.c +0 -1
@@ -11,7 +11,6 @@* (at your option) any later version. */ -#include <linux/bootmem.h> #include <linux/debugfs.h> #include <linux/delay.h> #include <linux/io.h>
arch/powerpc/platforms/powernv/pci.c +0 -1
@@ -16,7 +16,6 @@#include <linux/delay.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/bootmem.h> #include <linux/irq.h> #include <linux/io.h> #include <linux/msi.h>
arch/powerpc/sysdev/fsl_msi.c +0 -1
@@ -13,7 +13,6 @@* */ #include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/msi.h> #include <linux/pci.h> #include <linux/slab.h>
arch/powerpc/sysdev/ipic.c +0 -1
@@ -20,7 +20,6 @@#include <linux/signal.h> #include <linux/syscore_ops.h> #include <linux/device.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <linux/fsl_devices.h> #include <asm/irq.h>
arch/powerpc/sysdev/mpic.c +0 -1
@@ -24,7 +24,6 @@#include <linux/irq.h> #include <linux/smp.h> #include <linux/interrupt.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <linux/pci.h> #include <linux/slab.h>
arch/powerpc/sysdev/mpic_pasemi_msi.c +0 -1
@@ -16,7 +16,6 @@#undef DEBUG#include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/msi.h> #include <asm/mpic.h> #include <asm/prom.h>
arch/powerpc/sysdev/mpic_u3msi.c +0 -1
@@ -10,7 +10,6 @@*/ #include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/msi.h> #include <asm/mpic.h> #include <asm/prom.h>
arch/powerpc/sysdev/ppc4xx_msi.c +0 -1
@@ -22,7 +22,6 @@*/ #include <linux/irq.h> -#include <linux/bootmem.h> #include <linux/pci.h> #include <linux/msi.h> #include <linux/of_platform.h>
arch/powerpc/sysdev/ppc4xx_pci.c +0 -1
@@ -22,7 +22,6 @@#include <linux/pci.h> #include <linux/init.h> #include <linux/of.h> -#include <linux/bootmem.h> #include <linux/delay.h> #include <linux/slab.h>
arch/powerpc/sysdev/qe_lib/qe.c +0 -1
@@ -22,7 +22,6 @@#include <linux/spinlock.h> #include <linux/mm.h> #include <linux/interrupt.h> -#include <linux/bootmem.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/ioport.h>
arch/powerpc/sysdev/qe_lib/qe_ic.c +0 -1
@@ -23,7 +23,6 @@#include <linux/sched.h> #include <linux/signal.h> #include <linux/device.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <asm/irq.h> #include <asm/io.h>
arch/powerpc/sysdev/uic.c +0 -1
@@ -19,7 +19,6 @@#include <linux/sched.h> #include <linux/signal.h> #include <linux/device.h> -#include <linux/bootmem.h> #include <linux/spinlock.h> #include <linux/irq.h> #include <linux/interrupt.h>
Signature · 1 line
1.9.1
PATCH 4/5 powerpc: Move sparse_init() into initmem_init
In reply to Anton BlanchardWe did part of sparse initialisation in setup_arch and part in initmem_init. Put them together.
--- arch/powerpc/kernel/setup_64.c | 1 - arch/powerpc/mm/mem.c | 1 + arch/powerpc/mm/numa.c | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/setup_64.c +0 -1
@@ -682,7 +682,6 @@ void __init setup_arch(char **cmdline_p)emergency_stack_init ();initmem_init (); -sparse_init ();#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;
arch/powerpc/mm/mem.c +1 -0
@@ -195,6 +195,7 @@ void __init initmem_init(void)/* XXX need to clip this if using highmem? */ sparse_memory_present_with_active_regions (0 ); +sparse_init (); }/* mark pages that don't exist as nosave */
arch/powerpc/mm/numa.c +2 -0
@@ -964,6 +964,8 @@ void __init initmem_init(void)sparse_memory_present_with_active_regions (nid); } +sparse_init (); +setup_node_to_cpumask_map ();reset_numa_cpu_lookup_table ();
Signature · 1 line
1.9.1
PATCH 5/5 powerpc: make __ffs return unsigned long
In reply to Anton BlanchardI'm seeing a build warning in mm/nobootmem.c after removing bootmem:
mm/nobootmem.c: In function '__free_pages_memory':include/linux/kernel.h:713:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void) (&_min1 == &_min2); \
^
mm/nobootmem.c:90:11: note: in expansion of macro 'min'
order = min(MAX_ORDER - 1UL, __ffs(start));
^The rest of the worlds seems to define __ffs as returning unsigned long, so lets do that.
--- arch/powerpc/include/asm/bitops.h | 2 +- arch/powerpc/sysdev/fsl_pci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/bitops.h +1 -1
@@ -213,7 +213,7 @@ static __inline__ unsigned long ffz(unsigned long x)return __ilog2 (x & -x); } -static __inline__int __ffs (unsigned long x) +static __inline__unsigned long __ffs (unsigned long x) {return __ilog2 (x & -x); }
arch/powerpc/sysdev/fsl_pci.c +1 -1
@@ -152,7 +152,7 @@ static int setup_one_atmu(struct ccsr_pci __iomem *pci, flags |=0x10000000 ;/* enable relaxed ordering */ for (i =0 ; size >0 ; i++) { -unsigned int bits =min (ilog2 (size), +unsigned int bits =min_t (u32,ilog2 (size),__ffs (pci_addr | phys_addr));if (index + i >=5 )
Signature · 1 line
1.9.1
Hello Anton,
Quoted 7 lines · Anton Blanchard
At the moment we transition from the memblock alloctor to the bootmem allocator. Gitting rid of the bootmem allocator removes a bunch of complicated code (most of which I owe the dubious honour of being responsible for writing).
Signed-off-by Anton Blanchard <[email protected]>Tested-by Emil Medve <[email protected]>
Quoted 11 lines
--- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/setup.h | 3 +- arch/powerpc/kernel/setup_32.c | 5 +- arch/powerpc/kernel/setup_64.c | 3 +- arch/powerpc/mm/init_32.c | 9 -- arch/powerpc/mm/mem.c | 62 +---------- arch/powerpc/mm/numa.c | 224 ++++++--------------------------------- arch/powerpc/mm/pgtable_32.c | 3 +- arch/powerpc/mm/pgtable_64.c | 6 +- 9 files changed, 43 insertions(+), 273 deletions(-)
Any idea on how to move these patches forward?
Cheers,
Michael Ellerman
reviewerQuoted 7 lines · Emil Medve
Quoted 4 lines · Anton Blanchard
At the moment we transition from the memblock alloctor to the bootmem allocator. Gitting rid of the bootmem allocator removes a bunch of complicated code (most of which I owe the dubious honour of being responsible for writing).
Any idea on how to move these patches forward?
It's in my test branch and will go into next on Monday.
cheers
Hello Michael,
Quoted 10 lines · Michael Ellerman
Quoted 7 lines · Emil Medve
Quoted 4 lines · Anton Blanchard
At the moment we transition from the memblock alloctor to the bootmem allocator. Gitting rid of the bootmem allocator removes a bunch of complicated code (most of which I owe the dubious honour of being responsible for writing).
Any idea on how to move these patches forward?
It's in my test branch and will go into next on Monday.
Thank you
Cheers,