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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Aug 14, 2024, at 00:05, Petr Mladek <pmladek@xxxxxxxx> 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.








[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux