Re: [PATCH v4 02/30] kho: make debugfs interface optional
From: Pasha Tatashin <pasha.tatashin@soleen.com>
Date: 2025-10-06 17:23:50
Also in:
linux-doc, linux-fsdevel, linux-mm, lkml
On Mon, Oct 6, 2025 at 12:55 PM Pratyush Yadav [off-list ref] wrote:
Hi Pasha, On Mon, Sep 29 2025, Pasha Tatashin wrote:quoted
Currently, KHO is controlled via debugfs interface, but once LUO is introduced, it can control KHO, and the debug interface becomes optional. Add a separate config CONFIG_KEXEC_HANDOVER_DEBUG that enables the debugfs interface, and allows to inspect the tree. Move all debugfs related code to a new file to keep the .c files clear of ifdefs. Co-developed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>[...]quoted
@@ -662,36 +660,24 @@ static void __init kho_reserve_scratch(void) kho_enable = false; } -struct fdt_debugfs { - struct list_head list; - struct debugfs_blob_wrapper wrapper; - struct dentry *file; +struct kho_out { + struct blocking_notifier_head chain_head; + struct mutex lock; /* protects KHO FDT finalization */ + struct kho_serialization ser; + bool finalized; + struct kho_debugfs dbg; }; -static int kho_debugfs_fdt_add(struct list_head *list, struct dentry *dir, - const char *name, const void *fdt) -{ - struct fdt_debugfs *f; - struct dentry *file; - - f = kmalloc(sizeof(*f), GFP_KERNEL); - if (!f) - return -ENOMEM; - - f->wrapper.data = (void *)fdt; - f->wrapper.size = fdt_totalsize(fdt); - - file = debugfs_create_blob(name, 0400, dir, &f->wrapper); - if (IS_ERR(file)) { - kfree(f); - return PTR_ERR(file); - } - - f->file = file; - list_add(&f->list, list); - - return 0; -} +static struct kho_out kho_out = { + .chain_head = BLOCKING_NOTIFIER_INIT(kho_out.chain_head), + .lock = __MUTEX_INITIALIZER(kho_out.lock), + .ser = { + .track = { + .orders = XARRAY_INIT(kho_out.ser.track.orders, 0), + }, + }, + .finalized = false, +};There is already one definition for struct kho_out and a static struct kho_out early in the file. This is a second declaration and definition. And I was super confused when I saw patch 3 since it seemed to be making unrelated changes to this struct (and removing an instance of this, which should be done in this patch instead). In fact, this patch doesn't even build due to this problem. I think some patch massaging is needed to fix this all up.
Let me fix it. I Plan to send a separate series only with KHO changes from LUO, so we can expedite its landing. Pasha
quoted
/** * kho_add_subtree - record the physical address of a sub FDT in KHO root tree.[...] -- Regards, Pratyush Yadav