# Re: Replace rules: was: Re: \[PATCH v7 for-next 3/8\] livepatch: Implement replace set for scoped atomic replace

- From: Yafang Shao \<hidden\>
- Date: 2026-09-06 08:34:46 
- List: live-patching
- Page: https://ratatoskr.run/live-patching/2026/09/17520293
- Thread: https://ratatoskr.run/live-patching/2026/08/17458637/t.md

```text
On Fri, Sep 4, 2026 at 5:18 AM Song Liu [ref] wrote:
>
> On Thu, Sep 3, 2026 at 2:27 AM Petr Mladek [ref] wrote:
> [...]
> > > > Reasoning: The livepatch B replaces everything because it wants
> > > >         to be the only installed livepatch. It sounds weird
> > > >         to "break" it by installing A in parallel later again.
> > >
> > > So, let's just not treat '0' as a special case?
> >
> > I am not sure.
> >
> > I personally think that '0' should not be special. A better solution
> > for a forced cleanup is the "replace_all" module option.
>
> If we want '0' to be special, let's make it "not replace anything".
> Then folks who prefer to have all the live patch loaded at the
> same time have an easy solution.

Perhaps we should set aside the special handling of '0' for now. We
can always add it later if real use cases emerge.

>
> > The module option would need to be implemented in the livepatch code.
> > But it will need some support in the livepatch core as well, either
> > a flag in struct klp_patch or parameter in klp_enable_patch().
> > IMHO, the flag in struct klp_patch might be more practical.
>
> What is the use case of replace_all?

With provides/obsoletes, the default behavior is 'replace all' if the
user doesn't set any IDs, because there can only be one livepatch
enabled. However, if the user explicitly sets provides and obsoletes
IDs, they are expected to understand how this feature works.
Personally, I lean towards not adding this replace_all flag.

-- 
Regards
Yafang
```
