From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Song Liu <songliubraving@meta.com>
Cc: Petr Mladek <pmladek@suse.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Song Liu <song@kernel.org>,
"live-patching@vger.kernel.org" <live-patching@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"linux-trace-kernel@vger.kernel.org"
<linux-trace-kernel@vger.kernel.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
Joe Lawrence <joe.lawrence@redhat.com>,
Nathan Chancellor <nathan@kernel.org>,
"morbo@google.com" <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Leizhen <thunder.leizhen@huawei.com>,
"kees@kernel.org" <kees@kernel.org>,
Kernel Team <kernel-team@meta.com>,
Matthew Maurer <mmaurer@google.com>,
Sami Tolvanen <samitolvanen@google.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 2/3] kallsyms: Add APIs to match symbol without .llmv.<hash> suffix.
Date: Mon, 5 Aug 2024 21:53:40 +0900 [thread overview]
Message-ID: <20240805215340.1e647b9bb1f35af6bd4b909c@kernel.org> (raw)
In-Reply-To: <2F42C167-319A-46F2-A6C8-95B59F675D65@fb.com>
On Fri, 2 Aug 2024 17:09:12 +0000
Song Liu <songliubraving@meta.com> wrote:
> Hi Petr,
>
> > On Aug 2, 2024, at 8:45 AM, Petr Mladek <pmladek@suse.com> wrote:
>
> [...]
>
> >
> > IMHO, it depends on the use case. Let's keep "ping_table/"
> > as an example. Why people would want to trace this function?
> > There might be various reasons, for example:
> >
> > 1. ping_table.llvm.15394922576589127018 appeared in a backtrace
> >
> > 2. ping_table.llvm.15394922576589127018 appeared in a histogram
> >
> > 3. ping_table looks interesting when reading code sources
> >
> > 4. ping_table need to be monitored on all systems because
> > of security/performance.
> >
> > The full name "ping_table.llvm.15394922576589127018" is perfectly
> > fine in the 1st and 2nd scenario. People knew this name already
> > before they start thinking about tracing.
> >
> > The short name is more practical in 3rd and 4th scenario. Especially,
> > when there is only one static symbol with this short name. Otherwise,
> > the user would need an extra step to find the full name.
> >
> > The full name is even more problematic for system monitors. These
> > applications might need to probe particular symbols. They might
> > have hard times when the symbol is:
> >
> > <symbol_name_from_sources>.<random_suffix_generated_by_compiler>
> >
> > They will have to deal with it. But it means that every such tool
> > would need an extra (non-trivial) code for this. Every tool would
> > try its own approach => a lot of problems.
> >
> > IMHO, the two APIs could make the life easier.
> >
> > Well, even kprobe might need two APIs to allow probing by
> > full name or without the suffix.
>
> The problem is, with potential partial inlining by modern compilers,
> tracing "symbol name from sources" is not accurate. In our production
> kernels, we have to add some explicit "noline" to make sure we can
> trace these functions reliably.
>
> Of course, this issue exists without random suffix: any function
> could be partially inlined. However, allowing tracing without the
> suffix seems to hint that tracing with "symbol name from sources"
> is valid, which is not really true.
>
> At the moment, I have no objections to keep the _without_suffix
> APIs. But for long term, I still think we need to set clear
> expectations for the users: tracing symbols from sources is not
> reliable.
OK, I understand this part. I agree the problem. Even if the symbol
is unique on kallsyms (without suffix), it may have a suffix and is
not correct function entry.
I think to solve this issue, we need a better DWARF, or add a symbol
suffix like;
https://lkml.org/lkml/2023/12/4/1535
Thank you,
>
> Thanks,
> Song
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-08-05 12:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 0:54 [PATCH 0/3] Fix kallsyms with CONFIG_LTO_CLANG Song Liu
2024-07-30 0:54 ` [PATCH 1/3] kallsyms: Do not cleanup .llvm.<hash> suffix before sorting symbols Song Liu
2024-07-30 0:54 ` [PATCH 2/3] kallsyms: Add APIs to match symbol without .llmv.<hash> suffix Song Liu
2024-07-30 13:03 ` Masami Hiramatsu
2024-07-31 1:00 ` Song Liu
2024-08-02 1:18 ` Leizhen (ThunderTown)
2024-08-02 3:45 ` Song Liu
2024-08-02 6:53 ` Leizhen (ThunderTown)
2024-08-02 13:04 ` Masami Hiramatsu
2024-08-02 15:45 ` Petr Mladek
2024-08-02 17:09 ` Song Liu
2024-08-05 12:53 ` Masami Hiramatsu [this message]
2024-08-02 17:16 ` Song Liu
2024-07-30 0:54 ` [PATCH 3/3] tracing/kprobes: Use APIs that matches symbols with .llvm.<hash> suffix Song Liu
2024-07-30 13:04 ` Masami Hiramatsu
2024-07-31 1:09 ` Song Liu
2024-07-30 5:36 ` [PATCH 0/3] Fix kallsyms with CONFIG_LTO_CLANG Song Liu
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=20240805215340.1e647b9bb1f35af6bd4b909c@kernel.org \
--to=mhiramat@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mcgrof@kernel.org \
--cc=mmaurer@google.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
--cc=song@kernel.org \
--cc=songliubraving@meta.com \
--cc=thunder.leizhen@huawei.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).