mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zhang warden <zhangwarden@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>, Jiri Kosina <jikos@kernel.org>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] livepatch: Add using attribute to klp_func for using function show
Date: Wed, 14 Aug 2024 22:23:21 +0800	[thread overview]
Message-ID: <0BFE862C-BD2B-43D1-B926-11A48BBC8C1B@gmail.com> (raw)
In-Reply-To: <ZruEPvstxgBQwN1K@pathway.suse.cz>



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




  parent reply	other threads:[~2024-08-14 14:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05  6:46 [PATCH v2 0/1] livepatch: Add using attribute to klp_func for using function zhangyongde.zyd
2024-08-05  6:46 ` [PATCH v2 1/1] livepatch: Add using attribute to klp_func for using function show zhangyongde.zyd
2024-08-06 15:21   ` zhang warden
2024-08-13  3:53   ` zhang warden
2024-08-13 16:05   ` Petr Mladek
2024-08-14  2:32     ` zhang warden
2024-08-14 14:23     ` zhang warden [this message]
2024-08-15  9:20       ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0BFE862C-BD2B-43D1-B926-11A48BBC8C1B@gmail.com \
    --to=zhangwarden@gmail.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®