From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
Primiano Tucci <primiano@google.com>
Subject: Re: [PATCH 1/2] tracing/probes: Add symstr type for dynamic events
Date: Thu, 27 Oct 2022 00:42:34 +0900 [thread overview]
Message-ID: <20221027004234.6f3097f4bf4a18dfddf9ae56@kernel.org> (raw)
In-Reply-To: <166642073074.718058.9841757174640040227.stgit@mhiramat.roam.corp.google.com>
On Sat, 22 Oct 2022 15:38:50 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Add 'symstr' type for storing the kernel symbol as a string data
> instead of the symbol address. This allows us to filter the
> events by wildcard symbol name.
>
> e.g.
> # echo 'e:wqfunc workqueue.workqueue_execute_start symname=$function:symstr' >> dynamic_events
> # cat events/eprobes/wqfunc/format
> name: wqfunc
> ID: 2110
> format:
> field:unsigned short common_type; offset:0; size:2; signed:0;
> field:unsigned char common_flags; offset:2; size:1; signed:0;
> field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
> field:int common_pid; offset:4; size:4; signed:1;
>
> field:__data_loc char[] symname; offset:8; size:4; signed:1;
>
> print fmt: " symname=\"%s\"", __get_str(symname)
>
> Note that there is already 'symbol' type which just change the
> print format (so it still stores the symbol address in the tracing
> ring buffer.) On the other hand, 'symstr' type stores the actual
> "symbol+offset/size" data as a string.
>
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---
[...]
> diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
> index b3bdb8ddb862..d57a3143929a 100644
> --- a/kernel/trace/trace_probe_tmpl.h
> +++ b/kernel/trace/trace_probe_tmpl.h
> @@ -67,6 +67,37 @@ probe_mem_read(void *dest, void *src, size_t size);
> static nokprobe_inline int
> probe_mem_read_user(void *dest, void *src, size_t size);
>
> +static nokprobe_inline int
> +fetch_store_symstrlen(unsigned long addr)
> +{
> + char namebuf[KSYM_SYMBOL_LEN];
> + int ret;
> +
> + ret = sprint_symbol(namebuf, addr);
> + if (ret < 0)
> + return 0;
> +
> + return strlen(namebuf) + 1;
Ah, sprint_symbol() returns the length. This strlen() is redundant.
Let me update the patch.
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2022-10-26 15:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-22 6:38 [PATCH 0/2] tracing/probes: Add 'symstr' type for probes Masami Hiramatsu (Google)
2022-10-22 6:38 ` [PATCH 1/2] tracing/probes: Add symstr type for dynamic events Masami Hiramatsu (Google)
2022-10-26 15:42 ` Masami Hiramatsu [this message]
2022-10-22 6:38 ` [PATCH 2/2] tracing/probes: Reject symbol/symstr type for uprobe Masami Hiramatsu (Google)
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=20221027004234.6f3097f4bf4a18dfddf9ae56@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=primiano@google.com \
--cc=rostedt@goodmis.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).