Re: [PATCH v4 05/19] kho: Add feature header for fine-grained ABI compatibility
From: Samiullah Khawaja
Date: Tue Dec 01 2026 - 19:43:01 EST
On Tue, Nov 10, 2026 at 05:01:48AM +0000, Tarun Sahu wrote:
Serialized structures in KHO and Live Update Orchestrator currently rely
on whole-structure compatibility strings or monolithic version fields to
validate handed-over state across kexec. Any change to a serialized
structure, even an optional additive field, requires bumping the
compatibility string or version number and breaks live update between
adjacent kernels.
Introduce a generic feature header (struct kho_ser_hdr) for serialized
binary structures in include/linux/kho/abi/feature.h. Each subsystem
groups the fields of its serialized structure under feature indices,
starting with index 0 for base fields. When a subsystem adds a new
capability, it appends new fields to the end of its payload structure
under a new feature index. Retired fields are kept in place so existing
field offsets never shift; if the type or format of a field needs to
change, the existing field and feature are kept intact until retired and
a new feature index with an appended field of the new type is added.
Only when a change requires a complete break in the serialized layout or
semantics that feature flags cannot handle, a new handler or format can
be introduced with an incremented version number.
Each feature belongs to either a required feature space or an optional
feature space. Both spaces are numbered independently starting from 0.
In the serialized header, required features occupy the first nr_required
bits, followed immediately by nr_optional bits for optional features:
struct kho_ser_hdr {
__u32 size;
__u16 nr_required;
__u16 nr_optional;
__aligned_u64 flags[];
};
A set bit indicates that the feature is present in the payload. The
truth table for deserialization:
Source bit Target Action
Not set - Accept: feature absent
Optional set unknown or known Accept: ignore or use the data
A real world example would be really helpful to understand this. What
does optional mean here? If the bit is unknown to the next kernel, how
does it decided to ignore it.
Thanks,
Sami