Re: How to recheck 'maxactive' ?

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

 



Hi Taeung,

On Sun, 22 Mar 2020 23:06:20 +0900
Taeung Song <treeze.taeung@xxxxxxxxx> 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@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 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@xxxxxxxxxx>



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux