tracing/kprobes: 'nmissed' not showed correctly for kretprobe
PATCH v2 1/1 tracing/kprobes: 'nmissed' not showed correctly for kretprobe
The 'nmissed' column of the 'kprobe_profile' file for kretprobe is not showed correctly, kretprobe can be skipped by two reasons, shortage of kretprobe_instance which is counted by tk->rp.nmissed, and kprobe itself is missed by some reason, so to show the sum.
Fixes 4a846b443b4e ("tracing/kprobes: Cleanup kprobe tracer code")
Signed-off-by Xiangyang Zhang <[email protected]>
--- kernel/trace/trace_kprobe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/trace/trace_kprobe.c +4 -1
@@ -1170,15 +1170,18 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) {struct dyn_event *ev = v;struct trace_kprobe *tk; +unsigned long nmissed;if (!is_trace_kprobe (ev))return 0 ; tk =to_trace_kprobe (ev); + nmissed =trace_kprobe_is_return (tk) ? + tk->rp.kp.nmissed + tk->rp.nmissed : tk->rp.kp.nmissed;seq_printf (m," %-44s %15lu %15lu\n" ,trace_probe_name (&tk->tp),trace_kprobe_nhit (tk), - tk->rp.kp.nmissed); + nmissed);return 0 ; }
Signature · 1 line
2.25.1
Quoted 5 lines · On Fri, 7 Jan 2022 23:02:42 +0800 Xiangyang Zhang <[email protected]> wrote:
The 'nmissed' column of the '
kprobe_profile' file for kretprobe is not showed correctly, kretprobe can be skipped by two reasons, shortage ofkretprobe_instancewhich is counted bytk->rp.nmissed, and kprobe itself is missed by some reason, so to show the sum.
Thanks! This looks good to me.
Acked-by Masami Hiramatsu <[email protected]>
Quoted 33 lines
Fixes 4a846b443b4e ("tracing/kprobes: Cleanup kprobe tracer code")Signed-off-by Xiangyang Zhang <[email protected]>--- kernel/trace/trace_kprobe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)kernel/trace/trace_kprobe.c +4
-1@@ -1170,15 +1170,18 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) {struct dyn_event *ev = v;struct trace_kprobe *tk; +unsigned long nmissed;if (!is_trace_kprobe (ev))return 0 ; tk =to_trace_kprobe (ev); + nmissed =trace_kprobe_is_return (tk) ? + tk->rp.kp.nmissed + tk->rp.nmissed : tk->rp.kp.nmissed;seq_printf (m," %-44s %15lu %15lu\n" ,trace_probe_name (&tk->tp),trace_kprobe_nhit (tk), - tk->rp.kp.nmissed); + nmissed);return 0 ; }Signature · 1 line
2.25.1
Signature · 1 line
Masami Hiramatsu <[email protected]>