On Wed, May 13, 2026 at 7:34 AM Yafang Shao <[email protected]> wrote: > > Convert the replace attribute from a boolean to a u32 to function as a > "replace set." A newly loaded livepatch will now atomically replace > existing patches that belong to the same set. > > This change currently supports function replacement only; support for > state and shadow variables will be introduced in subsequent patches. > > Suggested-by: Song Liu <[email protected]> > Signed-off-by: Yafang Shao <[email protected]> > --- > .../livepatch/cumulative-patches.rst | 17 ++++++++------ > Documentation/livepatch/livepatch.rst | 23 +++++++++++-------- > include/linux/livepatch.h | 5 ++-- > kernel/livepatch/core.c | 16 ++++++++----- > kernel/livepatch/state.c | 17 +++++++------- > kernel/livepatch/transition.c | 10 ++++---- > scripts/livepatch/init.c | 7 +----- > scripts/livepatch/klp-build | 14 +++++------ > 8 files changed, 59 insertions(+), 50 deletions(-) > > diff --git a/Documentation/livepatch/cumulative-patches.rst > b/Documentation/livepatch/cumulative-patches.rst > index 1931f318976a..6ef49748110e 100644 > --- a/Documentation/livepatch/cumulative-patches.rst > +++ b/Documentation/livepatch/cumulative-patches.rst > @@ -17,18 +17,20 @@ from all older livepatches and completely replace them in > one transition. > Usage > ----- > > -The atomic replace can be enabled by setting "replace" flag in struct > klp_patch, > -for example:: > +The "replace_set" attribute in ``struct klp_patch`` acts as a **replace > set**, > +defining the scope of the replacement. By default, the replace set is 1. > + > +For example:: > > static struct klp_patch patch = { > .mod = THIS_MODULE, > .objs = objs, > - .replace = true, > + .replace_set = 1, > };
I wonder whether we should have "replace_set = 0" means no replace. This will simplify the transition for users of the existing replace=false option. I would like to hear other folks' thoughts on this. Thanks, Song
