Message ID | 20240218185726.1994771-5-john.ogness@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-70530-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp914976dyc; Sun, 18 Feb 2024 11:06:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXpMjI1pRDJpnanWW++eH7kwTgaagmnvpQoB8x9efC6wH8XlVIxrDsQVSPzmIxTqEGZN/P1l6GzFf9TOqTsCOeXlu2Dnw== X-Google-Smtp-Source: AGHT+IHA2owfrhL3T1Zl/hle787LTpzitfbf7xJL1XAbDePaZIUGQOZdJsQdbieeaACXbA5xb3dM X-Received: by 2002:a17:90b:164e:b0:299:6b93:9d94 with SMTP id il14-20020a17090b164e00b002996b939d94mr1147125pjb.25.1708283184005; Sun, 18 Feb 2024 11:06:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283183; cv=pass; d=google.com; s=arc-20160816; b=RgsJiKlGFdBaZGq3YaSrVgcokooJ19JCX16rnvvAqmaA63SqqrVnWJyKMERacuqXVf YUwENd92itxY8003lsmcstQZTz/DJxKAOnjD3PlmUSxl1h6wVE3rO0Jwcs9OVlUAOGpH aTeBys6zvCaQcRgyGR9J0G6AE3lOisAHTZcxXxAY97ghKYqVyeR8Iuk+Qzjmmkwx3pdi 72sDBRLGzDB/Zmyukxrej/IxZ3UGFlBwWyR3DZxo5vbg3DVcwL0zhL59TuVnm5MJRhVY ww+LebSSvygk8qaY9BHFNYaYe94JlUPfg102zocITn69sERFjshFqb7AVE0/RmvhyLHI eAwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=xxlb5lhcjt/hac5FRx4FUo+WOPkTmWiB9/oYCJlGF7c=; fh=pKnPKUsir0uEGSsor+4Zc2vgbu+g+ayvUgsdzkuXaoA=; b=GVjd2v12c+5NKW5W3TMXrUOMBTi2/+n/33ljjdVUn9bhGeaZdg7KuWQnGuVJ0/q2Mm iUrdAeb13cmaXvfcUN5yZbPDJkH/djvxOI1OXJdopFIa7uzAxTaxU1XuU/WxUa3U7D0W Fw+r3OeBAJNMQ7AHRYGFti2EN0huvabQeWUkXK4OYSRCKslL24V7rpI574JdAFrvmLiM siaK/3BaJOxQMtPh8P3A/cNIolGDkdDHk7TP5FlTuRdSs0dNQVZXQck82ZTt5vMGgyAQ JfPSkRNWxpMXo6e00dAGfnd7OITZTZj94VjaUk25jb/PZzXIY1GiiLRY5ALJCIGKcWeD VZEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=V1z5I0ZK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-70530-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70530-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cm18-20020a17090afa1200b0029898dc0b1bsi3306961pjb.116.2024.02.18.11.06.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:06:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70530-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=V1z5I0ZK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-70530-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70530-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CC68C280DC5 for <ouuuleilei@gmail.com>; Sun, 18 Feb 2024 19:06:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09464745C6; Sun, 18 Feb 2024 19:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="V1z5I0ZK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JU0rh4zw" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 A866E71B36 for <linux-kernel@vger.kernel.org>; Sun, 18 Feb 2024 19:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283075; cv=none; b=ez9el1Zg1YONAVWSACvMwBGg0BR6uWH9bffocgEsOKNZsLPNAseXWHIhwguGSvYVazN0y0PhbZLlO1R0mPtzrr1myMtMncEuAqEBT0L/H4+Z+ti8UwkZ2VjI6ENbL0Bgw4CXZZs/8MhPNeRIrVis7iJIHGWR9vkwUd88vNDK+Mk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708283075; c=relaxed/simple; bh=UgNQzP2/u6tlCo+4rRFkvhUnGTuONwvzfEkavv5ocsw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E2zdrv6mPAhcnDrTi8Ivm3sDgEER3FU0Tmep2FTPWpe6dC1wflNHyb+3Ufvl3L+FtL7H2LC+VNEzQ7gbKzISN9wtn45ifF+VVh295jovXXfpLPD4qJ0+Avm1kwpnIrNp2tx5pKAXILW5ybMvn7Q/vPEbZVIETavwZEQW8WlMJHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=V1z5I0ZK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JU0rh4zw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: John Ogness <john.ogness@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708282669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xxlb5lhcjt/hac5FRx4FUo+WOPkTmWiB9/oYCJlGF7c=; b=V1z5I0ZKF4iHILJ11grW3yUcMsf6dzsgE9WmHuFW6u/mxsPMHOJ0NSsnRbXIC6b8V1T0Z9 wqPspAxBrbJs7PJxTaKHgLbrdQPevNQ5dnXs6vXoyD+hrTN3n1gh+X8inITIaEMq3XNX8l dKXlX7bVC2Ea2M7PeM2Satzn9re/EfxAmImJYno6Owt6YqVpL7yIsWeXlWfziccFOTF7EL 89bInQanbWKAzq0TvEvvLMh0Swdds4mpPwEcCIbCABldoG8S0gVmv9Lm/41vzLqA3jr5bT agzhWDfYaOcXGngoaxe8lTI2CS81GGXp1TVsB+vrx2AI7tD3/tARoptktJJG7Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708282669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xxlb5lhcjt/hac5FRx4FUo+WOPkTmWiB9/oYCJlGF7c=; b=JU0rh4zwDuGsnP1WFQPCdy7oRZb7xMVV+ZfKxvMADbaw7dYlMWIc2fH5D4SMeMceDUvmUD nvvtMP+k9d9OBDDw== To: Petr Mladek <pmladek@suse.com> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org Subject: [PATCH printk v2 04/26] printk: Consider nbcon boot consoles on seq init Date: Sun, 18 Feb 2024 20:03:04 +0106 Message-Id: <20240218185726.1994771-5-john.ogness@linutronix.de> In-Reply-To: <20240218185726.1994771-1-john.ogness@linutronix.de> References: <20240218185726.1994771-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264747956254033 X-GMAIL-MSGID: 1791264747956254033 |
Series |
wire up write_atomic() printing
|
|
Commit Message
John Ogness
Feb. 18, 2024, 6:57 p.m. UTC
If a non-boot console is registering and boot consoles exist, the
consoles are flushed before being unregistered. This allows the
non-boot console to continue where the boot console left off.
If for whatever reason flushing fails, the lowest seq found from
any of the enabled boot consoles is used. Until now con->seq was
checked. However, if it is an nbcon boot console, the function
nbcon_seq_read() must be used to read seq because con->seq is
always 0.
Check if it is an nbcon boot console and if so call
nbcon_seq_read() to read seq.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
kernel/printk/printk.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
Comments
On Sun 2024-02-18 20:03:04, John Ogness wrote: > If a non-boot console is registering and boot consoles exist, the > consoles are flushed before being unregistered. This allows the > non-boot console to continue where the boot console left off. > > If for whatever reason flushing fails, the lowest seq found from > any of the enabled boot consoles is used. Until now con->seq was > checked. However, if it is an nbcon boot console, the function > nbcon_seq_read() must be used to read seq because con->seq is > always 0. This says that con->seq is always 0. > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -3391,11 +3391,20 @@ static void console_init_seq(struct console *newcon, bool bootcon_registered) > > newcon->seq = prb_next_seq(prb); > for_each_console(con) { > - if ((con->flags & CON_BOOT) && > - (con->flags & CON_ENABLED) && > - con->seq < newcon->seq) { > - newcon->seq = con->seq; > + u64 seq; > + > + if (!((con->flags & CON_BOOT) && > + (con->flags & CON_ENABLED))) { > + continue; > } > + > + if (con->flags & CON_NBCON) > + seq = nbcon_seq_read(con); > + else > + seq = con->seq; > + > + if (seq < newcon->seq) > + newcon->seq = seq; But this sets con->seq to some value even for nbcon consoles. It would make more sense to use nbcon_seq_force() for nbcon consoles here and remove the copying from nbcon_init(). Otherwise, it looks good. Best Regards, Petr
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 1685a71f3f71..696a9d76c09c 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -3391,11 +3391,20 @@ static void console_init_seq(struct console *newcon, bool bootcon_registered) newcon->seq = prb_next_seq(prb); for_each_console(con) { - if ((con->flags & CON_BOOT) && - (con->flags & CON_ENABLED) && - con->seq < newcon->seq) { - newcon->seq = con->seq; + u64 seq; + + if (!((con->flags & CON_BOOT) && + (con->flags & CON_ENABLED))) { + continue; } + + if (con->flags & CON_NBCON) + seq = nbcon_seq_read(con); + else + seq = con->seq; + + if (seq < newcon->seq) + newcon->seq = seq; } }