linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Naveen N Rao <naveen@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-trace-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Srikar Dronamraju <srikar@linux.ibm.com>
Subject: Re: [PATCH v4] trace/kprobe: Display the actual notrace function when rejecting a probe
Date: Sun, 17 Dec 2023 16:18:01 +0900	[thread overview]
Message-ID: <20231217161801.ec0121c047c163a772cfce1c@kernel.org> (raw)
In-Reply-To: <20231214051702.1687300-1-naveen@kernel.org>

On Thu, 14 Dec 2023 10:47:02 +0530
Naveen N Rao <naveen@kernel.org> wrote:

> Trying to probe update_sd_lb_stats() using perf results in the below
> message in the kernel log:
> 	trace_kprobe: Could not probe notrace function _text
> 
> This is because 'perf probe' specifies the kprobe location as an offset
> from '_text':
> 	$ sudo perf probe -D update_sd_lb_stats
> 	p:probe/update_sd_lb_stats _text+1830728
> 
> However, the error message is misleading and doesn't help convey the
> actual notrace function that is being probed. Fix this by looking up the
> actual function name that is being probed. With this fix, we now get the
> below message in the kernel log:
> 	trace_kprobe: Could not probe notrace function update_sd_lb_stats.constprop.0
> 

OK, this looks good to me. let me pick this.

Thank you!

> Signed-off-by: Naveen N Rao <naveen@kernel.org>
> ---
> v4: Use printk format specifier %ps with probe address to lookup the 
> symbol, as suggested by Masami.
> 
>  kernel/trace/trace_kprobe.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 3d7a180a8427..0017404d6e8d 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -487,8 +487,8 @@ static int __register_trace_kprobe(struct trace_kprobe *tk)
>  		return -EINVAL;
>  
>  	if (within_notrace_func(tk)) {
> -		pr_warn("Could not probe notrace function %s\n",
> -			trace_kprobe_symbol(tk));
> +		pr_warn("Could not probe notrace function %ps\n",
> +			(void *)trace_kprobe_address(tk));
>  		return -EINVAL;
>  	}
>  
> 
> base-commit: 4758560fa268cecfa1144f015aa9f2525d164b7e
> -- 
> 2.43.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2023-12-17  7:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14  5:17 [PATCH v4] trace/kprobe: Display the actual notrace function when rejecting a probe Naveen N Rao
2023-12-17  7:18 ` 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=20231217161801.ec0121c047c163a772cfce1c@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=naveen@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.ibm.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).