From nobody Wed Feb 11 05:40:58 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 2F86F2DEA94 for ; Mon, 9 Feb 2026 02:20:08 +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=1770603608; cv=none; b=CpA4Ei0vNkPplNU8rZVUI88QK3Y4JC76olJV36udejZaRUWy+eTuPsfgBQlG7kamHZjxDAchD/DwdjkQFwYa4Q5AHqa4cTTzZg4Q3EzYT2SQwvijhDo3M9n0niX6z/LqyHR7JSh2AJxux+nv1fbFyYDG+INvD/X0h6ix+JNsDxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770603608; c=relaxed/simple; bh=H07E2wwO7Ir39hqPQXrL8iCbRhtNnVVdqS/KykLxLDw=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Llbc3epyme3kzkv4G35gfZocxpjzQXw4pkqXJIVnCnyBVrPypjt22tQ581myHQgZdbaHeUwpxSjNlkkiBGCKCrCsxVJYR/kzD5OMJ2t1U7ZoZVRGs9drAd60OLxEEKDQQWosSFYypwNyvRwqG5lxs8BDvpSIDOoHPrcRZ0ls4Q4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gNJmVW1a; 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="gNJmVW1a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13588C2BC86; Mon, 9 Feb 2026 02:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770603608; bh=H07E2wwO7Ir39hqPQXrL8iCbRhtNnVVdqS/KykLxLDw=; h=Date:From:To:Cc:Subject:References:From; b=gNJmVW1agnXOqNkLJMjzC5VazjhgPoIPny9s+wilruU4J9artpbIhZ5V0USc8lnqG SzSkBOQ31qABBJw4Cx6uVOn4oVfpGcm5vKr2YYVbAP0mmeQR3qS38TJ+x9W1z+TVB6 blrMeoTF8Vu60tvCDcUPefZlKK8QyY/igMxaZU0MWMb2s2SPoEpE+BcjU0bPCXix1O ffE6e8C4LuAtD/pWy0fWNmLriVaoaCKk8Xzr3+KDQMtjfSDn+/YFz5rJNNFDfjBJXn cpDLKQkaNXgxoFXk5mxKfEicDq1uPbgM+vs62F9YYDc/Ruv4lIvC0kIbz9Ocj2D6gD y4fLSo6+7+xyg== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1vpGtS-0000000Aa7M-2kBe; Sun, 08 Feb 2026 21:20:54 -0500 Message-ID: <20260209022054.507484055@kernel.org> User-Agent: quilt/0.68 Date: Sun, 08 Feb 2026 21:20:41 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 15/20] tracing: Use system_state in trace_printk_init_buffers() References: <20260209022026.627895421@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 The function trace_printk_init_buffers() is used to expand tha trace_printk buffers when trace_printk() is used within the kernel or in modules. On kernel boot up, it holds off from starting the sched switch cmdline recorder, but will start it immediately when it is added by a module. Currently it uses a trick to see if the global_trace buffer has been allocated or not to know if it was called by module load or not. But this is more of a hack, and can not be used when this code is moved out of trace.c. Instead simply look at the system_state and if it is running then it is know that it could only be called by module load. Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Link: https://patch.msgid.link/20260208032450.660237094@kernel.org Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index f4ae80564615..4066c33674e7 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -3243,10 +3243,9 @@ void trace_printk_init_buffers(void) /* * trace_printk_init_buffers() can be called by modules. * If that happens, then we need to start cmdline recording - * directly here. If the global_trace.buffer is already - * allocated here, then this was called by module code. + * directly here. */ - if (global_trace.array_buffer.buffer) + if (system_state =3D=3D SYSTEM_RUNNING) tracing_start_cmdline_record(); } EXPORT_SYMBOL_GPL(trace_printk_init_buffers); --=20 2.51.0