linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Xiangyang Zhang <xyz.sun.ok@gmail.com>
Cc: rostedt@goodmis.org, mingo@redhat.com, mhiramat@kernel.org,
	oleg@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tracing/kprobes: 'nmissed' not showed correctly for kretprobe
Date: Sat, 8 Jan 2022 13:11:18 +0900	[thread overview]
Message-ID: <20220108131118.ed2d82a8a51ed1562676077c@kernel.org> (raw)
In-Reply-To: <20220107150242.5019-1-xyz.sun.ok@gmail.com>

On Fri,  7 Jan 2022 23:02:42 +0800
Xiangyang Zhang <xyz.sun.ok@gmail.com> wrote:

> 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.
> 

Thanks! This looks good to me.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

> Fixes: 4a846b443b4e ("tracing/kprobes: Cleanup kprobe tracer code")
> Signed-off-by: Xiangyang Zhang <xyz.sun.ok@gmail.com>
> ---
>  kernel/trace/trace_kprobe.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index f8c26ee72de3..3d85323278ed 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -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;
>  }
> -- 
> 2.25.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

      reply	other threads:[~2022-01-08  4:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 15:02 [PATCH v2] tracing/kprobes: 'nmissed' not showed correctly for kretprobe Xiangyang Zhang
2022-01-08  4:11 ` Masami Hiramatsu [this message]

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=20220108131118.ed2d82a8a51ed1562676077c@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=xyz.sun.ok@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).