linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"Tzvetomir Stoyanov" <tz.stoyanov@gmail.com>,
	Tom Zanussi <zanussi@kernel.org>
Subject: Re: [PATCH v7 07/10] tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs
Date: Thu, 19 Aug 2021 13:52:46 +0900	[thread overview]
Message-ID: <20210819135246.fbf2d4c7c248c9d4ce611b90@kernel.org> (raw)
In-Reply-To: <20210819041842.291622924@goodmis.org>

On Thu, 19 Aug 2021 00:13:28 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> In preparation to allow event probes to use the process_fetch_insn()
> callback in trace_probe_tmpl.h, change the data passed to it from a
> pointer to pt_regs, as the event probe will not be using regs, and make it
> a void pointer instead.

Yes, it is reasonable to be updated in the separated patch.

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

Thank you!

> 
> Update the process_fetch_insn() callers for kprobe and uprobe events to
> have the regs defined in the function and just typecast the void pointer
> parameter.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>  kernel/trace/trace_kprobe.c     | 3 ++-
>  kernel/trace/trace_probe_tmpl.h | 6 +++---
>  kernel/trace/trace_uprobe.c     | 3 ++-
>  3 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index c6fe7a6e3f35..4b013d24f5a9 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -1325,9 +1325,10 @@ probe_mem_read(void *dest, void *src, size_t size)
>  
>  /* Note that we don't verify it, since the code does not come from user space */
>  static int
> -process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
> +process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
>  		   void *base)
>  {
> +	struct pt_regs *regs = rec;
>  	unsigned long val;
>  
>  retry:
> diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
> index f003c5d02a3a..b3bdb8ddb862 100644
> --- a/kernel/trace/trace_probe_tmpl.h
> +++ b/kernel/trace/trace_probe_tmpl.h
> @@ -54,7 +54,7 @@ fetch_apply_bitfield(struct fetch_insn *code, void *buf)
>   * If dest is NULL, don't store result and return required dynamic data size.
>   */
>  static int
> -process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs,
> +process_fetch_insn(struct fetch_insn *code, void *rec,
>  		   void *dest, void *base);
>  static nokprobe_inline int fetch_store_strlen(unsigned long addr);
>  static nokprobe_inline int
> @@ -188,7 +188,7 @@ __get_data_size(struct trace_probe *tp, struct pt_regs *regs)
>  
>  /* Store the value of each argument */
>  static nokprobe_inline void
> -store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
> +store_trace_args(void *data, struct trace_probe *tp, void *rec,
>  		 int header_size, int maxlen)
>  {
>  	struct probe_arg *arg;
> @@ -203,7 +203,7 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
>  		/* Point the dynamic data area if needed */
>  		if (unlikely(arg->dynamic))
>  			*dl = make_data_loc(maxlen, dyndata - base);
> -		ret = process_fetch_insn(arg->code, regs, dl, base);
> +		ret = process_fetch_insn(arg->code, rec, dl, base);
>  		if (unlikely(ret < 0 && arg->dynamic)) {
>  			*dl = make_data_loc(0, dyndata - base);
>  		} else {
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index 09f8ca7f7ba0..d219ba50efbd 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -213,9 +213,10 @@ static unsigned long translate_user_vaddr(unsigned long file_offset)
>  
>  /* Note that we don't verify it, since the code does not come from user space */
>  static int
> -process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
> +process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,
>  		   void *base)
>  {
> +	struct pt_regs *regs = rec;
>  	unsigned long val;
>  
>  	/* 1st stage: get value from context */
> -- 
> 2.30.2


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2021-08-19  4:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  4:13 [PATCH v7 00/10] tracing: Creation of event probe Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 01/10] tracing: Add DYNAMIC flag for dynamic events Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 02/10] tracing: Have dynamic events have a ref counter Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 03/10] tracing/probe: Have traceprobe_parse_probe_arg() take a const arg Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 04/10] tracing/probes: Allow for dot delimiter as well as slash for system names Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 05/10] tracing/probes: Use struct_size() instead of defining custom macros Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 06/10] tracing/probe: Change traceprobe_set_print_fmt() to take a type Steven Rostedt
2021-08-19  4:51   ` Masami Hiramatsu
2021-08-19  4:13 ` [PATCH v7 07/10] tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs Steven Rostedt
2021-08-19  4:52   ` Masami Hiramatsu [this message]
2021-08-19  4:13 ` [PATCH v7 08/10] tracing: Add a probe that attaches to trace events Steven Rostedt
2021-08-19 10:22   ` Masami Hiramatsu
2021-08-19 10:26     ` [PATCH] tracing/probes: Reject events which have the same name of existing one Masami Hiramatsu
2021-08-19 12:53     ` [PATCH v7 08/10] tracing: Add a probe that attaches to trace events Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 09/10] selftests/ftrace: Add clear_dynamic_events() to test cases Steven Rostedt
2021-08-19 13:57   ` Steven Rostedt
2021-08-19  4:13 ` [PATCH v7 10/10] selftests/ftrace: Add selftest for testing eprobe events Steven Rostedt

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=20210819135246.fbf2d4c7c248c9d4ce611b90@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tz.stoyanov@gmail.com \
    --cc=zanussi@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).