On Tue, Jan 20, 2026 at 1:56 PM Pratyush Yadav <[email protected]> wrote:
>
> On Tue, Jan 20 2026, Mike Rapoport wrote:
>
> > On Tue, Jan 20, 2026 at 04:26:51PM +0000, Pratyush Yadav wrote:
> >> On Mon, Jan 05 2026, Mike Rapoport wrote:
> >>
> >> > From: Jason Miu <[email protected]>
> >> >
> >> > The `struct kho_vmalloc` defines the in-memory layout for preserving
> >> > vmalloc regions across kexec. This layout is a contract between kernels
> >> > and part of the KHO ABI.
> >> >
> >> > To reflect this relationship, the related structs and helper macros are
> >> > relocated to the ABI header, `include/linux/kho/abi/kexec_handover.h`.
> >> > This move places the structure's definition under the protection of the
> >> > KHO_FDT_COMPATIBLE version string.
> >> >
> >> > The structure and its components are now also documented within the
> >> > ABI header to describe the contract and prevent ABI breaks.
> >> >
> >> > Signed-off-by: Jason Miu <[email protected]>
> >> > Co-developed-by: Mike Rapoport (Microsoft) <[email protected]>
> >> > Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
> >> [...]
> >> > +/* Helper macro to define a union for a serializable pointer. */
> >> > +#define DECLARE_KHOSER_PTR(name, type)    \
> >> > +  union {                        \
> >> > +          u64 phys;              \
> >> > +          type ptr;              \
> >> > +  } name
> >> > +
> >> > +/* Stores the physical address of a serializable pointer. */
> >> > +#define KHOSER_STORE_PTR(dest, val)               \
> >> > +  ({                                        \
> >> > +          typeof(val) v = val;              \
> >> > +          typecheck(typeof((dest).ptr), v); \
> >> > +          (dest).phys = virt_to_phys(v);    \
> >> > +  })
> >> > +
> >> > +/* Loads the stored physical address back to a pointer. */
> >> > +#define KHOSER_LOAD_PTR(src)                                            
> >> >   \
> >> > +  ({                                                                   \
> >> > +          typeof(src) s = src;                                         \
> >> > +          (typeof((s).ptr))((s).phys ? phys_to_virt((s).phys) : NULL); \
> >> > +  })
> >>
> >> Nit: not a fan of exposing code internals to the ABI header. But without
> >> this the definition of kho_vmalloc_hdr won't make any sense to someone
> >> reading the doc without looking at the code. Dunno if we can do anything
> >> better though...
> >
> > These might be actually useful for other KHO users.

In my view, khoser definition belongs in the kernel implementation
rather than the cross-kernel ABI. The ABI describes the preserved data
format and should be independent of C types. However, this is a minor
complaint compared to the overall effort of moving the preserved
format into the ABI and making KHO stateless. For that reason, let's
merge it.

Reviewed-by: Pasha Tatashin <[email protected]>

Reply via email to