Live Patching
 help / color / mirror / Atom feed
From: Miroslav Benes <mbenes@suse.cz>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: jpoimboe@kernel.org, jikos@kernel.org, pmladek@suse.com,
	 joe.lawrence@redhat.com, song@kernel.org,
	live-patching@vger.kernel.org
Subject: Re: [PATCH v3 3/7] livepatch: Support scoped atomic replace using replace_set
Date: Tue, 23 Jun 2026 11:40:31 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.21.2606231124200.1711@pobox.suse.cz> (raw)
In-Reply-To: <20260607131659.29281-4-laoar.shao@gmail.com>

Hi,

On Sun, 7 Jun 2026, Yafang Shao 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 any
> existing patch belonging to the same set. There can only ever be one active
> livepatch for a given replace_set number.
> 
> This change currently supports function replacement only. Livepatches that
> belong to different replace sets cannot modify the same function. If a new
> livepatch attempts to modify a function already modified by an older
> livepatch from a different replace_set, the loading of the new livepatch
> will be refused.
> 
> Similarly, for the KLP state, livepatches belonging to different replace
> sets cannot use the same state ID. The system will refuse to load a new
> livepatch if it uses a state ID already in use by an older livepatch from
> a different replace_set.
> 
> For the KLP shadow variable mechanism, developers must assign unique shadow
> IDs to livepatches that belong to different replace sets.
> 
> Support for replace_set compatibility with KLP state and shadow variables
> will be implemented after Petr's KLP state transfer work is completed [0].
> 
> Other user-visible changes include:
> - The non-replace model is now deprecated
> - /sys/kernel/livepatch/livepatch_XXX/replace attribute is replaced by
>   /sys/kernel/livepatch/livepatch_XXX/replace_set

I will add my feedback here because the thread where it would belong to is 
more about details now. I am sorry that I got to it later than I wanted 
to.

What I like about the current state (non-replace and replace_all patches) 
is that it is simple when it comes to the code and it is agnostic to 
different use cases as we know them. Yes, it can lead to really 
problematic scenarios on users' side but the kernel code is 
relatively simple and flexible to allow that. As a distributor we chose 
something that suits our needs and what we think suits our customers as 
well. However, it is a downstream choice and implementation.

Now we learnt that some users would welcome a specific use case of keeping 
parallel live patches applied on their system and they lack the kernel 
support for that. That is ok and we should do something about that. There 
are two things which I am concerned about though.

1. I think that we should not leave our existing users (which we do not 
know much about) behind and regress. I mean we should still allow the same 
level of flexibility. If not possible, it should be seriously thought 
through. I am talking about non-replace patches here.

2. Slightly connected. We should not optimize too much for specific 
scenarios. It seems perfectly fine to introduce a specific feature which 
helps someone but I am concerned about restricting different use cases at 
the same time. The latest discussion next door dives into very specific 
scenarios and my question is "Do we really care?". The user (either a 
distributor or anyone else) can choose what they want to implement in the 
end (policy) and how to maintain it (a distributor will typically refuse 
to support a system with a user applied live patches not provided by the 
distributor).

I think that latest proposals in the other thread go in the right 
direction if I understand them correctly but I also think that we should 
keep the above in mind (or disagree with me please).

It might be difficult to keep the code simple and maintainable in the end 
and it certainly would not have benefits as the original replace_set 
proposal where it would all be very simple in the end (only one live patch 
per function allowed which might lead to substantial code simplification 
all around the stack).

Regards,
Miroslav

  parent reply	other threads:[~2026-06-23  9:40 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 13:16 [PATCH v3 0/7] livepatch: Introduce replace set support Yafang Shao
2026-06-07 13:16 ` [PATCH v3 1/7] livepatch: Fix NULL pointer dereference in klp_find_func() Yafang Shao
2026-06-09 13:27   ` Petr Mladek
2026-06-10  3:00     ` Yafang Shao
2026-06-22 14:21     ` Miroslav Benes
2026-06-23  6:50       ` Yafang Shao
2026-06-23  8:20         ` Miroslav Benes
2026-06-24 12:03           ` Petr Mladek
2026-06-07 13:16 ` [PATCH v3 2/7] livepatch: Move klp_find_func() into core.h Yafang Shao
2026-06-09 15:28   ` Petr Mladek
2026-06-10  3:01     ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 3/7] livepatch: Support scoped atomic replace using replace_set Yafang Shao
2026-06-07 13:33   ` sashiko-bot
2026-06-07 14:00     ` Yafang Shao
2026-06-09 16:00   ` Petr Mladek
2026-06-10  3:24     ` Yafang Shao
2026-06-10  9:48       ` Petr Mladek
2026-06-11 12:58     ` Petr Mladek
2026-06-15 12:30       ` Yafang Shao
2026-06-16  2:41         ` Yafang Shao
2026-06-16 20:15       ` Joe Lawrence
2026-06-17  2:40         ` Yafang Shao
2026-06-17 14:54           ` Joe Lawrence
2026-06-18  9:20             ` Yafang Shao
2026-06-17 13:52         ` Petr Mladek
2026-06-17 20:06           ` Joe Lawrence
2026-06-18  2:34             ` Yafang Shao
2026-06-18 13:03             ` Petr Mladek
2026-06-22 17:26               ` Joe Lawrence
2026-06-23  3:08                 ` Yafang Shao
2026-06-23 15:38                   ` Joe Lawrence
2026-06-10 14:45   ` code review: was: " Petr Mladek
2026-06-11  3:06     ` Yafang Shao
2026-06-16 18:20   ` Joe Lawrence
2026-06-23  9:40   ` Miroslav Benes [this message]
2026-06-24 13:56     ` Petr Mladek
2026-06-24 14:05       ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 4/7] livepatch: Deprecate stack_order Yafang Shao
2026-06-07 13:31   ` sashiko-bot
2026-06-10 15:11   ` Petr Mladek
2026-06-11  3:21     ` Yafang Shao
2026-06-16 18:44       ` Joe Lawrence
2026-06-07 13:16 ` [PATCH v3 5/7] selftests/livepatch: Update tests for replace_set Yafang Shao
2026-06-07 13:29   ` sashiko-bot
2026-06-07 13:16 ` [PATCH v3 6/7] selftests/livepatch: Add test for state ID conflict across replace_sets Yafang Shao
2026-06-12  8:55   ` Petr Mladek
2026-06-15 11:59     ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 7/7] selftests/livepatch: Add test for function " Yafang Shao
2026-06-16 20:25 ` [PATCH v3 0/7] livepatch: Introduce replace set support Joe Lawrence
2026-06-17  2:21   ` Yafang Shao

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=alpine.LSU.2.21.2606231124200.1711@pobox.suse.cz \
    --to=mbenes@suse.cz \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=live-patching@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=song@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