From nobody Wed Feb 11 07:48:32 2026 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 5B37F340285 for ; Wed, 12 Nov 2025 15:22:40 +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=1762960960; cv=none; b=ej7IET59taVr+XwR3fou6ggc6ANYSa9G5VI1uTRoTfotdrPJH8tCbQNt0WMvU93I7vljzUIe2PZwbekGhdB2fPQAyd4oG+DrnV/bnILklHA/Uxwa4oJJ3cBaohsQAjk29YwuzSiXOUAqBmsxZtew1pYVi7gLLX/LdSHka0rMCjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762960960; c=relaxed/simple; bh=udrqgSsmySuqIdlighPHmg1LszlVemIYEoUIi49kpao=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Dug2pSgxXT2xRnTEa6wbMDVfAeTv3QBWJFIh4KGC4tqHv80vOZ1lzzmd8awAoHYWNC1FQeJuTjKG6KsPCljPXV9729ryqw+4J0ypVAjY5bGHFLSqkhlueaqMpS6FhRUDK13aJyqrBA9edI3/RNnrknvH0cAyD7VmO3z6jbrS6qo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PxvPGZbQ; 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="PxvPGZbQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6B07C2BCAF; Wed, 12 Nov 2025 15:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762960959; bh=udrqgSsmySuqIdlighPHmg1LszlVemIYEoUIi49kpao=; h=Date:From:To:Cc:Subject:References:From; b=PxvPGZbQKNsdWPuwd1iOufYxAF9FrX42SKeUnbJp6EQOr1qU2cdg5CoDslV7zLZIk OLKVUVf+tQ/7pAiZ/d2e5FT/uHOLS1rhZ1QYHYYmWgf3Rt6rMvuzw1ykH9GK7r0C87 0FIzFVs51PJRSCu5d2p8aKQMPe2Y5dTfQ9bvn+Jrr24PvZSp9VQs80dSm0BYrnZbS+ mfLO64+NojMH9kg9swWDdX2Gr8qdeT1MdxcC5uJzEv8Bp9pfXLmxl0rzagEcU09Cjy GQlhS33f6CuMN6j59ur4uf4GtFXKK0USA6g03GxxOLnPwm1lfIz2EX6adTjOQsqpA4 uuxeNHC46xftA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vJCgP-000000018N0-08I8; Wed, 12 Nov 2025 10:22:53 -0500 Message-ID: <20251112152252.887067352@kernel.org> User-Agent: quilt/0.68 Date: Wed, 12 Nov 2025 10:22:39 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 4/4] tracing: Have function graph tracer define options per instance References: <20251112152235.655878322@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 Currently the function graph tracer's options are saved via a global mask when it should be per instance. Use the new infrastructure to define a "default_flags" field in the tracer structure that is used for the top level instance as well as new ones. Currently the global mask causes confusion: # cd /sys/kernel/tracing # mkdir instances/foo # echo function_graph > instances/foo/current_tracer # echo 1 > options/funcgraph-args # echo function_graph > current_tracer # cat trace [..] 2) | _raw_spin_lock_irq(lock=3D0xffff96b97dea16c0) { 2) 0.422 us | do_raw_spin_lock(lock=3D0xffff96b97dea16c0); 7) | rcu_sched_clock_irq(user=3D0) { 2) 1.478 us | } 7) 0.758 us | rcu_is_cpu_rrupt_from_idle(); 2) 0.647 us | enqueue_hrtimer(timer=3D0xffff96b97dea2058, ba= se=3D0xffff96b97dea1740, mode=3D0); # cat instances/foo/options/funcgraph-args 1 # cat instances/foo/trace [..] 4) | __x64_sys_read() { 4) | ksys_read() { 4) 0.755 us | fdget_pos(); 4) | vfs_read() { 4) | rw_verify_area() { 4) | security_file_permission() { 4) | apparmor_file_permission() { 4) | common_file_perm() { 4) | aa_file_perm() { 4) | rcu_read_lock_held() { [..] The above shows that updating the "funcgraph-args" option at the top level instance also updates the "funcgraph-args" option in the instance but because the update is only done by the instance that gets changed (as it should), it's confusing to see that the option is already set in the other instance. Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Link: https://patch.msgid.link/20251111232429.641030027@kernel.org Link: https://patch.msgid.link/20251110234342.105763200@kernel.org Fixes: c132be2c4fcc1 ("function_graph: Have the instances use their own ftr= ace_ops for filtering") Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_functions_graph.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_func= tions_graph.c index fe9607edc8f9..4e86adf6dd4d 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -101,9 +101,9 @@ static struct tracer_flags tracer_flags =3D { .opts =3D trace_opts }; =20 -static bool tracer_flags_is_set(u32 flags) +static bool tracer_flags_is_set(struct trace_array *tr, u32 flags) { - return (tracer_flags.val & flags) =3D=3D flags; + return (tr->current_trace_flags->val & flags) =3D=3D flags; } =20 /* @@ -263,7 +263,7 @@ static int graph_entry(struct ftrace_graph_ent *trace, =20 trace_ctx =3D tracing_gen_ctx(); if (IS_ENABLED(CONFIG_FUNCTION_GRAPH_RETADDR) && - tracer_flags_is_set(TRACE_GRAPH_PRINT_RETADDR)) { + tracer_flags_is_set(tr, TRACE_GRAPH_PRINT_RETADDR)) { unsigned long retaddr =3D ftrace_graph_top_ret_addr(current); ret =3D __trace_graph_retaddr_entry(tr, trace, trace_ctx, retaddr); } else { @@ -441,7 +441,7 @@ static int graph_trace_init(struct trace_array *tr) { int ret; =20 - if (tracer_flags_is_set(TRACE_GRAPH_ARGS)) + if (tracer_flags_is_set(tr, TRACE_GRAPH_ARGS)) tr->gops->entryfunc =3D trace_graph_entry_args; else tr->gops->entryfunc =3D trace_graph_entry; @@ -1459,7 +1459,8 @@ print_graph_function_flags(struct trace_iterator *ite= r, u32 flags) static enum print_line_t print_graph_function(struct trace_iterator *iter) { - return print_graph_function_flags(iter, tracer_flags.val); + struct trace_array *tr =3D iter->tr; + return print_graph_function_flags(iter, tr->current_trace_flags->val); } =20 static enum print_line_t @@ -1535,7 +1536,10 @@ static void __print_graph_headers_flags(struct trace= _array *tr, =20 static void print_graph_headers(struct seq_file *s) { - print_graph_headers_flags(s, tracer_flags.val); + struct trace_iterator *iter =3D s->private; + struct trace_array *tr =3D iter->tr; + + print_graph_headers_flags(s, tr->current_trace_flags->val); } =20 void print_graph_headers_flags(struct seq_file *s, u32 flags) @@ -1660,7 +1664,7 @@ static struct tracer graph_trace __tracer_data =3D { .reset =3D graph_trace_reset, .print_line =3D print_graph_function, .print_header =3D print_graph_headers, - .flags =3D &tracer_flags, + .default_flags =3D &tracer_flags, .set_flag =3D func_graph_set_flag, .allow_instances =3D true, #ifdef CONFIG_FTRACE_SELFTEST --=20 2.51.0