Re: [PATCH v2 3/5] memblock: allow to specify flags with memblock_add_node()

2021-10-05 Thread Mike Rapoport
On Mon, Oct 04, 2021 at 11:36:03AM +0200, David Hildenbrand wrote:
> We want to specify flags when hotplugging memory. Let's prepare to pass
> flags to memblock_add_node() by adjusting all existing users.
> 
> Note that when hotplugging memory the system is already up and running
> and we might have concurrent memblock users: for example, while we're
> hotplugging memory, kexec_file code might search for suitable memory
> regions to place kexec images. It's important to add the memory directly
> to memblock via a single call with the right flags, instead of adding the
> memory first and apply flags later: otherwise, concurrent memblock users
> might temporarily stumble over memblocks with wrong flags, which will be
> important in a follow-up patch that introduces a new flag to properly
> handle add_memory_driver_managed().
> 
> Acked-by: Geert Uytterhoeven 
> Acked-by: Heiko Carstens 
> Signed-off-by: David Hildenbrand 

Reviewed-by: Mike Rapoport 

> ---
>  arch/arc/mm/init.c   | 4 ++--
>  arch/ia64/mm/contig.c| 2 +-
>  arch/ia64/mm/init.c  | 2 +-
>  arch/m68k/mm/mcfmmu.c| 3 ++-
>  arch/m68k/mm/motorola.c  | 6 --
>  arch/mips/loongson64/init.c  | 4 +++-
>  arch/mips/sgi-ip27/ip27-memory.c | 3 ++-
>  arch/s390/kernel/setup.c | 3 ++-
>  include/linux/memblock.h | 3 ++-
>  include/linux/mm.h   | 2 +-
>  mm/memblock.c| 9 +
>  mm/memory_hotplug.c  | 2 +-
>  12 files changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> index 699ecf119641..110eb69e9bee 100644
> --- a/arch/arc/mm/init.c
> +++ b/arch/arc/mm/init.c
> @@ -59,13 +59,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 
> size)
>  
>   low_mem_sz = size;
>   in_use = 1;
> - memblock_add_node(base, size, 0);
> + memblock_add_node(base, size, 0, MEMBLOCK_NONE);
>   } else {
>  #ifdef CONFIG_HIGHMEM
>   high_mem_start = base;
>   high_mem_sz = size;
>   in_use = 1;
> - memblock_add_node(base, size, 1);
> + memblock_add_node(base, size, 1, MEMBLOCK_NONE);
>   memblock_reserve(base, size);
>  #endif
>   }
> diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
> index 42e025cfbd08..24901d809301 100644
> --- a/arch/ia64/mm/contig.c
> +++ b/arch/ia64/mm/contig.c
> @@ -153,7 +153,7 @@ find_memory (void)
>   efi_memmap_walk(find_max_min_low_pfn, NULL);
>   max_pfn = max_low_pfn;
>  
> - memblock_add_node(0, PFN_PHYS(max_low_pfn), 0);
> + memblock_add_node(0, PFN_PHYS(max_low_pfn), 0, MEMBLOCK_NONE);
>  
>   find_initrd();
>  
> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index 5c6da8d83c1a..5d165607bf35 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -378,7 +378,7 @@ int __init register_active_ranges(u64 start, u64 len, int 
> nid)
>  #endif
>  
>   if (start < end)
> - memblock_add_node(__pa(start), end - start, nid);
> + memblock_add_node(__pa(start), end - start, nid, MEMBLOCK_NONE);
>   return 0;
>  }
>  
> diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
> index eac9dde65193..6f1f25125294 100644
> --- a/arch/m68k/mm/mcfmmu.c
> +++ b/arch/m68k/mm/mcfmmu.c
> @@ -174,7 +174,8 @@ void __init cf_bootmem_alloc(void)
>   m68k_memory[0].addr = _rambase;
>   m68k_memory[0].size = _ramend - _rambase;
>  
> - memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0);
> + memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0,
> +   MEMBLOCK_NONE);
>  
>   /* compute total pages in system */
>   num_pages = PFN_DOWN(_ramend - _rambase);
> diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
> index 9f3f77785aa7..2b05bb2bac00 100644
> --- a/arch/m68k/mm/motorola.c
> +++ b/arch/m68k/mm/motorola.c
> @@ -410,7 +410,8 @@ void __init paging_init(void)
>  
>   min_addr = m68k_memory[0].addr;
>   max_addr = min_addr + m68k_memory[0].size;
> - memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0);
> + memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0,
> +   MEMBLOCK_NONE);
>   for (i = 1; i < m68k_num_memory;) {
>   if (m68k_memory[i].addr < min_addr) {
>   printk("Ignoring memory chunk at 0x%lx:0x%lx before the 
> first chunk\n",
> @@ -421,7 +422,8 @@ void __init paging_init(void)
>   (m68k_num_memory - i) * sizeof(struct 
> m68k_mem_info));
>   continue;
>   }
> - memblock_add_node(m68k_memory[i].addr, m68k_memory[i].size, i);
> + memblock_add_node(m68k_memory[i].addr, m68k_memory[i].size, i,
> +   MEMBLOCK_NONE);
>   addr = m68k_memory[i].addr + m68k_memory[i].size;
>   

Re: [PATCH v2 3/5] memblock: allow to specify flags with memblock_add_node()

2021-10-04 Thread Shahab Vahedi
On 10/4/21 11:36 AM, David Hildenbrand wrote:
> We want to specify flags when hotplugging memory. Let's prepare to pass
> flags to memblock_add_node() by adjusting all existing users.
> 
> Note that when hotplugging memory the system is already up and running
> and we might have concurrent memblock users: for example, while we're
> hotplugging memory, kexec_file code might search for suitable memory
> regions to place kexec images. It's important to add the memory directly
> to memblock via a single call with the right flags, instead of adding the
> memory first and apply flags later: otherwise, concurrent memblock users
> might temporarily stumble over memblocks with wrong flags, which will be
> important in a follow-up patch that introduces a new flag to properly
> handle add_memory_driver_managed().
> 
> Acked-by: Geert Uytterhoeven 
> Acked-by: Heiko Carstens 
> Signed-off-by: David Hildenbrand 
> ---
>  arch/arc/mm/init.c   | 4 ++--
>  arch/ia64/mm/contig.c| 2 +-
>  arch/ia64/mm/init.c  | 2 +-
>  arch/m68k/mm/mcfmmu.c| 3 ++-
>  arch/m68k/mm/motorola.c  | 6 --
>  arch/mips/loongson64/init.c  | 4 +++-
>  arch/mips/sgi-ip27/ip27-memory.c | 3 ++-
>  arch/s390/kernel/setup.c | 3 ++-
>  include/linux/memblock.h | 3 ++-
>  include/linux/mm.h   | 2 +-
>  mm/memblock.c| 9 +
>  mm/memory_hotplug.c  | 2 +-
>  12 files changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> index 699ecf119641..110eb69e9bee 100644
> --- a/arch/arc/mm/init.c
> +++ b/arch/arc/mm/init.c
> @@ -59,13 +59,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 
> size)
>  
>   low_mem_sz = size;
>   in_use = 1;
> - memblock_add_node(base, size, 0);
> + memblock_add_node(base, size, 0, MEMBLOCK_NONE);
>   } else {
>  #ifdef CONFIG_HIGHMEM
>   high_mem_start = base;
>   high_mem_sz = size;
>   in_use = 1;
> - memblock_add_node(base, size, 1);
> + memblock_add_node(base, size, 1, MEMBLOCK_NONE);
>   memblock_reserve(base, size);
>  #endif

arch/arc part: Acked-by: Shahab Vahedi 

-- 
Shahab
___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec