From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kbuild@vger.kernel.org
Cc: 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>,
Linus Torvalds <torvalds@linux-foundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH v10 5/5] tracing: Add warnings for unused tracepoints for modules
Date: Tue, 21 Oct 2025 20:43:43 -0400 [thread overview]
Message-ID: <20251022004453.422000794@kernel.org> (raw)
In-Reply-To: 20251022004338.731044739@kernel.org
From: Steven Rostedt <rostedt@goodmis.org>
If a modules has TRACE_EVENT() but does not use it, add a warning about it
at build time.
Currently, the build must be made by adding "UT=1" to the make command
line in order for this to trigger.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Changes since v9: https://lore.kernel.org/20251015203924.731213165@kernel.org
- Remove use of "" in Makefile script (Nathan Chancellor)
- Use $(objtree) instead of ${obtree} (Nathan Chancellor)
- Move the update to tracepoint-update.c to a separate patch
(Nathan Chancellor)
- Remove unneeded "else" block for cmd_check_tracepoint define
(Nicolas Schier)
- Added use of "--module" parameter.
scripts/Makefile.modfinal | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index 542ba462ed3e..149e12ff5700 100644
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -28,6 +28,10 @@ ccflags-remove-y := $(CC_FLAGS_CFI)
.module-common.o: $(srctree)/scripts/module-common.c FORCE
$(call if_changed_rule,cc_o_c)
+ifneq ($(WARN_ON_UNUSED_TRACEPOINTS),)
+cmd_check_tracepoint = $(objtree)/scripts/tracepoint-update --module $<;
+endif
+
quiet_cmd_ld_ko_o = LD [M] $@
cmd_ld_ko_o = \
$(LD) -r $(KBUILD_LDFLAGS) \
@@ -57,6 +61,7 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
+$(if $(newer-prereqs),$(call cmd,btf_ko))
endif
+ +$(call cmd,check_tracepoint)
targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) .module-common.o
--
2.51.0
prev parent reply other threads:[~2025-10-22 0:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 0:43 [PATCH v10 0/5] tracepoints: Add warnings for unused tracepoints and trace events Steven Rostedt
2025-10-22 0:43 ` [PATCH v10 1/5] sorttable: Move ELF parsing into scripts/elf-parse.[ch] Steven Rostedt
2025-10-22 0:43 ` [PATCH v10 2/5] tracing: Add a tracepoint verification check at build time Steven Rostedt
2025-10-22 0:43 ` [PATCH v10 3/5] tracepoint: Do not warn for unused event that is exported Steven Rostedt
2025-10-22 0:43 ` [PATCH v10 4/5] tracing: Allow tracepoint-update.c to work with modules Steven Rostedt
2025-10-22 0:43 ` Steven Rostedt [this message]
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=20251022004453.422000794@kernel.org \
--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=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=rdunlap@infradead.org \
--cc=sfr@canb.auug.org.au \
--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