Re: [PATCH v14 05/11] livepatch: Simplify API by removing registration step

From: Petr Mladek
Date: Tue Dec 04 2018 - 09:48:01 EST


On Tue 2018-12-04 13:54:55, Miroslav Benes wrote:
> > diff --git a/Documentation/livepatch/livepatch.txt b/Documentation/livepatch/livepatch.txt
> > index 2d7ed09dbd59..d849af312576 100644
> > --- a/Documentation/livepatch/livepatch.txt
> > +++ b/Documentation/livepatch/livepatch.txt
> > @@ -12,12 +12,11 @@ Table of Contents:
> > 4. Livepatch module
> > 4.1. New functions
> > 4.2. Metadata
> > - 4.3. Livepatch module handling
> > 5. Livepatch life-cycle
> > - 5.1. Registration
> > + 5.1. Loading
> > 5.2. Enabling
> > 5.3. Disabling
> > - 5.4. Unregistration
> > + 5.4. Removing
> > 6. Sysfs
> > 7. Limitations
> >
> > @@ -298,117 +297,91 @@ into three levels:
> > see the "Consistency model" section.
> >
> >
> > -4.3. Livepatch module handling
> > -------------------------------
> > -
> > -The usual behavior is that the new functions will get used when
> > -the livepatch module is loaded. For this, the module init() function
> > -has to register the patch (struct klp_patch) and enable it. See the
> > -section "Livepatch life-cycle" below for more details about these
> > -two operations.
> > -
> > -Module removal is only safe when there are no users of the underlying
> > -functions. This is the reason why the force feature permanently disables
> > -the removal. The forced tasks entered the functions but we cannot say
> > -that they returned back. Therefore it cannot be decided when the
> > -livepatch module can be safely removed. When the system is successfully
> > -transitioned to a new patch state (patched/unpatched) without being
> > -forced it is guaranteed that no task sleeps or runs in the old code.
>
> Is the change necessary? The documentation in v13 looked ok and I am not
> sure if it is better now. Only my opinion though and I understand why you
> changed it.

The huge rewrite was triggered by an innocent Josh's comment, see
https://lkml.kernel.org/r/20181017190657.dv3kwx467brzhdnz@treble

I made a big effort to rework the text. I wanted to explain the
difference between the module loading/unloading and the livepatch
enabling/disabling in a better structured and hopefully easier to
understand way.

It is possible that I failed. But let's put it the following way.
I refuse to do any other big rework of the documentation in this
patchset. If anyone has a better idea, please provide alternative
text or a patch.

Please, do not take it wrong. I really appreciate your review and
feedback. I am just a bit frustrated that my English or documentation
capabilities are not good enough. I am scared that the patchset might
get ready on v135 in 2025. And I will get a visit from
Mudr. Chocholousek [1] in the meantime.

[1] I am sorry for mentioning a person from a famous Czech film.
I was not able to find any good explanation in English.
I just found the following scene of the main character
that was later being chaised by Mudr. Chocholousek:
https://www.youtube.com/watch?v=NGjBlwHvs0Y


Best Regards,
Petr