From nobody Mon Dec 1 22:02:37 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4CDAC23E34C for ; Fri, 28 Nov 2025 01:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764293003; cv=none; b=ULA/9HGHJ5PjjYCftORJSVvxC5pT9HsFUNrX9kWWh7uUQ6pHO90jTzx5Rj8t7GS5ojNbzVUg9iT7lovqMg5MrR9P3EVC9V5j55F0UpO/0c1UoLKPsyvz/7w4L/J3WTsWh32Z3xwXi62jIFB2e+z3Gf0c67oCo53ib3Lx/a1ZhQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764293003; c=relaxed/simple; bh=IVdzAxviZeFmt9X8CPvuewU0RyKQAGIWqX3R6hkAdFY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=jJ1vMswlHSfxWvMgcXi8Up9JIhBsvrpWo3YcAejbH1BNAgINMAxF9z8Su7q9m90eugAL/p11XbWx3eXeg/rQlD+kZQUkHBnuzVBO3AvSl0u31H0pvcl0RGOs3wuaIPbmFXIkfM5NN5Megdg/M/d4CEENq/fY7Y/uUiZvYDqoNOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HHi3QdG9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HHi3QdG9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EECBAC19423; Fri, 28 Nov 2025 01:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764293003; bh=IVdzAxviZeFmt9X8CPvuewU0RyKQAGIWqX3R6hkAdFY=; h=Date:From:To:Cc:Subject:References:From; b=HHi3QdG96HbllxPMzWrXngfNuiWxrAw8QYnT7AZBWi+UOHXIosSr3tKYyETxEHXOQ Nz+vTFWeT/tfS6uvoEHXxA20hIN6M8hJYG+FjGKuYWGms6DxQECWKIOci54NgWM9wp tB0piFHdt5yJgetlbd13NvI+BQleufZMpO9VPz6tQ/SFJ9i3COJ6KMR1G/JZrlnplv zzWqjVKz+AR/Gw07lrnxM1+rEV9BC6qIzcn5+77O5KVjO55kLtPVzvNPCQvtygNnMG qtSxEDs+z5Me1rLYemfS3QmRNRUulX8wi0MpXg1ex+HxEeNMFQUBMsh2HmnqZaSEAL AfYbi04OCzwjA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vOnDY-00000006giF-2f5z; Thu, 27 Nov 2025 20:24:12 -0500 Message-ID: <20251128012412.486546486@kernel.org> User-Agent: quilt/0.68 Date: Thu, 27 Nov 2025 20:23:41 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tom Zanussi Subject: [for-next][PATCH 10/13] ftrace: Allow tracing of some of the tracing code References: <20251128012331.307010654@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt There is times when tracing the tracing infrastructure can be useful for debugging the tracing code. Currently all files in the tracing directory are set to "notrace" the functions. Add a new config option FUNCTION_SELF_TRACING that will allow some of the files in the tracing infrastructure to be traced. It requires a config to enable because it will add noise to the function tracer if events and other tracing features are enabled. Tracing functions and events together is quite common, so not tracing the event code should be the default. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Mark Rutland Cc: Tom Zanussi Link: https://patch.msgid.link/20251120181514.736f2d5f@gandalf.local.home Signed-off-by: Steven Rostedt (Google) --- kernel/trace/Kconfig | 14 ++++++++++++++ kernel/trace/Makefile | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 99283b2dcfd6..e1214b9dc990 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -330,6 +330,20 @@ config DYNAMIC_FTRACE_WITH_ARGS depends on DYNAMIC_FTRACE depends on HAVE_DYNAMIC_FTRACE_WITH_ARGS =20 +config FUNCTION_SELF_TRACING + bool "Function trace tracing code" + depends on FUNCTION_TRACER + help + Normally all the tracing code is set to notrace, where the function + tracer will ignore all the tracing functions. Sometimes it is useful + for debugging to trace some of the tracing infratructure itself. + Enable this to allow some of the tracing infrastructure to be traced + by the function tracer. Note, this will likely add noise to function + tracing if events and other tracing features are enabled along with + function tracing. + + If unsure, say N. + config FPROBE bool "Kernel Function Probe (fprobe)" depends on HAVE_FUNCTION_GRAPH_FREGS && HAVE_FTRACE_GRAPH_FUNC diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index dcb4e02afc5f..fc5dcc888e13 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile @@ -16,6 +16,23 @@ obj-y +=3D trace_selftest_dynamic.o endif endif =20 +# Allow some files to be function traced +ifdef CONFIG_FUNCTION_SELF_TRACING +CFLAGS_trace_output.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_seq.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_stat.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_tracing_map.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_synth_event_gen_test.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_events.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_syscalls.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_events_filter.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_events_trigger.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_events_synth.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_events_hist.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_events_user.o =3D $(CC_FLAGS_FTRACE) +CFLAGS_trace_dynevent.o =3D $(CC_FLAGS_FTRACE) +endif + ifdef CONFIG_FTRACE_STARTUP_TEST CFLAGS_trace_kprobe_selftest.o =3D $(CC_FLAGS_FTRACE) obj-$(CONFIG_KPROBE_EVENTS) +=3D trace_kprobe_selftest.o --=20 2.51.0