[3/3] arm64: kdump: defer the crashkernel reservation for platforms with no DMA memory zones

Message ID 20230324131838.409996-4-bhe@redhat.com
State New
Headers
Series arm64: kdump : take off the protection on crashkernel memory region |

Commit Message

Baoquan He March 24, 2023, 1:18 p.m. UTC
  In commit 031495635b46 ("arm64: Do not defer reserve_crashkernel() for
platforms with no DMA memory zones"), reserve_crashkernel() is called
much earlier in arm64_memblock_init() to avoid causing base apge
mapping on platforms with no DMA meomry zones.

With taking off protection on crashkernel memory region, no need to call
reserve_crashkernel() specially in advance. The deferred invocation of
reserve_crashkernel() in bootmem_init() can cover all cases.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/arm64/include/asm/memory.h | 5 -----
 arch/arm64/mm/init.c            | 6 +-----
 2 files changed, 1 insertion(+), 10 deletions(-)
  

Comments

Zhen Lei March 25, 2023, 2:04 a.m. UTC | #1
On 2023/3/24 21:18, Baoquan He wrote:
> In commit 031495635b46 ("arm64: Do not defer reserve_crashkernel() for
> platforms with no DMA memory zones"), reserve_crashkernel() is called
> much earlier in arm64_memblock_init() to avoid causing base apge
> mapping on platforms with no DMA meomry zones.
> 
> With taking off protection on crashkernel memory region, no need to call
> reserve_crashkernel() specially in advance. The deferred invocation of
> reserve_crashkernel() in bootmem_init() can cover all cases.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  arch/arm64/include/asm/memory.h | 5 -----
>  arch/arm64/mm/init.c            | 6 +-----
>  2 files changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index 78e5163836a0..efcd68154a3a 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -374,11 +374,6 @@ static inline void *phys_to_virt(phys_addr_t x)
>  })
>  
>  void dump_mem_limit(void);
> -
> -static inline bool defer_reserve_crashkernel(void)
> -{
> -	return IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32);
> -}
>  #endif /* !ASSEMBLY */
>  
>  /*
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 58a0bb2c17f1..b888de59e0b7 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -408,9 +408,6 @@ void __init arm64_memblock_init(void)
>  
>  	early_init_fdt_scan_reserved_mem();
>  
> -	if (!defer_reserve_crashkernel())
> -		reserve_crashkernel();
> -
>  	high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
>  }
>  
> @@ -457,8 +454,7 @@ void __init bootmem_init(void)
>  	 * request_standard_resources() depends on crashkernel's memory being
>  	 * reserved, so do it here.
>  	 */
> -	if (defer_reserve_crashkernel())
> -		reserve_crashkernel();
> +	reserve_crashkernel();
>  
>  	memblock_dump_all();
>  }

Some comments also need to be deleted, above the definition of arm64_dma_phys_limit
in arch/arm64/mm/init.c

>
  
Baoquan He March 26, 2023, 1:10 p.m. UTC | #2
On 03/25/23 at 10:04am, Leizhen (ThunderTown) wrote:
> 
> 
> On 2023/3/24 21:18, Baoquan He wrote:
> > In commit 031495635b46 ("arm64: Do not defer reserve_crashkernel() for
> > platforms with no DMA memory zones"), reserve_crashkernel() is called
> > much earlier in arm64_memblock_init() to avoid causing base apge
> > mapping on platforms with no DMA meomry zones.
> > 
> > With taking off protection on crashkernel memory region, no need to call
> > reserve_crashkernel() specially in advance. The deferred invocation of
> > reserve_crashkernel() in bootmem_init() can cover all cases.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > ---
> >  arch/arm64/include/asm/memory.h | 5 -----
> >  arch/arm64/mm/init.c            | 6 +-----
> >  2 files changed, 1 insertion(+), 10 deletions(-)
> > 
> > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> > index 78e5163836a0..efcd68154a3a 100644
> > --- a/arch/arm64/include/asm/memory.h
> > +++ b/arch/arm64/include/asm/memory.h
> > @@ -374,11 +374,6 @@ static inline void *phys_to_virt(phys_addr_t x)
> >  })
> >  
> >  void dump_mem_limit(void);
> > -
> > -static inline bool defer_reserve_crashkernel(void)
> > -{
> > -	return IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32);
> > -}
> >  #endif /* !ASSEMBLY */
> >  
> >  /*
> > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> > index 58a0bb2c17f1..b888de59e0b7 100644
> > --- a/arch/arm64/mm/init.c
> > +++ b/arch/arm64/mm/init.c
> > @@ -408,9 +408,6 @@ void __init arm64_memblock_init(void)
> >  
> >  	early_init_fdt_scan_reserved_mem();
> >  
> > -	if (!defer_reserve_crashkernel())
> > -		reserve_crashkernel();
> > -
> >  	high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
> >  }
> >  
> > @@ -457,8 +454,7 @@ void __init bootmem_init(void)
> >  	 * request_standard_resources() depends on crashkernel's memory being
> >  	 * reserved, so do it here.
> >  	 */
> > -	if (defer_reserve_crashkernel())
> > -		reserve_crashkernel();
> > +	reserve_crashkernel();
> >  
> >  	memblock_dump_all();
> >  }
> 
> Some comments also need to be deleted, above the definition of arm64_dma_phys_limit
> in arch/arm64/mm/init.c

Thanks, have posted v2 of patch 3 to remove the code comment, and move
back the arm64_dma_phys_limit assignmet as 'PHYS_MASK + 1;' into
zone_sizes_init(). These should be part of the reverting commit
031495635b46, I missed that.
  

Patch

diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 78e5163836a0..efcd68154a3a 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -374,11 +374,6 @@  static inline void *phys_to_virt(phys_addr_t x)
 })
 
 void dump_mem_limit(void);
-
-static inline bool defer_reserve_crashkernel(void)
-{
-	return IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32);
-}
 #endif /* !ASSEMBLY */
 
 /*
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 58a0bb2c17f1..b888de59e0b7 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -408,9 +408,6 @@  void __init arm64_memblock_init(void)
 
 	early_init_fdt_scan_reserved_mem();
 
-	if (!defer_reserve_crashkernel())
-		reserve_crashkernel();
-
 	high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
 }
 
@@ -457,8 +454,7 @@  void __init bootmem_init(void)
 	 * request_standard_resources() depends on crashkernel's memory being
 	 * reserved, so do it here.
 	 */
-	if (defer_reserve_crashkernel())
-		reserve_crashkernel();
+	reserve_crashkernel();
 
 	memblock_dump_all();
 }