mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miroslav Benes <mbenes@suse.cz>
To: Song Liu <song@kernel.org>
Cc: Petr Mladek <pmladek@suse.com>,
	zhang warden <zhangwarden@gmail.com>,
	 Josh Poimboeuf <jpoimboe@kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	 Joe Lawrence <joe.lawrence@redhat.com>,
	live-patching@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] livepatch: introduce klp_func called interface
Date: Fri, 7 Jun 2024 11:07:36 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.21.2406071102420.29080@pobox.suse.cz> (raw)
In-Reply-To: <CAPhsuW7bjyLvfQ-ysKE+S8x26Zv5b7jbJoyW8UiBaUfaRncKfg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]

Hi,

On Tue, 4 Jun 2024, Song Liu wrote:

> On Tue, May 21, 2024 at 1:04 AM Petr Mladek <pmladek@suse.com> wrote:
> [...]
> > >
> > > Yes, but the information you get is limited compared to what is available
> > > now. You would obtain the information that a patched function was called
> > > but ftrace could also give you the context and more.
> >
> > Another motivation to use ftrace for testing is that it does not
> > affect the performance in production.
> >
> > We should keep klp_ftrace_handler() as fast as possible so that we
> > could livepatch also performance sensitive functions.
> 
> At LPC last year, we discussed about adding a counter to each
> klp_func, like:
> 
> struct klp_func {
>     ...
>     u64 __percpu counter;
>     ...
> };
> 
> With some static_key (+ sysctl), this should give us a way to estimate
> the overhead of livepatch. If we have the counter, this patch is not
> needed any more. Does this (adding the counter) sound like
> something we still want to pursue?

It would be better than this patch but given what was mentioned in the 
thread I wonder if it is possible to use ftrace even for this. See 
/sys/kernel/tracing/trace_stat/function*. It already gathers the number of 
hits.

Would it be sufficient for you? I guess it depends on what the intention 
is. If there is no time limit, klp_func.counter might be better to provide 
some kind of overall statistics (but I am not sure if it has any value) 
and to avoid having ftrace registered on a live patched function for 
infinite period of time. If the intention is to gather data for some 
limited period, trace_stat sounds like much better approach to me.

Regards
Miroslav

  reply	other threads:[~2024-06-07  9:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20  0:58 Wardenjohn
2024-05-20  6:46 ` Miroslav Benes
2024-05-20  7:10   ` zhang warden
2024-05-21  6:34     ` Miroslav Benes
2024-05-21  8:04       ` Petr Mladek
2024-05-24  8:09         ` zhang warden
2024-05-31  2:16         ` zhang warden
2024-05-31  7:21           ` Miroslav Benes
2024-05-31 13:19             ` zhang warden
2024-05-31 14:06               ` Miroslav Benes
2024-06-04  8:17                 ` zhang warden
2024-06-05  5:04         ` Song Liu
2024-06-07  9:07           ` Miroslav Benes [this message]
2024-06-07 16:59             ` Song Liu
2024-06-11  2:23               ` zhang warden
2024-06-20  3:39             ` zhang warden
2024-06-20  9:31               ` Miroslav Benes
2024-05-31 19:16       ` Joe Lawrence
2024-06-04  8:14         ` zhang warden
2024-06-04 11:01           ` zhang warden
2024-06-04 14:37           ` Joe Lawrence
2024-06-05  2:38             ` zhang warden
2024-06-06 15:01               ` Joe Lawrence
2024-06-07  2:26                 ` zhang warden
2024-05-20  8:00 ` Markus Elfring
2024-05-20  9:34   ` zhang warden
  -- strict thread matches above, loose matches on Subject: below --
2024-05-19  7:43 Wardenjohn
2024-05-19 18:05 ` Markus Elfring
2024-05-19 23:42   ` zhang warden
2024-05-23 14:22 ` Dan Carpenter
2024-05-24  8:12   ` zhang warden

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=alpine.LSU.2.21.2406071102420.29080@pobox.suse.cz \
    --to=mbenes@suse.cz \
    --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=pmladek@suse.com \
    --cc=song@kernel.org \
    --cc=zhangwarden@gmail.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®