From: Daniel Wagner <dwagner@suse.de>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
linux-trace-kernel@vger.kernel.org
Subject: Re: kprobe not always triggering
Date: Thu, 16 Jan 2025 13:04:18 +0100 [thread overview]
Message-ID: <35dbe779-e7c1-48ef-8e76-86092d77a199@flourine.local> (raw)
In-Reply-To: <20250116084818.2160d4faf29cf34c9b6e612f@kernel.org>
On Thu, Jan 16, 2025 at 08:48:18AM +0900, Masami Hiramatsu wrote:
> Have you tried to use `perf probe`? Even if it is inlined, you can find them
> by
>
> perf probe -a nvme_change_ctrl_state new_state
I had to build my own perf, as the version from the distro didn't like
my kernel and just crashed. Thus I added a bunch libraries to my build
system. The resulting perf installed the probe and the missing events
show up:
<idle>-0 [000] ..s1. 245.406139: nvme_complete_rq: nvme1: qid=0, cmdid=36865, res=0x0, retries=0, flags=0x0, status=0x371
<idle>-0 [000] .Ns1. 245.407192: nvme_change_ctrl_state: (nvme_change_ctrl_state+0x0/0x180 [nvme_core]) new_state=0x2
kworker/u33:0-65 [000] .N... 245.407258: nvme_change_ctrl_state: (nvme_change_ctrl_state+0x0/0x180 [nvme_core]) new_state=0x2
kworker/u33:1-78 [000] ..... 245.421290: nvme_change_ctrl_state: (nvme_change_ctrl_state+0x0/0x180 [nvme_core]) new_state=0x3
I double checked my previous setup with kprobes and now the missing
events show up as well. It looks like my setup changes makes clang to
not inline this function anymore, or there is no additional debug info
available?
> But perhaps, some of them are inlined with constant numbers (maybe you can
> find them as nvme_change_ctrl_state.constprop.XXX in kallsyms)
# cat /proc/kallsyms | grep nvme_change_ctrl_state
ffffffffc03dc04d r __kstrtab_nvme_change_ctrl_state [nvme_core]
ffffffffc03dc064 r __kstrtabns_nvme_change_ctrl_state [nvme_core]
ffffffffc03ca130 r __ksymtab_nvme_change_ctrl_state [nvme_core]
ffffffffc0405de0 t __pfx_nvme_change_ctrl_state [nvme_core]
ffffffffc0405df0 t nvme_change_ctrl_state [nvme_core]
This is with the new kernel, so after installing the libraries for the
perf build.
> If my guess is correct, it is not inlined but the constant propagation
> optimization[1] has been done by the compiler.
>
> [1] https://en.wikipedia.org/wiki/Constant_folding#Constant_propagation
>
> IIRC, commit 66f69b219716 ("perf probe: Support DW_AT_const_value constant value")
> should support this case.
Okay, this commit is already in (v5.4), so it was always in.
Anyway, I can't reproduce anymore.
Daniel
next prev parent reply other threads:[~2025-01-16 12:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 8:26 kprobe not always triggering Daniel Wagner
2025-01-15 15:17 ` Steven Rostedt
2025-01-15 16:29 ` Daniel Wagner
2025-01-15 16:37 ` Steven Rostedt
2025-01-15 16:50 ` Daniel Wagner
2025-01-15 23:48 ` Masami Hiramatsu
2025-01-16 12:04 ` Daniel Wagner [this message]
2025-01-17 8:52 ` Masami Hiramatsu
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=35dbe779-e7c1-48ef-8e76-86092d77a199@flourine.local \
--to=dwagner@suse.de \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--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