Re: [PATCH V3 1/1] livepatch: Add "stack_order" sysfs attribute

From: Josh Poimboeuf
Date: Mon Sep 30 2024 - 19:26:12 EST


On Sun, Sep 29, 2024 at 10:43:34PM +0800, Wardenjohn wrote:
> Add "stack_order" sysfs attribute which holds the order in which a live
> patch module was loaded into the system. A user can then determine an
> active live patched version of a function.
>
> cat /sys/kernel/livepatch/livepatch_1/stack_order -> 1
>
> means that livepatch_1 is the first live patch applied
>
> cat /sys/kernel/livepatch/livepatch_module/stack_order -> N
>
> means that livepatch_module is the Nth live patch applied
>
> Suggested-by: Petr Mladek <pmladek@xxxxxxxx>
> Suggested-by: Miroslav Benes <mbenes@xxxxxxx>
> Suggested-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> Signed-off-by: Wardenjohn <zhangwarden@xxxxxxxxx>
> ---
> .../ABI/testing/sysfs-kernel-livepatch | 8 ++++++
> kernel/livepatch/core.c | 25 +++++++++++++++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch b/Documentation/ABI/testing/sysfs-kernel-livepatch
> index a5df9b4910dc..2a60b49aa9a5 100644
> --- a/Documentation/ABI/testing/sysfs-kernel-livepatch
> +++ b/Documentation/ABI/testing/sysfs-kernel-livepatch
> @@ -47,6 +47,14 @@ Description:
> disabled when the feature is used. See
> Documentation/livepatch/livepatch.rst for more information.
>
> +What: /sys/kernel/livepatch/<patch>/stack_order
> +Date: Sep 2024
> +KernelVersion: 6.12.0

These will probably need to be updated (can probably be done by Petr when
applying).

> +Contact: live-patching@xxxxxxxxxxxxxxx
> +Description:
> + This attribute holds the stack order of a livepatch module applied
> + to the running system.

It's probably a good idea to clarify what "stack order" means. Also,
try to keep the text under 80 columns for consistency.

How about:

This attribute indicates the order the patch was applied
compared to other patches. For example, a stack_order value of
'2' indicates the patch was applied after the patch with stack
order '1' and before any other currently applied patches.

--
Josh