From: Logan Odell <loganodell@google.com>
To: graf@amazon.com, rppt@kernel.org, pasha.tatashin@soleen.com
Cc: pratyush@kernel.org, akpm@linux-foundation.org,
kexec@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Logan Odell <loganodell@google.com>
Subject: [RFC PATCH 3/4] kho: Add support for multiple versions to debugfs
Date: Fri, 31 Jul 2026 14:52:23 -0700 [thread overview]
Message-ID: <20260731215224.831696-4-loganodell@google.com> (raw)
In-Reply-To: <20260731215224.831696-1-loganodell@google.com>
Update kho_in_debugfs_init to search for versioned subnodes
(depth 2) and expose them as name-version in the input debugfs.
This ensures versioned subtrees are visible to userspace for debugging,
matching the behavior of the output side.
Signed-off-by: Logan Odell <loganodell@google.com>
---
kernel/liveupdate/kexec_handover_debugfs.c | 57 +++++++++++++++++-----
1 file changed, 44 insertions(+), 13 deletions(-)
diff --git a/kernel/liveupdate/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c
index 2f93939168ab..2ca055219900 100644
--- a/kernel/liveupdate/kexec_handover_debugfs.c
+++ b/kernel/liveupdate/kexec_handover_debugfs.c
@@ -13,6 +13,7 @@
#include <linux/io.h>
#include <linux/libfdt.h>
#include <linux/mm.h>
+#include <linux/unaligned.h>
#include "kexec_handover_internal.h"
static struct dentry *debugfs_root;
@@ -140,19 +141,49 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
const u64 *fdt_phys;
fdt_phys = fdt_getprop(fdt, child, "fdt", &len);
- if (!fdt_phys)
- continue;
- if (len != sizeof(*fdt_phys)) {
- pr_warn("node %s prop fdt has invalid length: %d\n",
- name, len);
- continue;
- }
- err = __kho_debugfs_fdt_add(&dbg->fdt_list, sub_fdt_dir, name,
- phys_to_virt(*fdt_phys));
- if (err) {
- pr_warn("failed to add fdt %s to debugfs: %pe\n", name,
- ERR_PTR(err));
- continue;
+ if (fdt_phys) {
+ if (len != sizeof(*fdt_phys)) {
+ pr_warn("node %s prop fdt has invalid length: %d\n",
+ name, len);
+ continue;
+ }
+ err = __kho_debugfs_fdt_add(&dbg->fdt_list, sub_fdt_dir, name,
+ phys_to_virt(get_unaligned(fdt_phys)));
+ if (err) {
+ pr_warn("failed to add fdt %s to debugfs: %pe\n", name,
+ ERR_PTR(err));
+ }
+ } else {
+ int grandchild;
+
+ fdt_for_each_subnode(grandchild, fdt, child) {
+ const char *gc_name = fdt_get_name(fdt, grandchild, NULL);
+ const u64 *gc_fdt_phys;
+ char *combined_name;
+
+ gc_fdt_phys = fdt_getprop(fdt, grandchild, "fdt", &len);
+ if (!gc_fdt_phys)
+ continue;
+
+ if (len != sizeof(*gc_fdt_phys)) {
+ pr_warn("node %s/%s prop fdt has invalid length: %d\n",
+ name, gc_name, len);
+ continue;
+ }
+
+ combined_name = kasprintf(GFP_KERNEL, "%s-%s", name, gc_name);
+ if (!combined_name)
+ continue;
+
+ err = __kho_debugfs_fdt_add(&dbg->fdt_list, sub_fdt_dir,
+ combined_name,
+ phys_to_virt(get_unaligned(gc_fdt_phys)));
+ kfree(combined_name);
+ if (err) {
+ pr_warn("failed to add fdt %s-%s to debugfs: %pe\n",
+ name, gc_name, ERR_PTR(err));
+ }
+ }
}
}
--
2.55.0.508.g3f0d502094-goog
next prev parent reply other threads:[~2026-07-31 21:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 21:52 [RFC PATCH 0/2] Add support for multiple versions to KHO Logan Odell
2026-07-31 21:52 ` [RFC PATCH 1/4] kho: Move subtree blob logic to separate function Logan Odell
2026-07-31 21:52 ` [RFC PATCH 2/4] kho: Add support for multiple versions in subtrees Logan Odell
2026-07-31 21:52 ` Logan Odell [this message]
2026-07-31 21:52 ` [RFC PATCH 4/4] kho: Add test cases for versioned subtrees Logan Odell
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=20260731215224.831696-4-loganodell@google.com \
--to=loganodell@google.com \
--cc=akpm@linux-foundation.org \
--cc=graf@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@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