Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp772624rdb; Sun, 18 Feb 2024 11:00:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUX8v4Bq4wQ2VoGWEunn5+n4RKiO/ZSjYvE7gi4QqWF/iduG9x9UAi2MX+8cNNRu8CQZTG6i/rwmida/aS1YbJhXN56VgB2G3suFkidpA== X-Google-Smtp-Source: AGHT+IGQi6an0NKinPDo2jXtJ3Ij22eyblyPaUyy/Hj93MOTO5nPzGMd9OLjVANlqevKBBaD+QiD X-Received: by 2002:a05:6402:2b8f:b0:561:3704:329c with SMTP id fj15-20020a0564022b8f00b005613704329cmr13076371edb.8.1708282825172; Sun, 18 Feb 2024 11:00:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708282825; cv=pass; d=google.com; s=arc-20160816; b=SsiViCIK35MDvMOVROVk6ZnbtiZZtOX5Re3Zfv8AxEwZttchaCmdsyjpTiBX++hgoX djC9B8Fxqi8jmEkId9Bh3cbBtOdO0y71fG4BbxU4U1AemJQIo5boUNsYLNLVLKJb6gr7 dzbb3MiUCgmOf/ZJLsjqDXxQ0oVGiaO+R2bpvJ/TflIugndRahNUn/iMe2tB1iLyRtqg Mo7vmK7Hjo9XpsrnZuEUyj+qO7Ol600Ui4iATsL308DjJWUngWsNr5mdH4OBWir8r8Mi B6szqSJsGsaUz6OcqDWHPjKlR+1KlQvSvEU/Bg8tjXj9GvHo7faBlm5EhKIBse/cjvJF Npyw== 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=5fJ6yqWdSDvmc7d434BHASreaek3tLpIi1BkLTUqxi8=; fh=pKnPKUsir0uEGSsor+4Zc2vgbu+g+ayvUgsdzkuXaoA=; b=aALzvLiynOp9y7MZXATBpo290Zc+/KXCv+vaAKUFtA+Kuwd6R6lsX76kfpG814xShn fa+fHlOctgT6+Kd5MoYD5XvCI3JKnL0VtBAn2860lF/vnmq9vfPhbJDXN1aDjYE69AxR 9xezVstXgpn3gJW9XfEzHNyKlfQlfxmlng+r1Chgdt96ZuHfPuBGDLVDVK1hDR7pQTHU sqcPJ8reNNmutGQ4YKm6lgboKGqhzSlkrjGKnC2zVG+qjxPRClkHKraBhfO+Sv5Ec6v2 RDkbt6C0n5a/n3ouSru0yVP1Bwiu/aJJXrPnoBIBVk3CdeBg6PU4ksMX2Nq483uV5cG4 T33g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kipOVu39; 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-70512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f15-20020a05640214cf00b005646fd48c2asi328547edx.661.2024.02.18.11.00.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kipOVu39; 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-70512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70512-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id E7AF81F230D7 for ; Sun, 18 Feb 2024 19:00:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0EDA7602F; Sun, 18 Feb 2024 18:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kipOVu39"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zcuQRKgf" 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 53A3371B45 for ; Sun, 18 Feb 2024 18:57:56 +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=1708282678; cv=none; b=Bg/vGaOrKCNhSMJ2HEMBNBcVoKU6OpMxpmcc+diADPFoN/4om3Wbh7NhiJsd/n50Kmgrkb0gEL5uUWCP021BM9kY0QoJO/gqwIhIrk+ldpMVPB7TzQTGA3b4tyYPEwVDdvbCynKj5/wctxvUXAJZ/66z0uTGEHn+ZojTKFwEKIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282678; c=relaxed/simple; bh=QdXwnt6+PhX0aD+AlOZp4u+/7nviebzBO5H0/vlodlw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Oslzbae/biHzS/wfmzj74Fj8vOEaCia7Thx97rh2mEVhNKp3y1gdo7c7/hVAKF5zT47thNzWKYKIXAYQcSycRp34BNIVaykEBp//W0l2IcfY1TCJW1/wH66ZmmP1fwwy/YZ4dyNjmZ52IwNGglkEz4cQTNJZOQI+xqVPydW4cMk= 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=kipOVu39; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zcuQRKgf; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708282674; 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=5fJ6yqWdSDvmc7d434BHASreaek3tLpIi1BkLTUqxi8=; b=kipOVu39ofseUoqPTQoCnM23+6kBri5ZY2eBYwv/o+FNAIZUzfw4DtLwp8jDymOfwfi2Pe 4hma6CyBwf2rY4nROH7z1tKEDIcig9XMyk0V+3kCWjCIev9z7q94K6jKZEwgEmANmkgtQ0 bS/5Lwdwmv2ns+NDsy19ux3NkvtqWruYfwTMeQjERAbsIcJigtdYrR0Y4hkaiA3YjLIUsO DUJlz+LqYzQ/w3nKk53Hx1EoymeoDaYPowaeN/AJn1sJwzWPYuKlX5k+OChheaPDPp6VLV 3SHQCtyqROdOxNvNM5LBsbIUXqd54/bZq1/bqjvyzP+MWwhrSn66ePh15T16OA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708282674; 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=5fJ6yqWdSDvmc7d434BHASreaek3tLpIi1BkLTUqxi8=; b=zcuQRKgfxpNNB2OuJJiAlo1opLefEjxr6MexZJu4AsBTFQoMR2c3u1HnqC6qtG9R/LOa+M kOMUfgdZJyWjKTAQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH printk v2 20/26] printk: Track nbcon consoles Date: Sun, 18 Feb 2024 20:03:20 +0106 Message-Id: <20240218185726.1994771-21-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: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a global flag @have_nbcon_console to identify if any nbcon consoles are registered. This will be used in follow-up commits to preserve legacy behavior when no nbcon consoles are registered. Signed-off-by: John Ogness --- kernel/printk/printk.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 336dad179b99..2c4ab717c110 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -470,6 +470,13 @@ static DEFINE_MUTEX(syslog_lock); */ bool have_legacy_console; +/* + * Specifies if an nbcon console is registered. If nbcon consoles are present, + * synchronous printing of legacy consoles will not occur during panic until + * the backtrace has been stored to the ringbuffer. + */ +static bool have_nbcon_console; + /* * Specifies if a boot console is registered. If boot consoles are present, * nbcon consoles cannot print simultaneously and must be synchronized by @@ -3522,6 +3529,7 @@ void register_console(struct console *newcon) console_init_seq(newcon, bootcon_registered); if (newcon->flags & CON_NBCON) { + have_nbcon_console = true; nbcon_init(newcon); } else { have_legacy_console = true; @@ -3583,6 +3591,7 @@ EXPORT_SYMBOL(register_console); static int unregister_console_locked(struct console *console) { bool found_legacy_con = false; + bool found_nbcon_con = false; bool found_boot_con = false; struct console *c; int res; @@ -3639,13 +3648,18 @@ static int unregister_console_locked(struct console *console) for_each_console(c) { if (c->flags & CON_BOOT) found_boot_con = true; - if (!(c->flags & CON_NBCON)) + + if (c->flags & CON_NBCON) + found_nbcon_con = true; + else found_legacy_con = true; } if (!found_boot_con) have_boot_console = false; if (!found_legacy_con) have_legacy_console = false; + if (!found_nbcon_con) + have_nbcon_console = false; return res; } -- 2.39.2