Re: [PATCH v2 1/1] livepatch: Add using attribute to klp_func for using function show

From: zhang warden
Date: Mon Aug 12 2024 - 23:54:15 EST




> On Aug 5, 2024, at 14:46, zhangyongde.zyd <zhangwarden@xxxxxxxxx> wrote:
>
> From: Wardenjohn <zhangwarden@xxxxxxxxx>
>
> One system may contains more than one livepatch module. We can see
> which patch is enabled. If some patches applied to one system
> modifing the same function, livepatch will use the function enabled
> on top of the function stack. However, we can not excatly know
> which function of which patch is now enabling.
>
> This patch introduce one sysfs attribute of "using" to klp_func.
> For example, if there are serval patches make changes to function
> "meminfo_proc_show", the attribute "enabled" of all the patch is 1.
> With this attribute, we can easily know the version enabling belongs
> to which patch.
>
> The "using" is set as three state. 0 is disabled, it means that this
> version of function is not used. 1 is running, it means that this
> version of function is now running. -1 is unknown, it means that
> this version of function is under transition, some task is still
> chaning their running version of this function.
>
> cat /sys/kernel/livepatch/<patch1>/<object1>/<function1,sympos>/using -> 0
> means that the function1 of patch1 is disabled.
>
> cat /sys/kernel/livepatch/<patchN>/<object1>/<function1,sympos>/using -> 1
> means that the function1 of patchN is enabled.
>
> cat /sys/kernel/livepatch/<patchN>/<object1>/<function1,sympos>/using -> -1
> means that the function1 of patchN is under transition and unknown.
>
> Signed-off-by: Wardenjohn <zhangwarden@xxxxxxxxx>
>

Hi maintainers. How about your suggestions to patch V2?

According to your suggestion, I made some new changes to the V1 patch.

I am waiting for your suggestions.

Thanks.
Wardenjohn.