From: Mike Rapoport <rppt@kernel.org>
To: Chris Down <chris@chrisdown.name>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
Alexander Graf <graf@amazon.com>,
Baoquan He <baoquan.he@linux.dev>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
kexec@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org, kernel-team@meta.com,
Breno Leitao <leitao@debian.org>,
sashiko-bot@kernel.org
Subject: Re: [PATCH v2 4/7] kho: Expose rejected handovers that look like cold boots
Date: Sun, 29 Nov 2026 23:03:31 +0200 [thread overview]
Message-ID: <awyTI8AFxYU2YF0D@kernel.org> (raw)
In-Reply-To: <3131fae711e7e2350689ebf4dbf5cb8209625cf5.1795857773.git.chris@chrisdown.name>
Hi Chris,
On Sat, Nov 28, 2026 at 10:27:38AM -0800, Chris Down wrote:
> Subject: [PATCH v2 4/7] kho: Expose rejected handovers that look like cold boots
Maybe
expose handover status in sysfs
> At Meta, our rollout needs to stop if the new kernel rejects the KHO
> handover. For example, if it doesn't recognise the handover FDT's
> compatible string, it can boot normally with all the preserved state
> lost. LUO's incoming/state reads "none", as on a cold boot. We log
> "disabling KHO revival", but our fleet collector reads procfs and sysfs
> and can't rely on kernel logs from every host.
>
> Let's add /sys/kernel/kho/incoming/state so the collector can tell a
> rejected handover from an ordinary boot. "revived" means the kernel
> accepted the handover and completed the preserved memory map walk. LUO
> reports the outcome of restoring sessions separately.
>
> KHO has no sysfs directory yet, so this adds /sys/kernel/kho in its own
> file, kho_sysfs.c. It is set up separately from kho_init(), because
> kho_init() returns early when KHO is disabled, and a rejected handover
> still needs to be reported then.
>
> Signed-off-by: Chris Down <chris@chrisdown.name>
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> @@ -1744,6 +1745,7 @@ err:
/* static void __init kho_mem_retrieve(void) */
> */
> kho_in.fdt_phys = 0;
> kho_in.radix_tree.root = NULL;
> + kho_in.state = KHO_INCOMING_FAILED;
> }
>
> static __init int kho_out_fdt_setup(void)
> @@ -1981,6 +1988,7 @@ err:
> */
> kho_in.fdt_phys = 0;
> kho_in.bootmem_phys = 0;
> + kho_in.state = KHO_INCOMING_FAILED;
> }
>
> void __init kho_memory_init(void)
> @@ -2079,6 +2087,7 @@ unmap_bootmem:
/* void __init kho_populate(phys_addr_t fdt_phys, ...) */
> unmap_fdt:
> early_memunmap(fdt, fdt_len);
> report:
> + kho_in.state = populated ? KHO_INCOMING_REVIVED : KHO_INCOMING_FAILED;
This is too early to say "REVIVED" here.
Although the state stays REVIVED unless we overwrite later with FAILED if
something goes wrong, I think it's better to make it explicit there.
Maybe even start with FAILED unconditionally in kho_populate() and only
reset it to REVIVED in kho_memory_init().
That way the state starts with NONE, then if kho_populate() is called we
know that's a KHO boot, and from there it's FAILED until proven otherwise.
This way we won't need to chase the points that should reset REVIVED to
FAILED after kho_populate() or check the current state before changing it.
> if (!populated)
> pr_warn("disabling KHO revival\n");
> }
> diff --git a/kernel/liveupdate/kexec_handover_internal.h b/kernel/liveupdate/kexec_handover_internal.h
> index e9685e1ef6d7..b559f5d43116 100644
> --- a/kernel/liveupdate/kexec_handover_internal.h
> +++ b/kernel/liveupdate/kexec_handover_internal.h
> @@ -22,6 +22,14 @@ struct kho_debugfs {};
> extern struct kho_bootmem *kho_bootmem;
> extern unsigned int kho_bootmem_cnt;
>
> +enum kho_incoming_state {
> + KHO_INCOMING_NONE,
This one is never set. Can we stick an explicit state = KHO_INCOMING_NONE
at the declaration of struct kho_in for clarity?
> + KHO_INCOMING_REVIVED,
> + KHO_INCOMING_FAILED,
> +};
> +
> +enum kho_incoming_state kho_in_state(void);
> +
> #ifdef CONFIG_KEXEC_HANDOVER_DEBUGFS
> int kho_debugfs_init(void);
> void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt);
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-11-29 21:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 18:27 [PATCH v2 0/7] kho, liveupdate: KHO/LUO observability Chris Down
2026-11-28 18:27 ` [PATCH v2 1/7] kho: Reclaim the metadata page left reserved after kexec Chris Down
2026-11-28 18:27 ` [PATCH v2 2/7] liveupdate: Make failed retrieves distinguishable from dropped files Chris Down
2026-11-29 20:13 ` Mike Rapoport
2026-11-28 18:27 ` [PATCH v2 3/7] selftests/liveupdate: Catch incorrect file accounting across kexec Chris Down
2026-11-28 18:27 ` [PATCH v2 4/7] kho: Expose rejected handovers that look like cold boots Chris Down
2026-11-29 21:03 ` Mike Rapoport [this message]
2026-11-28 18:27 ` [PATCH v2 5/7] kho: Report how much handover memory is preserved and restored Chris Down
2026-11-29 21:13 ` Mike Rapoport
2026-11-28 18:27 ` [PATCH v2 6/7] liveupdate: Expose the sequence number for consecutive live updates Chris Down
2026-11-28 18:27 ` [PATCH v2 7/7] selftests/liveupdate: Check handover revival, sequence and memory stats Chris Down
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awyTI8AFxYU2YF0D@kernel.org \
--to=rppt@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chris@chrisdown.name \
--cc=corbet@lwn.net \
--cc=graf@amazon.com \
--cc=kernel-team@meta.com \
--cc=kexec@lists.infradead.org \
--cc=leitao@debian.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox