From nobody Sun Feb 8 18:15:49 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 39D2F20297D; Fri, 2 May 2025 20:53:48 +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=1746219229; cv=none; b=I4+S9fx+LTzacBEXOMnuGWg4KNhURICvD8l4LXKYrqv0tFHmap8OhuCCIozJWJEPOHHCAMNFj2oTDXqGU0Iah4AyVSlYktFDl9yIqOAYo23F235bRY60upYwWybM+ZD9wVcQS6xmRqMNRyYdhP3wk5TX/yR68+wIRGmmaMR3qx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746219229; c=relaxed/simple; bh=TqkD8LxtVBklZh0dnSpjx7PjTTWwl2OLh6qRcV+8HgA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=bCnydG+tREpgIwXvoVKgF7OppdeFcSaWkledkJMyK1/I9CPSLnEIQo5YUruXxT2xaAPLRI94DtjS49Wkm2cB+u01ftVC0dVmJCtZCmNsjF+cZo7+sbllfHd6Pb0ugIc0yo4SDbgtKxHnZ2NdGbBiSFj9yWnsXZJIT0Shjpa1Yb8= 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 D19FCC4CEF2; Fri, 2 May 2025 20:53:48 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1uAxOG-000000006Ac-1tfM; Fri, 02 May 2025 16:53:48 -0400 Message-ID: <20250502205348.303564071@goodmis.org> User-Agent: quilt/0.68 Date: Fri, 02 May 2025 16:51:50 -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 03/12] ftrace: Do not bother checking per CPU "disabled" flag References: <20250502205147.283272733@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