From patchwork Sun Feb 18 18:57:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 202841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp911910dyc; Sun, 18 Feb 2024 11:00:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX6onwOZ1hPD5S1lAKmzbV1gvyc0/Uy7Kyyro3H+T38DUNsv8vwKxX1VUw3RGL2htnUIAL+bPJ53D3W71JB0xuRtSpifQ== X-Google-Smtp-Source: AGHT+IHj8xBRf/le6eHiyl3AOkg6rqacQ3/RPhsSzw/HpFfl71WSj/l6Nw57WB9b/qRVUKJqbURk X-Received: by 2002:a05:6e02:330e:b0:365:2390:9313 with SMTP id bm14-20020a056e02330e00b0036523909313mr4539450ilb.12.1708282824275; Sun, 18 Feb 2024 11:00:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708282824; cv=pass; d=google.com; s=arc-20160816; b=OeQQ82pmNNJQU9lTbAGHMqBCiwsh7HKXglcOF8StH9GBcIPhsCObAz3RPxDfHLWg7V I+hdfl/TaKTEnzcfveJNRkSRY7Y8fqElVrBU9CPfNFTmPraxkTKoaj0mUtxz8mdR8brb jcOJ9ioEbhIA1ptf6dTLV6aDER9eJjeQ1e8IXTJL+QVx515Xw7ypilEfL7a8iVsidPWa jqkcDwHz/+2UlIhGi4WspHw56Z1ZOCbE3iri4wrDMq7nBIwZYTq6v5khIWJszrEgx7pG K29Hd5hDUk7Q68jnXVUmt8Uf7Tmgq+fwID9kKwpkdzj7tdk7qRqWIQxcrJp8IGWXngDC fkQw== 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=IUwIeSGZ+StqqGIqBIJs0cGENFsoVWre3Jl13joVS94=; fh=pKnPKUsir0uEGSsor+4Zc2vgbu+g+ayvUgsdzkuXaoA=; b=fX4TLlPpxjgET1AMGo1Ae7GlYdA2aktvOG58mgn3qAUkDSmOKFuEJUbkuE42sivsU0 r4djE9KSD4HFSrKFSCnrLniZaD2w8VT/kGdmvr+O2CYAHiEfNPo1UZRxW+rUbs5D84Z7 QXI3LcJ0ovlbdkha3y86C6a4QLQue2K9J5PottRKH2fgxyn96ZGURN3xbyArvqCfMcZv SgzMg90Z4VOxz6BlllIvk+jQjg5oyvahBpMCGl3Qlnv2JIBIFGdBV4iRHozHoKwuV+Q/ Q/fHI5q9VCdwYz7KKMC/Kf3C2z48wnJ2nuLlaMD0FUH6rH6SqFq9uI6wHkSLxVjtVRa4 tFKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=t7xu7hfV; 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-70504-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70504-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 x7-20020a656aa7000000b005e0b2413677si2531233pgu.552.2024.02.18.11.00.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70504-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=t7xu7hfV; 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-70504-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70504-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 15F4D281C9C 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 AF9047602A; 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="t7xu7hfV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3WC1PWFT" 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 0C7A36F504 for ; Sun, 18 Feb 2024 18:57:53 +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=1708282675; cv=none; b=JkReHT7NbwNe9sFEkl7DtcbCCTNfb6qHFXp0bRrNkwqFICsiKv3MRosZqXdcNM/OdpKgUuV7z1SDNb3hHLcVZzSZfVtTbU9sEy+MSPw8Hc2OqjB2jFpJap5Rz9fgCOEDfaLKl5AUwEMRs12H/AEJNvpzVY7Ny6YJZbdsYSa9tnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282675; c=relaxed/simple; bh=VBHx4Cus2cJidu47KwQl5FHQQheHgkCUVrX8zpd9KsM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pGHncS6O3FLed5WbdgXksC1Ic56ZcbNeWllbMiA67J1I3HGDN+LuFX+j1RuNScjIT4oDQ8MBgrmIU/3uoZ1WpZ6S/0STxcz2nutDb3shyX6lCTp+J6FR5ZZbupCJVKvRFfI+uLT7Z6O8MyE4eJiEY2lwbkhRimXBgnqHDBE584E= 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=t7xu7hfV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3WC1PWFT; 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=1708282672; 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=IUwIeSGZ+StqqGIqBIJs0cGENFsoVWre3Jl13joVS94=; b=t7xu7hfVQXpd79WP0b9+W4yS7IsMad5j3VNVWCe5WHFy2pwwlog2q66avUuTa7EurOMbPd UWvIjARCFpJvv5Jp42GoE7ne8PBdxxT6p2fsZH1ic8ur0e0ZMylY00a6CkpP8bXiwZLNb8 nihLJssxgJ6M8Vb+GyNTdG256q3I0QUsN+q3IT2ZSALYVDLd8S376vkjiitDNaogQ0Eu7O R1hQAsoBHDBDNkzF7CxwHn1Wwul0N52Iz616hQhcLL4m+AFia5+Q8ReUR95m9sQ+EEQG5j KOn9mXZuS9LqHBWEnxMeYNSdAXBAZYW55ZW+7xob6AfnzKAIQDt2WaQQF/DyXw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708282672; 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=IUwIeSGZ+StqqGIqBIJs0cGENFsoVWre3Jl13joVS94=; b=3WC1PWFTwRsETdj+pq340CnfZVlD62OQIrZCKwUyr53+TZcJsH3jvnZzhsPN/IiZFOHmHU 7MQyIjPv75805ICw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH printk v2 12/26] printk: Let console_is_usable() handle nbcon Date: Sun, 18 Feb 2024 20:03:12 +0106 Message-Id: <20240218185726.1994771-13-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264371190657931 X-GMAIL-MSGID: 1791264371190657931 The nbcon consoles use a different printing callback. For nbcon consoles, check for the write_atomic() callback instead of write(). Signed-off-by: John Ogness Reviewed-by: Petr Mladek --- kernel/printk/internal.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 6e8c1b02adae..69c8861be92c 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -80,6 +80,8 @@ void nbcon_free(struct console *con); /* * Check if the given console is currently capable and allowed to print + * records. Note that this function does not consider the current context, + * which can also play a role in deciding if @con can be used to print * records. * * Requires the console_srcu_read_lock. @@ -94,8 +96,13 @@ static inline bool console_is_usable(struct console *con) if ((flags & CON_SUSPENDED)) return false; - if (!con->write) - return false; + if (flags & CON_NBCON) { + if (!con->write_atomic) + return false; + } else { + if (!con->write) + return false; + } /* * Console drivers may assume that per-cpu resources have been