* [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
@ 2026-08-27 14:44 ` Sourabh Jain
0 siblings, 0 replies; 10+ messages in thread
From: Sourabh Jain @ 2026-08-27 14:44 UTC (permalink / raw)
To: linux-kernel
Cc: Sourabh Jain, Albert Ou, Andrew Morton, Baoquan He, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
No architecture provides an implementation of
arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
and remove the unused fallback wrapper from the kexec header.
This simplifies the kexec memory allocation path without changing
its behavior.
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Pratyush Yadav <pratyush@kernel.org>
Cc: linux-riscv@lists.infradead.org
Cc: kexec@lists.infradead.org
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
arch/riscv/kernel/kexec_elf.c | 2 +-
include/linux/kexec.h | 15 ---------------
kernel/kexec_file.c | 2 +-
3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
index 3e9a32acb8f2..ca5abbad59e5 100644
--- a/arch/riscv/kernel/kexec_elf.c
+++ b/arch/riscv/kernel/kexec_elf.c
@@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
kbuf.cma = NULL;
kbuf.top_down = false;
- ret = arch_kexec_locate_mem_hole(&kbuf);
+ ret = kexec_locate_mem_hole(&kbuf);
if (!ret) {
*old_pbase = lowest_paddr;
*new_pbase = kbuf.mem;
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 0af8ae4fdd08..e5f1cfc11fef 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
extern int kexec_add_buffer(struct kexec_buf *kbuf);
int kexec_locate_mem_hole(struct kexec_buf *kbuf);
-#ifndef arch_kexec_locate_mem_hole
-/**
- * arch_kexec_locate_mem_hole - Find free memory to place the segments.
- * @kbuf: Parameters for the memory search.
- *
- * On success, kbuf->mem will have the start address of the memory region found.
- *
- * Return: 0 on success, negative errno on error.
- */
-static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
-{
- return kexec_locate_mem_hole(kbuf);
-}
-#endif
-
#ifndef arch_kexec_apply_relocations_add
/*
* arch_kexec_apply_relocations_add - apply relocations of type RELA
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 59fb9d71e9d8..9a981359addd 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
kbuf->cma = NULL;
/* Walk the RAM ranges and allocate a suitable range for the buffer */
- ret = arch_kexec_locate_mem_hole(kbuf);
+ ret = kexec_locate_mem_hole(kbuf);
if (ret)
return ret;
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
2026-08-27 14:44 ` Sourabh Jain
@ 2026-08-28 2:10 ` Baoquan He
-1 siblings, 0 replies; 10+ messages in thread
From: Baoquan He @ 2026-08-28 2:10 UTC (permalink / raw)
To: Sourabh Jain
Cc: linux-kernel, Albert Ou, Andrew Morton, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
On 08/27/26 at 08:14pm, Sourabh Jain wrote:
> No architecture provides an implementation of
> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
> and remove the unused fallback wrapper from the kexec header.
Since below commit, the last user was gone:
commit 6e5250eaa665f ("powerpc/crash: use generic APIs to locate memory hole for kdump")
Acked-by: Baoquan He <baoquan.he@linux.dev>
>
> This simplifies the kexec memory allocation path without changing
> its behavior.
>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Baoquan He <baoquan.he@linux.dev>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
> Cc: Paul Walmsley <pjw@kernel.org>
> Cc: Pratyush Yadav <pratyush@kernel.org>
> Cc: linux-riscv@lists.infradead.org
> Cc: kexec@lists.infradead.org
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> arch/riscv/kernel/kexec_elf.c | 2 +-
> include/linux/kexec.h | 15 ---------------
> kernel/kexec_file.c | 2 +-
> 3 files changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
> index 3e9a32acb8f2..ca5abbad59e5 100644
> --- a/arch/riscv/kernel/kexec_elf.c
> +++ b/arch/riscv/kernel/kexec_elf.c
> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
> kbuf.cma = NULL;
> kbuf.top_down = false;
> - ret = arch_kexec_locate_mem_hole(&kbuf);
> + ret = kexec_locate_mem_hole(&kbuf);
> if (!ret) {
> *old_pbase = lowest_paddr;
> *new_pbase = kbuf.mem;
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 0af8ae4fdd08..e5f1cfc11fef 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
> extern int kexec_add_buffer(struct kexec_buf *kbuf);
> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>
> -#ifndef arch_kexec_locate_mem_hole
> -/**
> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
> - * @kbuf: Parameters for the memory search.
> - *
> - * On success, kbuf->mem will have the start address of the memory region found.
> - *
> - * Return: 0 on success, negative errno on error.
> - */
> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
> -{
> - return kexec_locate_mem_hole(kbuf);
> -}
> -#endif
> -
> #ifndef arch_kexec_apply_relocations_add
> /*
> * arch_kexec_apply_relocations_add - apply relocations of type RELA
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index 59fb9d71e9d8..9a981359addd 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
> kbuf->cma = NULL;
>
> /* Walk the RAM ranges and allocate a suitable range for the buffer */
> - ret = arch_kexec_locate_mem_hole(kbuf);
> + ret = kexec_locate_mem_hole(kbuf);
> if (ret)
> return ret;
>
> --
> 2.55.0
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
@ 2026-08-28 2:10 ` Baoquan He
0 siblings, 0 replies; 10+ messages in thread
From: Baoquan He @ 2026-08-28 2:10 UTC (permalink / raw)
To: Sourabh Jain
Cc: linux-kernel, Albert Ou, Andrew Morton, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
On 08/27/26 at 08:14pm, Sourabh Jain wrote:
> No architecture provides an implementation of
> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
> and remove the unused fallback wrapper from the kexec header.
Since below commit, the last user was gone:
commit 6e5250eaa665f ("powerpc/crash: use generic APIs to locate memory hole for kdump")
Acked-by: Baoquan He <baoquan.he@linux.dev>
>
> This simplifies the kexec memory allocation path without changing
> its behavior.
>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Baoquan He <baoquan.he@linux.dev>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
> Cc: Paul Walmsley <pjw@kernel.org>
> Cc: Pratyush Yadav <pratyush@kernel.org>
> Cc: linux-riscv@lists.infradead.org
> Cc: kexec@lists.infradead.org
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> arch/riscv/kernel/kexec_elf.c | 2 +-
> include/linux/kexec.h | 15 ---------------
> kernel/kexec_file.c | 2 +-
> 3 files changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
> index 3e9a32acb8f2..ca5abbad59e5 100644
> --- a/arch/riscv/kernel/kexec_elf.c
> +++ b/arch/riscv/kernel/kexec_elf.c
> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
> kbuf.cma = NULL;
> kbuf.top_down = false;
> - ret = arch_kexec_locate_mem_hole(&kbuf);
> + ret = kexec_locate_mem_hole(&kbuf);
> if (!ret) {
> *old_pbase = lowest_paddr;
> *new_pbase = kbuf.mem;
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 0af8ae4fdd08..e5f1cfc11fef 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
> extern int kexec_add_buffer(struct kexec_buf *kbuf);
> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>
> -#ifndef arch_kexec_locate_mem_hole
> -/**
> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
> - * @kbuf: Parameters for the memory search.
> - *
> - * On success, kbuf->mem will have the start address of the memory region found.
> - *
> - * Return: 0 on success, negative errno on error.
> - */
> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
> -{
> - return kexec_locate_mem_hole(kbuf);
> -}
> -#endif
> -
> #ifndef arch_kexec_apply_relocations_add
> /*
> * arch_kexec_apply_relocations_add - apply relocations of type RELA
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index 59fb9d71e9d8..9a981359addd 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
> kbuf->cma = NULL;
>
> /* Walk the RAM ranges and allocate a suitable range for the buffer */
> - ret = arch_kexec_locate_mem_hole(kbuf);
> + ret = kexec_locate_mem_hole(kbuf);
> if (ret)
> return ret;
>
> --
> 2.55.0
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
2026-08-28 2:10 ` Baoquan He
@ 2026-08-28 5:57 ` Sourabh Jain
-1 siblings, 0 replies; 10+ messages in thread
From: Sourabh Jain @ 2026-08-28 5:57 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, Albert Ou, Andrew Morton, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
On 28/08/26 07:40, Baoquan He wrote:
> On 08/27/26 at 08:14pm, Sourabh Jain wrote:
>> No architecture provides an implementation of
>> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
>> and remove the unused fallback wrapper from the kexec header.
> Since below commit, the last user was gone:
> commit 6e5250eaa665f ("powerpc/crash: use generic APIs to locate memory hole for kdump")
>
> Acked-by: Baoquan He <baoquan.he@linux.dev>
Thanks for the Ack, Baoquan.
- Sourabh Jain
>
>> This simplifies the kexec memory allocation path without changing
>> its behavior.
>>
>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Baoquan He <baoquan.he@linux.dev>
>> Cc: Mike Rapoport <rppt@kernel.org>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
>> Cc: Paul Walmsley <pjw@kernel.org>
>> Cc: Pratyush Yadav <pratyush@kernel.org>
>> Cc: linux-riscv@lists.infradead.org
>> Cc: kexec@lists.infradead.org
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> ---
>> arch/riscv/kernel/kexec_elf.c | 2 +-
>> include/linux/kexec.h | 15 ---------------
>> kernel/kexec_file.c | 2 +-
>> 3 files changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
>> index 3e9a32acb8f2..ca5abbad59e5 100644
>> --- a/arch/riscv/kernel/kexec_elf.c
>> +++ b/arch/riscv/kernel/kexec_elf.c
>> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
>> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
>> kbuf.cma = NULL;
>> kbuf.top_down = false;
>> - ret = arch_kexec_locate_mem_hole(&kbuf);
>> + ret = kexec_locate_mem_hole(&kbuf);
>> if (!ret) {
>> *old_pbase = lowest_paddr;
>> *new_pbase = kbuf.mem;
>> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
>> index 0af8ae4fdd08..e5f1cfc11fef 100644
>> --- a/include/linux/kexec.h
>> +++ b/include/linux/kexec.h
>> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
>> extern int kexec_add_buffer(struct kexec_buf *kbuf);
>> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>>
>> -#ifndef arch_kexec_locate_mem_hole
>> -/**
>> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
>> - * @kbuf: Parameters for the memory search.
>> - *
>> - * On success, kbuf->mem will have the start address of the memory region found.
>> - *
>> - * Return: 0 on success, negative errno on error.
>> - */
>> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
>> -{
>> - return kexec_locate_mem_hole(kbuf);
>> -}
>> -#endif
>> -
>> #ifndef arch_kexec_apply_relocations_add
>> /*
>> * arch_kexec_apply_relocations_add - apply relocations of type RELA
>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>> index 59fb9d71e9d8..9a981359addd 100644
>> --- a/kernel/kexec_file.c
>> +++ b/kernel/kexec_file.c
>> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
>> kbuf->cma = NULL;
>>
>> /* Walk the RAM ranges and allocate a suitable range for the buffer */
>> - ret = arch_kexec_locate_mem_hole(kbuf);
>> + ret = kexec_locate_mem_hole(kbuf);
>> if (ret)
>> return ret;
>>
>> --
>> 2.55.0
>>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
@ 2026-08-28 5:57 ` Sourabh Jain
0 siblings, 0 replies; 10+ messages in thread
From: Sourabh Jain @ 2026-08-28 5:57 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, Albert Ou, Andrew Morton, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
On 28/08/26 07:40, Baoquan He wrote:
> On 08/27/26 at 08:14pm, Sourabh Jain wrote:
>> No architecture provides an implementation of
>> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
>> and remove the unused fallback wrapper from the kexec header.
> Since below commit, the last user was gone:
> commit 6e5250eaa665f ("powerpc/crash: use generic APIs to locate memory hole for kdump")
>
> Acked-by: Baoquan He <baoquan.he@linux.dev>
Thanks for the Ack, Baoquan.
- Sourabh Jain
>
>> This simplifies the kexec memory allocation path without changing
>> its behavior.
>>
>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Baoquan He <baoquan.he@linux.dev>
>> Cc: Mike Rapoport <rppt@kernel.org>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
>> Cc: Paul Walmsley <pjw@kernel.org>
>> Cc: Pratyush Yadav <pratyush@kernel.org>
>> Cc: linux-riscv@lists.infradead.org
>> Cc: kexec@lists.infradead.org
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> ---
>> arch/riscv/kernel/kexec_elf.c | 2 +-
>> include/linux/kexec.h | 15 ---------------
>> kernel/kexec_file.c | 2 +-
>> 3 files changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
>> index 3e9a32acb8f2..ca5abbad59e5 100644
>> --- a/arch/riscv/kernel/kexec_elf.c
>> +++ b/arch/riscv/kernel/kexec_elf.c
>> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
>> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
>> kbuf.cma = NULL;
>> kbuf.top_down = false;
>> - ret = arch_kexec_locate_mem_hole(&kbuf);
>> + ret = kexec_locate_mem_hole(&kbuf);
>> if (!ret) {
>> *old_pbase = lowest_paddr;
>> *new_pbase = kbuf.mem;
>> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
>> index 0af8ae4fdd08..e5f1cfc11fef 100644
>> --- a/include/linux/kexec.h
>> +++ b/include/linux/kexec.h
>> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
>> extern int kexec_add_buffer(struct kexec_buf *kbuf);
>> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>>
>> -#ifndef arch_kexec_locate_mem_hole
>> -/**
>> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
>> - * @kbuf: Parameters for the memory search.
>> - *
>> - * On success, kbuf->mem will have the start address of the memory region found.
>> - *
>> - * Return: 0 on success, negative errno on error.
>> - */
>> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
>> -{
>> - return kexec_locate_mem_hole(kbuf);
>> -}
>> -#endif
>> -
>> #ifndef arch_kexec_apply_relocations_add
>> /*
>> * arch_kexec_apply_relocations_add - apply relocations of type RELA
>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>> index 59fb9d71e9d8..9a981359addd 100644
>> --- a/kernel/kexec_file.c
>> +++ b/kernel/kexec_file.c
>> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
>> kbuf->cma = NULL;
>>
>> /* Walk the RAM ranges and allocate a suitable range for the buffer */
>> - ret = arch_kexec_locate_mem_hole(kbuf);
>> + ret = kexec_locate_mem_hole(kbuf);
>> if (ret)
>> return ret;
>>
>> --
>> 2.55.0
>>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
2026-08-27 14:44 ` Sourabh Jain
@ 2026-08-28 13:20 ` Mukesh Pilaniya
-1 siblings, 0 replies; 10+ messages in thread
From: Mukesh Pilaniya @ 2026-08-28 13:20 UTC (permalink / raw)
To: Sourabh Jain, linux-kernel
Cc: Albert Ou, Andrew Morton, Baoquan He, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
Hi Sourabh,
The patch touches three files across three subsystems so kexec: would be
a more accurate prefix than kexec_file, for e.g.:
kexec: remove unused arch_kexec_locate_mem_hole hook
On 27/08/26 8:14 pm, Sourabh Jain wrote:
> No architecture provides an implementation of
> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
> and remove the unused fallback wrapper from the kexec header.
>
> This simplifies the kexec memory allocation path without changing
> its behavior.
>
Also, it might be worth mentioning in the commit message that this hook
was originally introduced by commit f891f19736bd and that the last arch
override was removed in commit 6e5250eaa665; making it safe to remove now.
Otherwise, the change looks good to me. Feel free to add:
Reviewed-by: Mukesh Pilaniya <mpilaniy@redhat.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Baoquan He <baoquan.he@linux.dev>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
> Cc: Paul Walmsley <pjw@kernel.org>
> Cc: Pratyush Yadav <pratyush@kernel.org>
> Cc: linux-riscv@lists.infradead.org
> Cc: kexec@lists.infradead.org
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> arch/riscv/kernel/kexec_elf.c | 2 +-
> include/linux/kexec.h | 15 ---------------
> kernel/kexec_file.c | 2 +-
> 3 files changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
> index 3e9a32acb8f2..ca5abbad59e5 100644
> --- a/arch/riscv/kernel/kexec_elf.c
> +++ b/arch/riscv/kernel/kexec_elf.c
> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
> kbuf.cma = NULL;
> kbuf.top_down = false;
> - ret = arch_kexec_locate_mem_hole(&kbuf);
> + ret = kexec_locate_mem_hole(&kbuf);
> if (!ret) {
> *old_pbase = lowest_paddr;
> *new_pbase = kbuf.mem;
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 0af8ae4fdd08..e5f1cfc11fef 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
> extern int kexec_add_buffer(struct kexec_buf *kbuf);
> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>
> -#ifndef arch_kexec_locate_mem_hole
> -/**
> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
> - * @kbuf: Parameters for the memory search.
> - *
> - * On success, kbuf->mem will have the start address of the memory region found.
> - *
> - * Return: 0 on success, negative errno on error.
> - */
> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
> -{
> - return kexec_locate_mem_hole(kbuf);
> -}
> -#endif
> -
> #ifndef arch_kexec_apply_relocations_add
> /*
> * arch_kexec_apply_relocations_add - apply relocations of type RELA
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index 59fb9d71e9d8..9a981359addd 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
> kbuf->cma = NULL;
>
> /* Walk the RAM ranges and allocate a suitable range for the buffer */
> - ret = arch_kexec_locate_mem_hole(kbuf);
> + ret = kexec_locate_mem_hole(kbuf);
> if (ret)
> return ret;
>
--
Regards,
Mukesh Pilaniya
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
@ 2026-08-28 13:20 ` Mukesh Pilaniya
0 siblings, 0 replies; 10+ messages in thread
From: Mukesh Pilaniya @ 2026-08-28 13:20 UTC (permalink / raw)
To: Sourabh Jain, linux-kernel
Cc: Albert Ou, Andrew Morton, Baoquan He, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
Hi Sourabh,
The patch touches three files across three subsystems so kexec: would be
a more accurate prefix than kexec_file, for e.g.:
kexec: remove unused arch_kexec_locate_mem_hole hook
On 27/08/26 8:14 pm, Sourabh Jain wrote:
> No architecture provides an implementation of
> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
> and remove the unused fallback wrapper from the kexec header.
>
> This simplifies the kexec memory allocation path without changing
> its behavior.
>
Also, it might be worth mentioning in the commit message that this hook
was originally introduced by commit f891f19736bd and that the last arch
override was removed in commit 6e5250eaa665; making it safe to remove now.
Otherwise, the change looks good to me. Feel free to add:
Reviewed-by: Mukesh Pilaniya <mpilaniy@redhat.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Baoquan He <baoquan.he@linux.dev>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
> Cc: Paul Walmsley <pjw@kernel.org>
> Cc: Pratyush Yadav <pratyush@kernel.org>
> Cc: linux-riscv@lists.infradead.org
> Cc: kexec@lists.infradead.org
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> arch/riscv/kernel/kexec_elf.c | 2 +-
> include/linux/kexec.h | 15 ---------------
> kernel/kexec_file.c | 2 +-
> 3 files changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
> index 3e9a32acb8f2..ca5abbad59e5 100644
> --- a/arch/riscv/kernel/kexec_elf.c
> +++ b/arch/riscv/kernel/kexec_elf.c
> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
> kbuf.cma = NULL;
> kbuf.top_down = false;
> - ret = arch_kexec_locate_mem_hole(&kbuf);
> + ret = kexec_locate_mem_hole(&kbuf);
> if (!ret) {
> *old_pbase = lowest_paddr;
> *new_pbase = kbuf.mem;
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 0af8ae4fdd08..e5f1cfc11fef 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
> extern int kexec_add_buffer(struct kexec_buf *kbuf);
> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>
> -#ifndef arch_kexec_locate_mem_hole
> -/**
> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
> - * @kbuf: Parameters for the memory search.
> - *
> - * On success, kbuf->mem will have the start address of the memory region found.
> - *
> - * Return: 0 on success, negative errno on error.
> - */
> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
> -{
> - return kexec_locate_mem_hole(kbuf);
> -}
> -#endif
> -
> #ifndef arch_kexec_apply_relocations_add
> /*
> * arch_kexec_apply_relocations_add - apply relocations of type RELA
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index 59fb9d71e9d8..9a981359addd 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
> kbuf->cma = NULL;
>
> /* Walk the RAM ranges and allocate a suitable range for the buffer */
> - ret = arch_kexec_locate_mem_hole(kbuf);
> + ret = kexec_locate_mem_hole(kbuf);
> if (ret)
> return ret;
>
--
Regards,
Mukesh Pilaniya
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
2026-08-28 13:20 ` Mukesh Pilaniya
@ 2026-08-29 4:58 ` Sourabh Jain
-1 siblings, 0 replies; 10+ messages in thread
From: Sourabh Jain @ 2026-08-29 4:58 UTC (permalink / raw)
To: Mukesh Pilaniya, linux-kernel
Cc: Albert Ou, Andrew Morton, Baoquan He, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
Hello Mukesh,
On 28/08/26 18:50, Mukesh Pilaniya wrote:
> Hi Sourabh,
>
> The patch touches three files across three subsystems so kexec: would be
> a more accurate prefix than kexec_file, for e.g.:
>
> kexec: remove unused arch_kexec_locate_mem_hole hook
As I understand it, the kexec: prefix is generally used when the changes
apply to both
the kexec_load and kexec_file_load syscalls.
Since these changes are specific to kexec_file_load, I used the
kexec_file: prefix for the patch title.
That said, I’m happy to follow the convention if you and others feel the
patch should use the
kexec: prefix. Otherwise, I would prefer to keep the kexec_file: prefix.
>
> On 27/08/26 8:14 pm, Sourabh Jain wrote:
>> No architecture provides an implementation of
>> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
>> and remove the unused fallback wrapper from the kexec header.
>>
>> This simplifies the kexec memory allocation path without changing
>> its behavior.
>>
> Also, it might be worth mentioning in the commit message that this hook
> was originally introduced by commit f891f19736bd and that the last arch
> override was removed in commit 6e5250eaa665; making it safe to remove now.
Sure, I don’t mind including this in v2.
>
> Otherwise, the change looks good to me. Feel free to add:
> Reviewed-by: Mukesh Pilaniya <mpilaniy@redhat.com>
Thanks for the review.
- Sourabh Jain
>
>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Baoquan He <baoquan.he@linux.dev>
>> Cc: Mike Rapoport <rppt@kernel.org>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
>> Cc: Paul Walmsley <pjw@kernel.org>
>> Cc: Pratyush Yadav <pratyush@kernel.org>
>> Cc: linux-riscv@lists.infradead.org
>> Cc: kexec@lists.infradead.org
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> ---
>> arch/riscv/kernel/kexec_elf.c | 2 +-
>> include/linux/kexec.h | 15 ---------------
>> kernel/kexec_file.c | 2 +-
>> 3 files changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
>> index 3e9a32acb8f2..ca5abbad59e5 100644
>> --- a/arch/riscv/kernel/kexec_elf.c
>> +++ b/arch/riscv/kernel/kexec_elf.c
>> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
>> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
>> kbuf.cma = NULL;
>> kbuf.top_down = false;
>> - ret = arch_kexec_locate_mem_hole(&kbuf);
>> + ret = kexec_locate_mem_hole(&kbuf);
>> if (!ret) {
>> *old_pbase = lowest_paddr;
>> *new_pbase = kbuf.mem;
>> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
>> index 0af8ae4fdd08..e5f1cfc11fef 100644
>> --- a/include/linux/kexec.h
>> +++ b/include/linux/kexec.h
>> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
>> extern int kexec_add_buffer(struct kexec_buf *kbuf);
>> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>>
>> -#ifndef arch_kexec_locate_mem_hole
>> -/**
>> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
>> - * @kbuf: Parameters for the memory search.
>> - *
>> - * On success, kbuf->mem will have the start address of the memory region found.
>> - *
>> - * Return: 0 on success, negative errno on error.
>> - */
>> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
>> -{
>> - return kexec_locate_mem_hole(kbuf);
>> -}
>> -#endif
>> -
>> #ifndef arch_kexec_apply_relocations_add
>> /*
>> * arch_kexec_apply_relocations_add - apply relocations of type RELA
>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>> index 59fb9d71e9d8..9a981359addd 100644
>> --- a/kernel/kexec_file.c
>> +++ b/kernel/kexec_file.c
>> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
>> kbuf->cma = NULL;
>>
>> /* Walk the RAM ranges and allocate a suitable range for the buffer */
>> - ret = arch_kexec_locate_mem_hole(kbuf);
>> + ret = kexec_locate_mem_hole(kbuf);
>> if (ret)
>> return ret;
>>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] kexec_file: remove unused arch_kexec_locate_mem_hole hook
@ 2026-08-29 4:58 ` Sourabh Jain
0 siblings, 0 replies; 10+ messages in thread
From: Sourabh Jain @ 2026-08-29 4:58 UTC (permalink / raw)
To: Mukesh Pilaniya, linux-kernel
Cc: Albert Ou, Andrew Morton, Baoquan He, Mike Rapoport,
Palmer Dabbelt, Pasha Tatashin, Paul Walmsley, Pratyush Yadav,
linux-riscv, kexec
Hello Mukesh,
On 28/08/26 18:50, Mukesh Pilaniya wrote:
> Hi Sourabh,
>
> The patch touches three files across three subsystems so kexec: would be
> a more accurate prefix than kexec_file, for e.g.:
>
> kexec: remove unused arch_kexec_locate_mem_hole hook
As I understand it, the kexec: prefix is generally used when the changes
apply to both
the kexec_load and kexec_file_load syscalls.
Since these changes are specific to kexec_file_load, I used the
kexec_file: prefix for the patch title.
That said, I’m happy to follow the convention if you and others feel the
patch should use the
kexec: prefix. Otherwise, I would prefer to keep the kexec_file: prefix.
>
> On 27/08/26 8:14 pm, Sourabh Jain wrote:
>> No architecture provides an implementation of
>> arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
>> and remove the unused fallback wrapper from the kexec header.
>>
>> This simplifies the kexec memory allocation path without changing
>> its behavior.
>>
> Also, it might be worth mentioning in the commit message that this hook
> was originally introduced by commit f891f19736bd and that the last arch
> override was removed in commit 6e5250eaa665; making it safe to remove now.
Sure, I don’t mind including this in v2.
>
> Otherwise, the change looks good to me. Feel free to add:
> Reviewed-by: Mukesh Pilaniya <mpilaniy@redhat.com>
Thanks for the review.
- Sourabh Jain
>
>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Baoquan He <baoquan.he@linux.dev>
>> Cc: Mike Rapoport <rppt@kernel.org>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
>> Cc: Paul Walmsley <pjw@kernel.org>
>> Cc: Pratyush Yadav <pratyush@kernel.org>
>> Cc: linux-riscv@lists.infradead.org
>> Cc: kexec@lists.infradead.org
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> ---
>> arch/riscv/kernel/kexec_elf.c | 2 +-
>> include/linux/kexec.h | 15 ---------------
>> kernel/kexec_file.c | 2 +-
>> 3 files changed, 2 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
>> index 3e9a32acb8f2..ca5abbad59e5 100644
>> --- a/arch/riscv/kernel/kexec_elf.c
>> +++ b/arch/riscv/kernel/kexec_elf.c
>> @@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
>> kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
>> kbuf.cma = NULL;
>> kbuf.top_down = false;
>> - ret = arch_kexec_locate_mem_hole(&kbuf);
>> + ret = kexec_locate_mem_hole(&kbuf);
>> if (!ret) {
>> *old_pbase = lowest_paddr;
>> *new_pbase = kbuf.mem;
>> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
>> index 0af8ae4fdd08..e5f1cfc11fef 100644
>> --- a/include/linux/kexec.h
>> +++ b/include/linux/kexec.h
>> @@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
>> extern int kexec_add_buffer(struct kexec_buf *kbuf);
>> int kexec_locate_mem_hole(struct kexec_buf *kbuf);
>>
>> -#ifndef arch_kexec_locate_mem_hole
>> -/**
>> - * arch_kexec_locate_mem_hole - Find free memory to place the segments.
>> - * @kbuf: Parameters for the memory search.
>> - *
>> - * On success, kbuf->mem will have the start address of the memory region found.
>> - *
>> - * Return: 0 on success, negative errno on error.
>> - */
>> -static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
>> -{
>> - return kexec_locate_mem_hole(kbuf);
>> -}
>> -#endif
>> -
>> #ifndef arch_kexec_apply_relocations_add
>> /*
>> * arch_kexec_apply_relocations_add - apply relocations of type RELA
>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>> index 59fb9d71e9d8..9a981359addd 100644
>> --- a/kernel/kexec_file.c
>> +++ b/kernel/kexec_file.c
>> @@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
>> kbuf->cma = NULL;
>>
>> /* Walk the RAM ranges and allocate a suitable range for the buffer */
>> - ret = arch_kexec_locate_mem_hole(kbuf);
>> + ret = kexec_locate_mem_hole(kbuf);
>> if (ret)
>> return ret;
>>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread