From: George Guo <dongtai.guo@linux.dev>
To: pratyush@kernel.org
Cc: rppt@kernel.org, pasha.tatashin@soleen.com,
chenhuacai@kernel.org, ardb@kernel.org, shuah@kernel.org,
ilias.apalodimas@linaro.org, akpm@linux-foundation.org,
baoquan.he@linux.dev, ruirui.yang@linux.dev,
guodongtai@kylinos.cn, kernel@xen0n.name, graf@amazon.com,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
kexec@lists.infradead.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-efi@vger.kernel.org
Subject: Re: [PATCH v5 1/5] efi: add a KHO configuration table channel
Date: Wed, 21 Oct 2026 11:33:42 +0800 [thread overview]
Message-ID: <20261021033342.3110-1-dongtai.guo@linux.dev> (raw)
In-Reply-To: <2vxza4p95v6e.fsf@kernel.org>
Hi Pratyush,
Thanks for the detailed review. I've rewriten the comments and commit messages
myself for v6. Replies inline.
On Tue, Sep 22 2026, Pratyush Yadav wrote:
> > +config EFI_KHO
> > + bool
> > + depends on EFI_STUB && EFI_GENERIC_STUB && KEXEC_HANDOVER
> > + help
[...]
> I don't like adding a config for this sort of thing. Do we really need
> this? Why not just have the code always compiled and only used by
> loongarch? I don't really see we need a user decision for this sort of
> thing.
Agreed, v6 drops it.
> > + /*
> > + * Reserve the stub-allocated table so it is neither handed
> > + * out by the buddy allocator nor placed on by kexec
> > + * segments, mirroring the memreserve handling above. This
> > + * runs on every boot, so it also protects the table in the
> > + * next kernel until it reads it.
> > + */
>
> Nit: this comment is too wordy. Can you please make it more concise and
> to the point?
v6:
/* Keep the buddy allocator and kexec segments off the table. */
> > + if (kho->fdt_addr)
>
> When can kho->fdt_addr be NULL? Also, perhaps print a warning if
> early_memremap() fails?
It is 0 when there is nothing to restore:
- on a cold boot, because the stub installs the table zeroed;
- after a kexec into an image without KHO state, such as a crash
kernel, because the table is zeroed just before that kexec.
v6 says this in the struct documentation, and adds a pr_warn() when
early_memremap() fails.
> > + /*
> > + * Keep a persistent mapping of the table, the same way
> > + * efi_memreserve_root_init() keeps the memreserve root mapped:
> > + * efi_kho_update() is also called on the crash kexec path, where
> > + * memremap() is no longer an option.
> > + */
>
> No need to mention memreserve. Just explain the reason here. And keep it
> as short and to the point as possible.
v6:
/* Map it now: the table is also written at panic time. */
> This is unreadable. Please add a human touch to this.
>
> And once again, the fact that it mirrors efi_mem_reserve_persistent()
> isn't important.
v6:
/*
* Write the KHO addresses the next kernel should use, or zeroes
* if it should boot without KHO.
*/
> Why ENODEV? Wouldn't ENOENT be a tiny bit better?
Neither, in v6. No table is the normal case outside LoongArch, so
efi_kho_update() now returns 0. The only error left is a table that
could not be mapped at boot, which returns -ENOMEM.
> This has too much information. You need to make it more to the point.
> For example, "without a device tree" already implies there is no /chosen
> property in the first place. No need to mention the function either.
>
> The lifetime of the table is certainly useful information but again,
> should be much more clear and to the point.
>
> Also, you should document what each of the members of the struct mean.
Agreed. v6:
/**
* struct linux_efi_kho_data - KHO state passed to the next kernel
* @fdt_addr: physical address of the KHO FDT, 0 if there is none
* @fdt_size: size of the KHO FDT
* @bootmem_addr: physical address of the bootmem area list
* @bootmem_size: size of the bootmem area list
*
* Pointed to by the LINUX_EFI_KEXEC_HANDOVER_GUID configuration table.
*
* The EFI stub installs this table zeroed on a cold boot. It stays
* in place across kexec; the running kernel rewrites it just before
* each kexec, and the next kernel reads it during early boot.
*
* The layout is fixed. Changing it requires a new GUID.
*/
> Note: I recently sent a series that renames scratch to bootmem [0]. It
> looks close to landing. So you likely need to rename this to
> bootmem_{addr,size}.
Thanks for the heads-up. It is in liveupdate/next now, so v6 is based
on it and uses bootmem_{addr,size}.
> Why __packed?
No good reason. All four members are u64, so there is no padding
and __packed changes nothing. Dropped.
Thanks,
George
next prev parent reply other threads:[~2026-10-21 3:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 10:08 [PATCH v5 0/5] LoongArch: add KHO support and selftests George Guo
2026-09-04 10:08 ` [PATCH v5 1/5] efi: add a KHO configuration table channel George Guo
2026-09-19 14:15 ` Huacai Chen
2026-09-22 12:26 ` Pratyush Yadav
2026-10-21 3:33 ` George Guo [this message]
2026-09-04 10:08 ` [PATCH v5 2/5] liveupdate: synchronize EFI KHO channel at execution George Guo
2026-09-19 14:15 ` Huacai Chen
2026-09-22 12:48 ` Pratyush Yadav
2026-09-04 10:08 ` [PATCH v5 3/5] liveupdate: kho_block: include linux/mm.h for virt/phys translation George Guo
2026-09-22 12:30 ` Pratyush Yadav
2026-09-04 10:08 ` [PATCH v5 4/5] LoongArch: enable kexec handover (KHO) George Guo
2026-09-04 10:08 ` [PATCH v5 5/5] selftests/kho: add LoongArch vmtest support George Guo
2026-09-06 20:17 ` [PATCH v5 0/5] LoongArch: add KHO support and selftests Mike Rapoport
2026-09-28 2:30 ` George Guo
2026-09-07 1:47 ` Baoquan He
2026-09-07 2:10 ` Baoquan He
2026-09-19 14:15 ` Huacai Chen
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=20261021033342.3110-1-dongtai.guo@linux.dev \
--to=dongtai.guo@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chenhuacai@kernel.org \
--cc=graf@amazon.com \
--cc=guodongtai@kylinos.cn \
--cc=ilias.apalodimas@linaro.org \
--cc=kernel@xen0n.name \
--cc=kexec@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=loongarch@lists.linux.dev \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=ruirui.yang@linux.dev \
--cc=shuah@kernel.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