From nobody Mon Dec 1 22:03:44 2025 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F24343093B6 for ; Thu, 27 Nov 2025 19:43:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764272636; cv=none; b=te04KkZbYnekinuuhBPPobdam2uvG4mk2rjoEahpondL+ZFK/0s3AxwCTXMLJKG7+6RTQ6Vf3ilKPCxwUQ94+7XaMWTSAoo9QXE3HUF8YoPZoepLyUS/boj+XJptLCFSBAM45MzOoR0FPLgm+Y1nbmJGf2dUExhOkaS5EratVVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764272636; c=relaxed/simple; bh=ZG3tAe/m+Wta76tm8jyg+zxyVZh9Ja/EQ4k0HCPPjPc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=h3mQ93wpuvzrCF3xoi3EPnJFiu4vQNdKi5Ms1QVm662KuZ8c1L/rO/gHSRA/h7ApTnPbCYuDx7wCo9yrA/uyGF4P/ryNVD10QwSZxjgqOU00xEuadbbFqmIFOxUcG17d7C8A1JieK04zuAx/hfgkYTmY0B2mhTWj3bId9EaYgg4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=chrisdown.name; spf=pass smtp.mailfrom=chrisdown.name; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.b=IWB1FunO; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.b="IWB1FunO" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-29568d93e87so11382645ad.2 for ; Thu, 27 Nov 2025 11:43:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1764272633; x=1764877433; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Fi3zmZZlCj3msbS2NjyoH0+KLHfjLarr27lz/8MQCrE=; b=IWB1FunOinX4AAaHcAwTMWwprRrKv8HzLFeQkHcwiMvFL7yz7u2u5RNcPu99Mow0ob y9/Vr4PP+ANtBNKOtmWOkl3/6++0az06uFrfelQpFUVBZYMkQHk3BgZOUWnTu3OdLqx4 jlwwPVjgrsDuwcPzc+CDJWHqEjDTGLNEyn5Cs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764272633; x=1764877433; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Fi3zmZZlCj3msbS2NjyoH0+KLHfjLarr27lz/8MQCrE=; b=qC8idPMFSPEE1DoluFWC1UY5ztBmZ0XMrfOy5zlDhAs0lqklyhQQSzR/kBY46bRRrD RhiFzLNcrInv/1rroD2Klj1a4JVIFym+i5ydOCfepXdgzlqz9DW80p3c78rEbPrnqgWK NXYNp33EDE7y5nZ8zCZXauhmVYDwna2G3wE+tImMqTv3tmg/7g555w0fnTyLErsQVn5S Ii/6QmAYUnjW3kMGAzF8miphYCnTkRoFH7ePJdeCEL1NVHJuh1xpYko6EfR1NbjC0nQR Y0DT//O9CeTd7b77DYpoyycIMegcOD9mbbCgumTa08UXk2snl8kSx3rpq5ohfKK34szf zL/A== X-Gm-Message-State: AOJu0YyUDKNtc33O38oZnDcn9vwlSYeygub9Y4tDgZ4YdprQs5QpscJX GuFuUp5UHDJrTQn8WYxDSBVHMuuPGAd0yFcr1V/YUEPTbVIVbgeHyXYGmxt/2+MVGn4= X-Gm-Gg: ASbGncvoCkbuA22zdcOxtFtncl4l4/uKu9UC23zQwENjjt0b5lvzydYG5HJczwyzzPj 5mu4RZN5cgvmprEBEPTeRtLzb4j+vv9vyR5+awpAqnKOIDfmYgcmCCjAy2TxiUDOodzRrmwx5j8 xQC17RYqP66UGeNNHvxDMQ6q4E1wZPcIg/ixk9N91hnc9XxpkDZXMNXvo97N7HBDUtWuteYfJQk gFVH3pdKy+VP3iqUtJrtIxYlZ0114A86/VwShD3Vn8ux53WqxERP8obUtiL571ySQHxnWfQAlrg xYCYhmOFX6RLLQ3XBXFvStWQh/SWiP+8DlAESHiG2Ki/v1v+NJqGhEq+qF9dnXeBNcmzTmnqUGo R1YZT6uB+mj59IhqCu0V15px1157V0wOnZC2ts5CkfIS78chVpSfMruv1IyLhn6elqy3ksYfUva QeiZLi1HF1kZFDL++LEYs= X-Google-Smtp-Source: AGHT+IFwdI5AOEC8rFwyyYgAA1h6InqaXE+88LS6dHgd85uzzbm854WwUgBUgWX/f242cXIiGV09kw== X-Received: by 2002:a17:902:ef50:b0:298:34b:492c with SMTP id d9443c01a7336-29bab2de50amr128529675ad.54.1764272633212; Thu, 27 Nov 2025 11:43:53 -0800 (PST) Received: from localhost ([116.86.198.140]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29bceb54454sm24284925ad.84.2025.11.27.11.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 11:43:52 -0800 (PST) Date: Fri, 28 Nov 2025 03:43:50 +0800 From: Chris Down To: Petr Mladek Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Sergey Senozhatsky , Steven Rostedt , John Ogness , Geert Uytterhoeven , Tony Lindgren , kernel-team@fb.com Subject: [PATCH v8 11/21] printk: Add ignore_per_console_loglevel module parameter Message-ID: <9ed065de828693a9aa358305627d32e247eacf1d.1764272407.git.chris@chrisdown.name> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.15 (2b349c5e) (2025-10-02) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With per-console loglevels now functional, there are scenarios where administrators need to quickly disable them and revert to the global console_loglevel for all consoles. This is useful for debugging message emission issues or when needing to break glass in emergencies. This commit introduces the ignore_per_console_loglevel parameter which can be set via the kernel command line or at runtime through /sys/module/printk/parameters/ignore_per_console_loglevel or on the kernel command line. When set, per-console loglevels are bypassed and the global console_loglevel is used for all consoles. Reviewed-by: Petr Mladek Signed-off-by: Chris Down --- Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ include/linux/printk.h | 2 ++ kernel/printk/printk.c | 17 ++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index 3edc5ce0e2a3..7b62a99489b8 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2177,6 +2177,13 @@ could change it dynamically, usually by /sys/module/printk/parameters/ignore_loglevel. =20 + ignore_per_console_loglevel [KNL,EARLY] + Ignore all per-console loglevel settings + and use only the global console_loglevel for all + consoles. This can also be set at runtime via + /sys/module/printk/parameters/ignore_per_console_loglevel. + See Documentation/admin-guide/per-console-loglevel.rst. + ignore_rlimit_data Ignore RLIMIT_DATA setting for data mappings, print warning at first misuse. Can be changed via diff --git a/include/linux/printk.h b/include/linux/printk.h index 45c663124c9b..0aa8cb8ddc09 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -73,6 +73,8 @@ extern int console_printk[]; #define minimum_console_loglevel (console_printk[2]) #define default_console_loglevel (console_printk[3]) =20 +extern bool ignore_per_console_loglevel; + extern void console_verbose(void); =20 /* strlen("ratelimit") + 1 */ diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 98d2f4466aad..e5b6a926135e 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -104,6 +104,9 @@ DEFINE_STATIC_SRCU(console_srcu); */ int __read_mostly suppress_printk; =20 +/* The sysrq infrastructure needs this even on !CONFIG_PRINTK. */ +bool __read_mostly ignore_per_console_loglevel; + #ifdef CONFIG_LOCKDEP static struct lockdep_map console_lock_dep_map =3D { .name =3D "console_lock" @@ -1280,6 +1283,18 @@ module_param(ignore_loglevel, bool, S_IRUGO | S_IWUS= R); MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting (prints all kernel messages to the console)"); =20 +static int __init ignore_per_console_loglevel_setup(char *str) +{ + ignore_per_console_loglevel =3D true; + return 0; +} + +early_param("ignore_per_console_loglevel", ignore_per_console_loglevel_set= up); +module_param(ignore_per_console_loglevel, bool, 0644); +MODULE_PARM_DESC( + ignore_per_console_loglevel, + "ignore per-console loglevel setting (only respect global console logleve= l)"); + /** * is_valid_per_console_loglevel - Check if a loglevel is valid for per-co= nsole * @@ -1317,7 +1332,7 @@ console_effective_loglevel_source(int con_level) if (ignore_loglevel) return LLS_IGNORE_LOGLEVEL; =20 - if (is_valid_per_console_loglevel(con_level)) + if (!ignore_per_console_loglevel && is_valid_per_console_loglevel(con_lev= el)) return LLS_LOCAL; =20 return LLS_GLOBAL; --=20 2.51.2