[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <0BFE862C-BD2B-43D1-B926-11A48BBC8C1B@gmail.com>
Date: Wed, 14 Aug 2024 22:23:21 +0800
From: zhang warden <zhangwarden@...il.com>
To: Petr Mladek <pmladek@...e.com>
Cc: Josh Poimboeuf <jpoimboe@...nel.org>,
Miroslav Benes <mbenes@...e.cz>,
Jiri Kosina <jikos@...nel.org>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] livepatch: Add using attribute to klp_func for
using function show
> On Aug 14, 2024, at 00:05, Petr Mladek <pmladek@...e.com> wrote:
>
> Alternative solution would be to store the pointer of struct klp_ops
> *ops into struct klp_func. Then using_show() could just check if
> the related struct klp_func in on top of the stack.
>
> It would allow to remove the global list klp_ops and all the related
> code. klp_find_ops() would instead do:
>
> for_each_patch
> for_each_object
> for_each_func
>
> The search would need more code. But it would be simple and
> straightforward. We do this many times all over the code.
>
> IMHO, it would actually remove some complexity and be a win-win solution.
Hi Peter!
With your suggestions, it seems that you suggest move the klp_ops pinter into struct klp_func.
I may do this operation:
struct klp_func {
/* internal */
void *old_func;
struct kobject kobj;
struct list_head node;
struct list_head stack_node;
+ struct klp_ops *ops;
unsigned long old_size, new_size;
bool nop;
bool patched;
bool transition;
};
With this operation, klp_ops global list will no longer needed. And if we want the ftrace_ops of a function, we just need to get the ops member of klp_func eg, func->ops.
And klp_find_ops() will be replaced by `ops = func->ops`, which is more easy.
Is it right?
Best Regards.
Wardenjohn.
Powered by blists - more mailing lists