From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Masahiro Yamada <masahiroy@kernel.org>
Subject: [for-linus][PATCH] tracing: Fix unused tracepoints when module uses only exported ones
Date: Mon, 8 Dec 2025 19:19:30 -0500 [thread overview]
Message-ID: <20251208191930.53a5a820@debian> (raw)
tracing fix for v6.19:
- Fix unused tracepoint build for modules only using exported tracepoints
The tracepoint-update.c code that looks for unused tracepoints expects
if tracepoints are used then it will have tracepoints defined. If
not, it errors out which fails the build.
In most cases this the way things work. A tracepoint can't be used if
it is not defined. There is one exception. If a module only uses
tracepoints that are defined in other modules or the vmlinux proper,
where the tracepoints are exported. In this case, the
tracepoint-update.c code thinks tracepoints are used but not defined
and errors out, failing the build.
When tracepoint-update.c detects this case, if it is a module that is
being processed, exit out normally as it is a legitimate case.
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes
Head SHA1: 0c5d252a7cb0073f475be389a523de2095973dd2
Steven Rostedt (1):
tracing: Fix unused tracepoints when module uses only exported ones
----
scripts/tracepoint-update.c | 3 +++
1 file changed, 3 insertions(+)
---------------------------
commit 0c5d252a7cb0073f475be389a523de2095973dd2
Author: Steven Rostedt <rostedt@goodmis.org>
Date: Mon Dec 8 08:53:36 2025 -0500
tracing: Fix unused tracepoints when module uses only exported ones
Building the KVM intel module failed to build with UT=1:
no __tracepoint_strings in file: arch/x86/kvm/kvm-intel.o
make[3]: *** [/work/git/test-linux.git/scripts/Makefile.modfinal:62: arch/x86/kvm/kvm-intel.ko] Error 1
The reason is that the module only uses the tracepoints defined and
exported by the main kvm module. The tracepoint-udpate.c code fails the
build if a tracepoint is used, but there's no tracepoints defined. But
this is acceptable in modules if the tracepoints is defined in the vmlinux
proper or another module and exported.
Do not fail to build if a tracepoint is used but no tracepoints are
defined if the code is a module. This should still never happen for the
vmlinux itself.
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Link: https://patch.msgid.link/20251208085336.6658743c@debian
Fixes: e30f8e61e2518 ("tracing: Add a tracepoint verification check at build time")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
diff --git a/scripts/tracepoint-update.c b/scripts/tracepoint-update.c
index 7f7d90df14ce..90046aedc97b 100644
--- a/scripts/tracepoint-update.c
+++ b/scripts/tracepoint-update.c
@@ -210,6 +210,9 @@ static int process_tracepoints(bool mod, void *addr, const char *fname)
}
if (!tracepoint_data_sec) {
+ /* A module may reference only exported tracepoints */
+ if (mod)
+ return 0;
fprintf(stderr, "no __tracepoint_strings in file: %s\n", fname);
return -1;
}
reply other threads:[~2025-12-09 0:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251208191930.53a5a820@debian \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@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