From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 898CE218E91 for ; Sat, 20 Jun 2026 22:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781994021; cv=none; b=ltlN8yK2HX2hddb3DKMwRv04fsA6pmKYqi8o8vxMerVlr0iPNPGbYTZLSmSxZfBIZ/j3p0c3f0BbYmFKqFNyhJu9jHBB8CltO1c5JssAVKuBAyQQmIe/YtwF6X2l40LqQXkRbxePTNSG6K3YfoJrDmETwykiLOJ9yOQtpBCUtxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781994021; c=relaxed/simple; bh=zs68Gh7JKhw5XL1UE2SgKUGM2QHO3W6RE+AGV5YzSyQ=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jxriUGYx4mUPYa2mR1C9M3qo2HAQNOj5jfUt6+Pq2Pmf1o9NbOReyPWmij+djEtirW+u6L5L1EhJoCw+FtV3zZFXxP/QgkhDa76wI6iQ3KlvEmI2rEoYoW9qE9LZWwNj4Ys44WMj0nPS+4qiECqQoWt8/jcLFqGoFHFJJChjDc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org; spf=pass smtp.mailfrom=goodmis.org; arc=none smtp.client-ip=216.40.44.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=goodmis.org Received: from omf02.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 740061A0293; Sat, 20 Jun 2026 22:20:09 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: rostedt@goodmis.org) by omf02.hostedemail.com (Postfix) with ESMTPA id 42BDA8000E; Sat, 20 Jun 2026 22:20:01 +0000 (UTC) Date: Sat, 20 Jun 2026 18:19:57 -0400 From: Steven Rostedt To: Linus Torvalds Cc: Yury Norov , LKML , Masami Hiramatsu , Mathieu Desnoyers , Ao Sun , David Carlier , Karl Mehltretter , Martin Kaiser , Pengpeng Hou , Qian-Yu Lin , Rik van Riel , Rosen Penev , Shuvam Pandey , Vineeth Pillai , Yash Suthar , Yu Peng , Sebastian Andrzej Siewior , Thomas Gleixner , Peter Zijlstra Subject: Re: [GIT PULL] tracing: Updates for 7.2 Message-ID: <20260620181957.115d662c@fedora> In-Reply-To: References: <20260616180122.57a3b426@fedora> <20260619081513.3e4a1fb0@fedora> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: 5z5yfh75xkh3pbao1rk4n437tenqc4ib X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: 42BDA8000E X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Session-ID: U2FsdGVkX193k71VnM5iQFd5nrrG67TDG2/dbFZAF6A= X-HE-Tag: 1781994001-39991 X-HE-Meta: U2FsdGVkX1/hJC1SxTHB5FKK6kqjUowdQTxKSSDLytA8cmfYmmORuZ4DF2pDw3KLR7NQjXE+6JiNn/xZyjpue8IS9oGZji7pYIjUXhjEK6YtY3XuNFSGiQDI1otyVyqdblKKrl4QY2id8QnYloWdvWetB/KJ8YjIUlKtCh6E9MZoom9OfTnwEf+DzSwrjtAleGCtY5Jp5NHm1tF5vtFJM6bT+mPZjLPbNNlsjiiFBrMkc0zJw0Glb+Lx4QhCyEYXq/p5Ii/YMCGxnS32pNi9koqoUBh1jDBswBI89ihpbzcjurxssfRmICVXiuekIoovO5sg2eaOR5Qlu8clpZ8dPjO6Jj0qFTfZlOTK9HMGG930yOmb6Jm6QEgfrhwS4iRe0y1RJrK5cd5TXC6EQEKUQK7AtKgKti0+ On Fri, 19 Jun 2026 07:35:15 -0700 Linus Torvalds wrote: > The two are not the same: > > $ git grep -wl printk | wc -l > 3212 > $ git grep -wl trace_printk | wc -l > 50 > > and making them sound remotely similar is just making you look dishonst. > > Look, the attached patch makes my defconfig build cleanly, and makes a > > $ touch include/linux/trace_printk.h > > cause my recompile to build just a handful of files. While touching > linux/kernel.h causes thousands of files to be re-build. > > That's a whopping > > 6 files changed, 6 insertions(+), 1 deletion(-) > > to make my tree build without including everywhere. > > Now, that's _just_ my defconfig, and the full build clearly has a > handful of other cases. From a quick look, mostly in the 'samples' > directory. > > But it looks like a *handful* of other cases. > > Now, if the same was true for printk(), I'd happily split that into > some other header too. I totally agree that trace_printk.h should not be added to kernel.h for debugging if printk.h is also not included for that purpose. But you are stating that it is included because everything "uses" it. But really, if we are worried about getting rid of adding headers that are not used, I think it would be a worth while exercise to remove printk.h from kernel.h to have it included only where it is used. That said, I'm also happy to get rid of trace_printk.h from kernel.h if there's an easy way to have it included for debugging purposes. Are you OK with the following approach? Basically, it adds "CONFIG_TRACE_PRINTK_DEBUGGING" config to be set by those that want to use it for debugging. When set, it will add to KBUILD_CFLAGS: -include $(srctree)/include/linux/trace_printk.h which is basically the same as having it in kernel.h but without adding the "burden" to those that don't want it (like yourself). This would allow the best of both words: diff --git a/Makefile b/Makefile index d33a7cadd237..84236890a806 100644 --- a/Makefile +++ b/Makefile @@ -839,6 +839,10 @@ ifdef CONFIG_FUNCTION_TRACER CC_FLAGS_FTRACE := -pg endif +ifdef CONFIG_TRACE_PRINTK_DEBUGGING + LINUXINCLUDE += -include $(srctree)/include/linux/trace_printk.h +endif + ifdef CONFIG_TRACEPOINTS # To check for unused tracepoints (tracepoints that are defined but never # called), run with: diff --git a/include/linux/trace_printk.h b/include/linux/trace_printk.h index 2670ec7f4262..3fe5fc5c6a2a 100644 --- a/include/linux/trace_printk.h +++ b/include/linux/trace_printk.h @@ -1,11 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_TRACE_PRINTK_H #define _LINUX_TRACE_PRINTK_H +#if !defined(__ASSEMBLY__) && !defined(__GENKSYMS__) && !defined(BUILD_VDSO) -#include #include #include #include +#include /* * General tracing related utility functions - trace_printk(), @@ -199,5 +200,5 @@ ftrace_vprintk(const char *fmt, va_list ap) } static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } #endif /* CONFIG_TRACING */ - +#endif /* !defined(__ASSEMBLY__) && !defined(__GENKSYMS__) */ #endif diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index e130da35808f..e305b27ca029 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -210,6 +210,16 @@ menuconfig FTRACE if FTRACE +config TRACE_PRINTK_DEBUGGING + bool "Debug with trace_printk()" + help + If you need to debug with trace_printk(), instead of adding + include to every file you add a trace_printk + to, select this option and it will add trace_printk.h to all code + to allow tracing with trace_printk() with. + + If in doubt, select N + config TRACEFS_AUTOMOUNT_DEPRECATED bool "Automount tracefs on debugfs [DEPRECATED]" depends on TRACING -- Steve