linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [for-next][PATCH 0/3] tracing: Trigger a warning on build if a tracepoint is defined but unused
@ 2025-08-28 18:27 Steven Rostedt
  2025-08-28 18:27 ` [for-next][PATCH 1/3] sorttable: Move ELF parsing into scripts/elf-parse.[ch] Steven Rostedt
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Steven Rostedt @ 2025-08-28 18:27 UTC (permalink / raw)
  To: linux-kernel, Stephen Rothwell
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Linus Torvalds


Stephen,

I plan on pushing this to my for-next branch, which will add this to the
linux-next tree. When the kconfig option "TRACEPOINT_WARN_ON_UNUSED" is
enabled, it will warn whenever a tracepoint is created but not used. This is
similar to adding a static variable or function and not using it. This means
that an allmodconfig and allyesconfig builds may start having warnings that
will get bisected down to this commit. The bug is not this commit though, but
whatever has created an event but never used it. As tracepoints can take up to
5K of memory, even when not used, this is a waste and should be fixed.

I hope that adding this to linux-next will start the push to clean up these
unused tracepoints that are in the kernel, as well as prevent new ones from
being added. Hopefully by the time the merge window rolls around, most of
these will be cleaned up and this can be merged upstream without triggering
warnings.

I built this against all archs in my tree (26 of them) with a allyesconfig.
Unfortunately, only 10 build successfully with that (they all build
successfully with defconfig and this option with tracing enabled). This
detected 178 unique tracepoints that are defined and not used:

$ grep '^warning:' /work/autotest/cross-unused-traceevnts.log | sort -u |wc -l
178

Among them, 78 tracepoints were created and never referenced.

$ grep '^warning:' /work/autotest/cross-unused-traceevents.log | sort -u |cut -d"'" -f2 |
    while read a ; do if ! git grep -q trace_$a ; then echo $a; fi ; done | wc -l
78

The 100 remaining are likely in strange #ifdef CONFIG combinations where an
allyesconfig defines the tracepoint but doesn't enable the code that uses
them.

Expect even more warnings with different combos of config settings, as this
will warn whenever a tracepoint is defined but not used.

-- Steve

  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
unused-tracepoints/for-next

Head SHA1: d492e79ec6892ce1928a4c929ea29c0d5986e117


Steven Rostedt (3):
      sorttable: Move ELF parsing into scripts/elf-parse.[ch]
      tracing: Add a tracepoint verification check at build time
      tracepoint: Do not warn for unused event that is exported

----
 include/asm-generic/vmlinux.lds.h |   1 +
 include/linux/tracepoint.h        |  12 +
 kernel/trace/Kconfig              |  10 +
 scripts/Makefile                  |   6 +
 scripts/Makefile.vmlinux          |   2 +
 scripts/elf-parse.c               | 198 ++++++++++++++++
 scripts/elf-parse.h               | 305 ++++++++++++++++++++++++
 scripts/link-vmlinux.sh           |   4 +
 scripts/sorttable.c               | 477 +++-----------------------------------
 scripts/tracepoint-update.c       | 232 ++++++++++++++++++
 10 files changed, 804 insertions(+), 443 deletions(-)
 create mode 100644 scripts/elf-parse.c
 create mode 100644 scripts/elf-parse.h
 create mode 100644 scripts/tracepoint-update.c

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-08-29 12:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 18:27 [for-next][PATCH 0/3] tracing: Trigger a warning on build if a tracepoint is defined but unused Steven Rostedt
2025-08-28 18:27 ` [for-next][PATCH 1/3] sorttable: Move ELF parsing into scripts/elf-parse.[ch] Steven Rostedt
2025-08-28 19:03   ` Nicolas Schier
2025-08-28 19:36     ` Steven Rostedt
2025-08-28 18:27 ` [for-next][PATCH 2/3] tracing: Add a tracepoint verification check at build time Steven Rostedt
2025-08-28 18:27 ` [for-next][PATCH 3/3] tracepoint: Do not warn for unused event that is exported Steven Rostedt
2025-08-28 21:02 ` [for-next][PATCH 0/3] tracing: Trigger a warning on build if a tracepoint is defined but unused Stephen Rothwell
2025-08-28 21:13   ` Steven Rostedt
2025-08-29 12:10   ` Steven Rostedt

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).