netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH bpf v2 1/2] fprobe: samples: Add use_trace option and show hit/missed counter
Date: Fri, 17 Jun 2022 12:06:51 -0400	[thread overview]
Message-ID: <20220617120651.1e525a02@gandalf.local.home> (raw)
In-Reply-To: <165461826247.280167.11939123218334322352.stgit@devnote2>

On Wed,  8 Jun 2022 01:11:02 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

>  
>  static void sample_entry_handler(struct fprobe *fp, unsigned long ip, struct pt_regs *regs)
>  {
> -	pr_info("Enter <%pS> ip = 0x%p\n", (void *)ip, (void *)ip);
> +	if (use_trace)
> +		trace_printk("Enter <%pS> ip = 0x%p\n", (void *)ip, (void *)ip);

Could we add a comment stating something like "this is just an example, no
kernel code should call trace_printk() except when actively debugging".

-- Steve


> +	else
> +		pr_info("Enter <%pS> ip = 0x%p\n", (void *)ip, (void *)ip);
> +	nhit++;
>  	if (stackdump)
>  		show_backtrace();
>  }
> @@ -49,8 +56,13 @@ static void sample_exit_handler(struct fprobe *fp, unsigned long ip, struct pt_r
>  {
>  	unsigned long rip = instruction_pointer(regs);
>  
> -	pr_info("Return from <%pS> ip = 0x%p to rip = 0x%p (%pS)\n",
> -		(void *)ip, (void *)ip, (void *)rip, (void *)rip);
> +	if (use_trace)
> +		trace_printk("Return from <%pS> ip = 0x%p to rip = 0x%p (%pS)\n",
> +			(void *)ip, (void *)ip, (void *)rip, (void *)rip);
> +	else
> +		pr_info("Return from <%pS> ip = 0x%p to rip = 0x%p (%pS)\n",
> +			(void *)ip, (void *)ip, (void *)rip, (void *)rip);
> +	nhit++;
>  	if (stackdump)
>  		show_backtrace();

  reply	other threads:[~2022-06-17 16:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 16:10 [PATCH bpf v2 0/2] rethook: Reject getting a rethook if RCU is not watching Masami Hiramatsu (Google)
2022-06-07 16:11 ` [PATCH bpf v2 1/2] fprobe: samples: Add use_trace option and show hit/missed counter Masami Hiramatsu (Google)
2022-06-17 16:06   ` Steven Rostedt [this message]
2022-06-22  1:41     ` Masami Hiramatsu
2022-06-07 16:11 ` [PATCH bpf v2 2/2] rethook: Reject getting a rethook if RCU is not watching Masami Hiramatsu (Google)
2022-06-17 16:19   ` Steven Rostedt
2022-06-17 11:27 ` [PATCH bpf v2 0/2] " Jiri Olsa

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=20220617120651.1e525a02@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).