* [PATCH] kho: print which scratch buffer failed to be reserved
@ 2026-01-16 16:54 Pratyush Yadav
2026-01-18 12:17 ` Mike Rapoport
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pratyush Yadav @ 2026-01-16 16:54 UTC (permalink / raw)
To: Andrew Morton, Alexander Graf, Mike Rapoport, Pasha Tatashin,
Pratyush Yadav
Cc: kexec, linux-mm, linux-kernel, Samiullah Khawaja, David Matlack,
Jason Miu
From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
When scratch area fails to reserve, KHO prints a message indicating
that. But it doesn't say which scratch failed to allocate. This can be
useful information for debugging. Even more so when the failure is hard
to reproduce.
Along with the current message, also print which exact scratch area
failed to be reserved.
Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
---
kernel/liveupdate/kexec_handover.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
index 49bf2cecab12..636bd96780ae 100644
--- a/kernel/liveupdate/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -651,8 +651,10 @@ static void __init kho_reserve_scratch(void)
kho_scratch_cnt = num_online_nodes() + 2;
size = kho_scratch_cnt * sizeof(*kho_scratch);
kho_scratch = memblock_alloc(size, PAGE_SIZE);
- if (!kho_scratch)
+ if (!kho_scratch) {
+ pr_err("Failed to reserve scratch array\n");
goto err_disable_kho;
+ }
/*
* reserve scratch area in low memory for lowmem allocations in the
@@ -661,8 +663,10 @@ static void __init kho_reserve_scratch(void)
size = scratch_size_lowmem;
addr = memblock_phys_alloc_range(size, CMA_MIN_ALIGNMENT_BYTES, 0,
ARCH_LOW_ADDRESS_LIMIT);
- if (!addr)
+ if (!addr) {
+ pr_err("Failed to reserve lowmem scratch buffer\n");
goto err_free_scratch_desc;
+ }
kho_scratch[i].addr = addr;
kho_scratch[i].size = size;
@@ -671,8 +675,10 @@ static void __init kho_reserve_scratch(void)
/* reserve large contiguous area for allocations without nid */
size = scratch_size_global;
addr = memblock_phys_alloc(size, CMA_MIN_ALIGNMENT_BYTES);
- if (!addr)
+ if (!addr) {
+ pr_err("Failed to reserve global scratch buffer\n");
goto err_free_scratch_areas;
+ }
kho_scratch[i].addr = addr;
kho_scratch[i].size = size;
@@ -683,8 +689,10 @@ static void __init kho_reserve_scratch(void)
addr = memblock_alloc_range_nid(size, CMA_MIN_ALIGNMENT_BYTES,
0, MEMBLOCK_ALLOC_ACCESSIBLE,
nid, true);
- if (!addr)
+ if (!addr) {
+ pr_err("Failed to reserve nid %d scratch buffer\n", nid);
goto err_free_scratch_areas;
+ }
kho_scratch[i].addr = addr;
kho_scratch[i].size = size;
base-commit: c37fac0551448c68e36f14782acaf662c7a1775e
--
2.52.0.457.g6b5491de43-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kho: print which scratch buffer failed to be reserved
2026-01-16 16:54 [PATCH] kho: print which scratch buffer failed to be reserved Pratyush Yadav
@ 2026-01-18 12:17 ` Mike Rapoport
2026-01-22 19:35 ` Pasha Tatashin
2026-01-22 19:48 ` Samiullah Khawaja
2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2026-01-18 12:17 UTC (permalink / raw)
To: Pratyush Yadav
Cc: Andrew Morton, Alexander Graf, Pasha Tatashin, kexec, linux-mm,
linux-kernel, Samiullah Khawaja, David Matlack, Jason Miu
On Fri, Jan 16, 2026 at 04:54:11PM +0000, Pratyush Yadav wrote:
> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
>
> When scratch area fails to reserve, KHO prints a message indicating
> that. But it doesn't say which scratch failed to allocate. This can be
> useful information for debugging. Even more so when the failure is hard
> to reproduce.
>
> Along with the current message, also print which exact scratch area
> failed to be reserved.
>
> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kho: print which scratch buffer failed to be reserved
2026-01-16 16:54 [PATCH] kho: print which scratch buffer failed to be reserved Pratyush Yadav
2026-01-18 12:17 ` Mike Rapoport
@ 2026-01-22 19:35 ` Pasha Tatashin
2026-01-22 19:48 ` Samiullah Khawaja
2 siblings, 0 replies; 4+ messages in thread
From: Pasha Tatashin @ 2026-01-22 19:35 UTC (permalink / raw)
To: Pratyush Yadav
Cc: Andrew Morton, Alexander Graf, Mike Rapoport, kexec, linux-mm,
linux-kernel, Samiullah Khawaja, David Matlack, Jason Miu
On Fri, Jan 16, 2026 at 11:54 AM Pratyush Yadav <pratyush@kernel.org> wrote:
>
> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
>
> When scratch area fails to reserve, KHO prints a message indicating
> that. But it doesn't say which scratch failed to allocate. This can be
> useful information for debugging. Even more so when the failure is hard
> to reproduce.
>
> Along with the current message, also print which exact scratch area
> failed to be reserved.
>
> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kho: print which scratch buffer failed to be reserved
2026-01-16 16:54 [PATCH] kho: print which scratch buffer failed to be reserved Pratyush Yadav
2026-01-18 12:17 ` Mike Rapoport
2026-01-22 19:35 ` Pasha Tatashin
@ 2026-01-22 19:48 ` Samiullah Khawaja
2 siblings, 0 replies; 4+ messages in thread
From: Samiullah Khawaja @ 2026-01-22 19:48 UTC (permalink / raw)
To: Pratyush Yadav
Cc: Andrew Morton, Alexander Graf, Mike Rapoport, Pasha Tatashin,
kexec, linux-mm, linux-kernel, David Matlack, Jason Miu
On Fri, Jan 16, 2026 at 8:54 AM Pratyush Yadav <pratyush@kernel.org> wrote:
>
> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
>
> When scratch area fails to reserve, KHO prints a message indicating
> that. But it doesn't say which scratch failed to allocate. This can be
> useful information for debugging. Even more so when the failure is hard
> to reproduce.
>
> Along with the current message, also print which exact scratch area
> failed to be reserved.
>
> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
> ---
> kernel/liveupdate/kexec_handover.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 49bf2cecab12..636bd96780ae 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -651,8 +651,10 @@ static void __init kho_reserve_scratch(void)
> kho_scratch_cnt = num_online_nodes() + 2;
> size = kho_scratch_cnt * sizeof(*kho_scratch);
> kho_scratch = memblock_alloc(size, PAGE_SIZE);
> - if (!kho_scratch)
> + if (!kho_scratch) {
> + pr_err("Failed to reserve scratch array\n");
> goto err_disable_kho;
> + }
>
> /*
> * reserve scratch area in low memory for lowmem allocations in the
> @@ -661,8 +663,10 @@ static void __init kho_reserve_scratch(void)
> size = scratch_size_lowmem;
> addr = memblock_phys_alloc_range(size, CMA_MIN_ALIGNMENT_BYTES, 0,
> ARCH_LOW_ADDRESS_LIMIT);
> - if (!addr)
> + if (!addr) {
> + pr_err("Failed to reserve lowmem scratch buffer\n");
> goto err_free_scratch_desc;
> + }
>
> kho_scratch[i].addr = addr;
> kho_scratch[i].size = size;
> @@ -671,8 +675,10 @@ static void __init kho_reserve_scratch(void)
> /* reserve large contiguous area for allocations without nid */
> size = scratch_size_global;
> addr = memblock_phys_alloc(size, CMA_MIN_ALIGNMENT_BYTES);
> - if (!addr)
> + if (!addr) {
> + pr_err("Failed to reserve global scratch buffer\n");
> goto err_free_scratch_areas;
> + }
>
> kho_scratch[i].addr = addr;
> kho_scratch[i].size = size;
> @@ -683,8 +689,10 @@ static void __init kho_reserve_scratch(void)
> addr = memblock_alloc_range_nid(size, CMA_MIN_ALIGNMENT_BYTES,
> 0, MEMBLOCK_ALLOC_ACCESSIBLE,
> nid, true);
> - if (!addr)
> + if (!addr) {
> + pr_err("Failed to reserve nid %d scratch buffer\n", nid);
> goto err_free_scratch_areas;
> + }
>
> kho_scratch[i].addr = addr;
> kho_scratch[i].size = size;
>
> base-commit: c37fac0551448c68e36f14782acaf662c7a1775e
> --
> 2.52.0.457.g6b5491de43-goog
>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Tested-by: Samiullah Khawaja <skhawaja@google.com>
Tested on my test machine while investigating the scratch space
allocation failure.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-22 19:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-16 16:54 [PATCH] kho: print which scratch buffer failed to be reserved Pratyush Yadav
2026-01-18 12:17 ` Mike Rapoport
2026-01-22 19:35 ` Pasha Tatashin
2026-01-22 19:48 ` Samiullah Khawaja
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox