Re: [PATCH 1/2] trace/kprobe: Fix count of missed kretprobes in kprobe_profile

Masami Hiramatsu
2021-06-15T05:47:46Z

On Mon, 14 Jun 2021 23:33:28 +0530
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:

> For a kretprobe, the miss count includes the number of times the probe
> on function entry was missed, as well as the number of times we ran out
> of kretprobe_instance structures due to maxactive being too low.
>
> Fixes: cd7e7bd5e44718 ("tracing: Add kprobes event profiling interface")
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Good catch!

> ---
> kernel/trace/trace_kprobe.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index ea6178cb5e334d..0475e2a6d0825e 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -1192,7 +1192,8 @@ static int probes_profile_seq_show(struct seq_file *m, void *v)
> seq_printf(m, " %-44s %15lu %15lu\n",
> trace_probe_name(&tk->tp),
> trace_kprobe_nhit(tk),
> - tk->rp.kp.nmissed);
> + trace_kprobe_is_return(tk) ? tk->rp.kp.nmissed + tk->rp.nmissed
> + : tk->rp.kp.nmissed);

Can you add a static trace_kprobe_nmissed(tk) for wrapping this ?

Thank you,

>
> return 0;
> }
> --
> 2.31.1
>

--
Masami Hiramatsu <mhiramat@kernel.org>