From: Steven Rostedt <rostedt@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kbuild@vger.kernel.org, llvm@lists.linux.dev,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas.schier@linux.dev>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH v3 1/5] tracepoints: Add verifier that makes sure all defined tracepoints are used
Date: Tue, 22 Jul 2025 13:04:29 -0400 [thread overview]
Message-ID: <20250722130429.7418520b@batman.local.home> (raw)
In-Reply-To: <CAHk-=wihb6KVgU__zfhdHR=-Mqhp6qaAABdu31CJ2ML6MDj0dw@mail.gmail.com>
On Tue, 22 Jul 2025 09:16:49 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Tue, 22 Jul 2025 at 08:21, Steven Rostedt <rostedt@kernel.org> wrote:
> >
> > Add a verifier that injects a pointer to the tracepoint structure in the
> > functions that are used and added to a section called __tracepoint_check.
> > Then on boot up, iterate over this section and for every tracepoint
> > descriptor that is pointed to, update its ".funcs" field to (void *)1, as
> > the .funcs field is only set when a tracepoint is registered. At this
> > time, no tracepoints should be registered.
>
> Why?
>
> Doing this at runtime seems completely bass-ackwards.
>
> If you want to do this verification, why don't you do it at build-time?
The second patch does that, but is much more complex due to having to
parse the elf file. It hooks into the sorttable code as that already
does most of the parsing that was needed. It uses the same trick as the
runtime verifier by checking tracepoints against the __tracepoint_check
section (but not with the '.func' test, but instead it sorts it and
does a binary search).
I kept this to verify that the build time worked too, as the runtime
check is so much simpler and easier to implement. Basically, I use this
to verify that the build time works. That's why if you enable this it
will select the build time version. It was used to catch bugs in the
build version as I developed it.
And currently neither tests modules (I run this against an
allyesconfig), but the runtime version could easily be modified to test
modules too, whereas the build time would require adding another elf
parser as the sorttable isn't run on module code.
I can remove the runtime check if you prefer.
-- Steve
next prev parent reply other threads:[~2025-07-22 17:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 15:20 [PATCH v3 0/5] tracepoints: Add warnings for unused tracepoints and trace events Steven Rostedt
2025-07-22 15:20 ` [PATCH v3 1/5] tracepoints: Add verifier that makes sure all defined tracepoints are used Steven Rostedt
2025-07-22 16:16 ` Linus Torvalds
2025-07-22 17:04 ` Steven Rostedt [this message]
2025-07-22 18:12 ` Linus Torvalds
2025-07-22 15:20 ` [PATCH v3 2/5] tracing: sorttable: Add a tracepoint verification check at build time Steven Rostedt
2025-07-22 15:20 ` [PATCH v3 3/5] tracing: sorttable: Find unused tracepoints for arm64 that uses reloc for address Steven Rostedt
2025-07-22 15:20 ` [PATCH v3 4/5] tracepoint: Do not warn for unused event that is exported Steven Rostedt
2025-07-22 15:20 ` [PATCH v3 5/5] tracing: Call trace_ftrace_test_filter() for the event 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=20250722130429.7418520b@batman.local.home \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nicolas.schier@linux.dev \
--cc=torvalds@linux-foundation.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