linux-trace-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Taeung Song <treeze.taeung@gmail.com>
Cc: linux-trace-users@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: How to recheck 'maxactive' ?
Date: Mon, 23 Mar 2020 15:47:41 +0900	[thread overview]
Message-ID: <20200323154741.0643126b3684c950bb37bf7e@kernel.org> (raw)
In-Reply-To: <4762764a-6df7-bc93-ed60-e336146dce1f@gmail.com>

Hi Taeung,

On Sun, 22 Mar 2020 23:06:20 +0900
Taeung Song <treeze.taeung@gmail.com> wrote:

> Hi,
> 
> After setting 'maxactive' for kretprobe,
> how can I recheck the value of 'maxactive' ?
> For example, in order to distinguish the difference
> between two kretprobe events
> (kmem_cache_alloc_node and kmem_cache_alloc_node10)
> 
>    $ cd /sys/kernel/debug/tracing
>    $ echo 'r:kmem_cache_alloc_node kmem_cache_alloc_node' >> kprobe_events
>    $ echo 'r10:kmem_cache_alloc_node10 kmem_cache_alloc_node' >> 
> kprobe_events
> 
>    $ cat kprobe_events
>    r:kprobes/kmem_cache_alloc_node kmem_cache_alloc_node
>    r:kprobes/kmem_cache_alloc_node10 kmem_cache_alloc_node

Oops! good catch. That must be a bug, since the kprobe_events design policy
is to support following operation.

$ cat kprobe_events > /etc/event_setting
(reboot)
$ cat /etc/event_setting > kprobe_events

What about below patch?

From 935ed56819f2bfb7ac977f5c63273c9a6e3dfb42 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <mhiramat@kernel.org>
Date: Mon, 23 Mar 2020 10:57:48 +0900
Subject: [PATCH] ftrace/kprobe: Show the maxactive number on kprobe_events

Show maxactive parameter on kprobe_events.
This allows user to save the current configuration and
restore it without losing maxactive parameter.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/trace/trace_kprobe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 362cca52f5de..d0568af4a0ef 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1078,6 +1078,8 @@ static int trace_kprobe_show(struct seq_file *m, struct dyn_event *ev)
 	int i;
 
 	seq_putc(m, trace_kprobe_is_return(tk) ? 'r' : 'p');
+	if (trace_kprobe_is_return(tk) && tk->rp.maxactive)
+		seq_printf(m, "%d", tk->rp.maxactive);
 	seq_printf(m, ":%s/%s", trace_probe_group_name(&tk->tp),
 				trace_probe_name(&tk->tp));
 
-- 
2.20.1


Thank you,


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2020-03-23  6:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 14:06 How to recheck 'maxactive' ? Taeung Song
2020-03-23  6:47 ` Masami Hiramatsu [this message]
2020-03-23 12:54   ` Taeung Song
2020-03-23 13:04   ` Steven Rostedt
2020-03-24  6:40     ` Masami Hiramatsu

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=20200323154741.0643126b3684c950bb37bf7e@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-trace-users@vger.kernel.org \
    --cc=treeze.taeung@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;
as well as URLs for NNTP newsgroup(s).