From nobody Sun Feb 8 22:07:38 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 0EDAB3090C5 for ; Thu, 27 Nov 2025 19:43:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764272625; cv=none; b=Th6bJctaHr+WG7vTsaJXyaKSflCUl5oikwEF8tHz8m5GKFIJ1jnlSHKPM9x34CrA/S37FFQjaRyAXI2fW4WPnFYq+z4k7lCOwunXmmwNCc5uAz1p9lNVSUHAPFMeaWDRlhHihNmf3by63rbNcRmls/tTMskmZ2lC0MwsD72F3cA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764272625; c=relaxed/simple; bh=mpA7HHS+8CKlKsXgu0h6IbqRg6DZN4H/g5Ed+GtUnWU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P8QjnaKotJ9vYN0Awb+1CWbYChDzsr6YPfz2+NeSHTdyTg/4W5pYdorQnOaBiakSwadSuv4qN2T2QCET8p0uhQHfnUmRn03u+0OdjG4U367wnK0kLvVpSN/47KrdSOH3Sk7xVK6IGoNG9Y+ns79HAUy4uxgRQZ0YRjK6lWVIPS8= 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=NMO3D1TD; arc=none smtp.client-ip=209.85.214.180 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="NMO3D1TD" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-297d4a56f97so16518945ad.1 for ; Thu, 27 Nov 2025 11:43:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1764272622; x=1764877422; 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=ypFQRNuquOENbZ4Wn7KFVESvwCjwTV+nSDM/Oo/q58c=; b=NMO3D1TDjcXEZMvJXyKdK6KVXuIVw4fOmEeZ1A0SjGq5J7Qw9k20Rh3tS2jeAbRnP2 eZsdvXaMJVO/PiZ5fFcKnVaS40HHyWcPpUR/4aRXfhtTj7GsOMfjkCZh2CufIlSCOj4r /YKxecvcewIpjMC6f9T4G7KVkcGw63Sf+0LiE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764272622; x=1764877422; 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=ypFQRNuquOENbZ4Wn7KFVESvwCjwTV+nSDM/Oo/q58c=; b=Z2lDMsJZnlahRuPl0fS0dC169EK+ULoSOZB+xkJL/PpIeuQZrj6aVIuU2mIKCCtvEz K3N7PEkys/F58fum1pnPfw2sGyDfUH26r1q5P1/+lkUgPJ9euPuf/+821H6TwwBUkdnJ EH96x1e0FkDqy0sUKl5bZqsZcHtj1dZ2R8x+9B5XlgQwQfT4dSdfswvvERR48PVW64Yi lPy+Mb1ZqZ2SiK2wOyXf4pzJiT07h1Qd1E5dPOjjfQYRz3lFiOmZplCzqkcuY50O73u2 cIJ/Xm2MoS0SWYjU8MdLCvmIea4bBhC/pj9/psKKCzufKZtbrnOa+IC/rSJjrRCAl9Ly revw== X-Gm-Message-State: AOJu0YzAhgnoZBrGu2W5wGnMxgfTmHMnbWeQIQJxT1vrOjqXDDKT3HUE Y/l9P1E4j+I5WPF5fHL5Nil0bNu1BP1/5ELB0+phE52TFjanK9jatalIJD3rAZVMDYM= X-Gm-Gg: ASbGncuwfHejU5xqieG0MZi0j9561XInynW+6FU2Ou5QLK1HjV1RYV9JccoVp7uOscb Y4QXUXbHl1jDlii4j0rp+x5sra2iZAJGvXX85frwu7es3t9uR0N/43UqZtsq9Ueg+45dOBpGkQK 37t3F5H3JwdjFDT6D8QdqK7QQtqCFP1/Qh9/fHfDoRgqdT/pTA4ATaJxdo42MHfIrUej114601F xBVZlgp7GfoCGbyJHbmiN191DP41BcRyb3fyDc+C2Kb61umdWKP2mlbLKWg9UJEchxx8UT4Nxim LPNfC4HdLEHuzoPjTuUlGH63nTqfWCoE5J1Ms37n7qw3OmRvRsR0JzkisartntkuO9IuUn3jw7O oAgqpHLHAR3lkJQgGJ1t8uB0wQHWNhvsSi/mAbhQCxfyIO1zFXJSRzm7dFYf5rLLBWOU0Q7Xkvq 3EqpxRfk8c X-Google-Smtp-Source: AGHT+IErqgOJr+zMwonPEn96Ul0RytnHB+X5/cxAMZ51Pt01lMbnY5ORAq6gdwnzUE0kO3sikuUInQ== X-Received: by 2002:a17:903:b86:b0:295:4d97:8503 with SMTP id d9443c01a7336-29b6c575180mr278427635ad.30.1764272621651; Thu, 27 Nov 2025 11:43:41 -0800 (PST) Received: from localhost ([116.86.198.140]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29bce40ab81sm24840505ad.3.2025.11.27.11.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 11:43:41 -0800 (PST) Date: Fri, 28 Nov 2025 03:43:39 +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 08/21] printk: Iterate registered consoles for delay suppression decisions Message-ID: 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" The printk_delay() function applies boot_delay and printk_delay_msec delays when messages are printed. Currently it decides whether to skip the delay by checking if the message would be suppressed based on the global console_loglevel only. This means delays are applied even for messages that no console will actually print. With per-console loglevels, different consoles can have different filtering thresholds. A message might be suppressed on one console, but printed on another. In such cases, applying delays based solely on the global loglevel would be incorrect: we should only delay if at least one console will actually print the message. Introduce suppress_message_printing_everywhere() which iterates over all registered consoles and checks whether the message would be suppressed on all of them. The delay is now skipped only if the message would not be printed anywhere. Reviewed-by: Petr Mladek Signed-off-by: Chris Down --- kernel/printk/printk.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index d9c1bc4a32c4..0d7f3dac8177 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1368,6 +1368,41 @@ static bool suppress_message_printing(int level, int= con_eff_level) return (level >=3D con_eff_level && !ignore_loglevel); } =20 +/** + * suppress_message_printing_everywhere - Check if message is suppressed o= n all consoles + * + * @level: The loglevel of the message to check + * + * Iterates over all registered consoles and determines whether the message + * would be suppressed on every one of them based on their effective logle= vels. + * + * This is used by printk_delay() to avoid applying delays for messages th= at + * no console will actually print. + * + * Return: true if the message would be suppressed on all consoles, false = if + * at least one console would print it + */ +static bool suppress_message_printing_everywhere(int level) +{ + bool suppress_everywhere =3D true; + struct console *con; + int cookie; + + cookie =3D console_srcu_read_lock(); + + for_each_console_srcu(con) { + int con_level =3D console_srcu_read_loglevel(con); + + if (!suppress_message_printing(level, console_effective_loglevel(con_lev= el))) { + suppress_everywhere =3D false; + break; + } + } + console_srcu_read_unlock(cookie); + + return suppress_everywhere; +} + #ifdef CONFIG_BOOT_PRINTK_DELAY =20 static int boot_delay; /* msecs delay after each printk during bootup */ @@ -2199,7 +2234,8 @@ int printk_delay_msec __read_mostly; static inline void printk_delay(int level) { /* If the message is forced (e.g. panic), we must delay */ - if (!is_printk_force_console() && suppress_message_printing(level, consol= e_loglevel)) + if (!is_printk_force_console() && + suppress_message_printing_everywhere(level)) return; =20 boot_delay_msec(); --=20 2.51.2