From nobody Tue Dec 16 14:50:58 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 A1096270565; Mon, 5 May 2025 21:22:28 +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=1746480148; cv=none; b=qWLiY+G7BfpxptA2zzxYQn/KDQ/go7iA4damwIeI1CwNvTT0J1BfaezKd5WX+fCjztawrlUD+ev94WlSO+QOQypexaIX2RWDtlepCvIA3j4OfVv+ZthYbMJRRuFG/GUByqdsGjSJjMFoWKrixY2Tbl1zfrUZGhwM6dnZDw9006g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746480148; c=relaxed/simple; bh=TqkD8LxtVBklZh0dnSpjx7PjTTWwl2OLh6qRcV+8HgA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=i8ybn8Ys+bUFBkB9VzTk+vqOCLB5OR7sPD63f3qk+aAnVHNSVO4zlPH7HP2TdTWBz9L0tvw3nJdo7sGZeiMdCb5gK7p9HSGJcGYyokdQ7Vc9KfLu7HykHArabQ5LgzyRY/3LYupVn53X+QG7dpIpd/X6mwH6Rjkh5pfQvJU4m1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4402EC4CEEF; Mon, 5 May 2025 21:22:28 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1uC3Gl-00000000yBl-04qZ; Mon, 05 May 2025 17:22:35 -0400 Message-ID: <20250505212234.868972758@goodmis.org> User-Agent: quilt/0.68 Date: Mon, 05 May 2025 17:21:06 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [PATCH v2 02/13] ftrace: Do not bother checking per CPU "disabled" flag References: <20250505212104.986494754@goodmis.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 The per CPU "disabled" value was the original way to disable tracing when the tracing subsystem was first created. Today, the ring buffer infrastructure has its own way to disable tracing. In fact, things have changed so much since 2008 that many things ignore the disable flag. There's no reason for the function tracer to check it, if tracing is disabled, the ring buffer will not record the event anyway. Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_functions.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 98ccf3f00c51..bd153219a712 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -209,7 +209,6 @@ function_trace_call(unsigned long ip, unsigned long par= ent_ip, struct ftrace_ops *op, struct ftrace_regs *fregs) { struct trace_array *tr =3D op->private; - struct trace_array_cpu *data; unsigned int trace_ctx; int bit; =20 @@ -224,9 +223,7 @@ function_trace_call(unsigned long ip, unsigned long par= ent_ip, =20 trace_ctx =3D tracing_gen_ctx_dec(); =20 - data =3D this_cpu_ptr(tr->array_buffer.data); - if (!atomic_read(&data->disabled)) - trace_function(tr, ip, parent_ip, trace_ctx, NULL); + trace_function(tr, ip, parent_ip, trace_ctx, NULL); =20 ftrace_test_recursion_unlock(bit); } @@ -236,10 +233,8 @@ function_args_trace_call(unsigned long ip, unsigned lo= ng parent_ip, struct ftrace_ops *op, struct ftrace_regs *fregs) { struct trace_array *tr =3D op->private; - struct trace_array_cpu *data; unsigned int trace_ctx; int bit; - int cpu; =20 if (unlikely(!tr->function_enabled)) return; @@ -250,10 +245,7 @@ function_args_trace_call(unsigned long ip, unsigned lo= ng parent_ip, =20 trace_ctx =3D tracing_gen_ctx(); =20 - cpu =3D smp_processor_id(); - data =3D per_cpu_ptr(tr->array_buffer.data, cpu); - if (!atomic_read(&data->disabled)) - trace_function(tr, ip, parent_ip, trace_ctx, fregs); + trace_function(tr, ip, parent_ip, trace_ctx, fregs); =20 ftrace_test_recursion_unlock(bit); } @@ -352,7 +344,6 @@ function_no_repeats_trace_call(unsigned long ip, unsign= ed long parent_ip, { struct trace_func_repeats *last_info; struct trace_array *tr =3D op->private; - struct trace_array_cpu *data; unsigned int trace_ctx; int bit; =20 @@ -364,8 +355,7 @@ function_no_repeats_trace_call(unsigned long ip, unsign= ed long parent_ip, return; =20 parent_ip =3D function_get_true_parent_ip(parent_ip, fregs); - data =3D this_cpu_ptr(tr->array_buffer.data); - if (atomic_read(&data->disabled)) + if (!tracer_tracing_is_on(tr)) goto out; =20 /* --=20 2.47.2