Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp962732rdb; Tue, 19 Sep 2023 16:10:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEANAuThJ1va410pCiFxAaHIJpeRTj3Q+T5UepI688k01/ua1/nVO7OxQR2xNgvVGjiN/N9 X-Received: by 2002:a17:902:bb8f:b0:1c0:98fe:3677 with SMTP id m15-20020a170902bb8f00b001c098fe3677mr684859pls.56.1695165023817; Tue, 19 Sep 2023 16:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695165023; cv=none; d=google.com; s=arc-20160816; b=Dnnb6sKhI+HsRabcVeK+GLn//mMhLqHhiDPLnjMwDZRYIMjUVHvsw+Yn4aXV7bZuOi 7a2LtYbTbDotitKM1fQYEYeecwlMdpcKgSnaKrgyliGFgB7k2qsurKsLLx7Ow61dficN 93teGHLkY5bGPypmsKWYWHCQjwzAWo7Wa6CxelWGKy/euSi6dLCJT6pdhAjKSD4q5YDG 3BVPo0qrUIbx8If6C6pR2g1WPCgdTsyEfu6/DBOro/HrXWp3Vvd8GqJUl4lVYr+lmus1 UiMRPBrHxdLjtt4EkocGs0Rq0qfrfzQdJfGRdLxF0b42coYR0+L1c7qwlyZnmkmJrrmS lNvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=fFf1kFlBgEjf3N0WbcHTHhbAP/Zmjn3VBhye6lfUWfg=; fh=pKnPKUsir0uEGSsor+4Zc2vgbu+g+ayvUgsdzkuXaoA=; b=CK1nhvj/+LNfKPEjbDAoMyS5tiYehBqsIO+3tfW5HfGTMDZy5l1POtdSNrGUX1nIOb jBmAomc3hFjjYp+i0PQY/6dncH+rJx2f2bByN8485b6LhyrnoxVbbXeTRipt8FLigmdA doyXu5KoogMb5svnZ+u+aealFrr0IFGUfKBZ1hMY2oIAXpzc4JdUBNFL8eTD0I56ZTUG VvhPwr5QkoiO3PBoB76I50AyuPgms1wIdLB0VqPb/9TDFcoBlzOJf9kHQ2X9cODfpcff vGrGqCWZKdptscN0eBVkoPWJ0iY1o29cw6ao4kzEVRioXIaeokFWjcIWojUcv/hqKDlK hqeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Ji/Nc38y"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l12-20020a170903244c00b001c3991e57dasi10926543pls.396.2023.09.19.16.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 16:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Ji/Nc38y"; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id EFDF881BDF31; Tue, 19 Sep 2023 16:09:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233285AbjISXJW (ORCPT + 99 others); Tue, 19 Sep 2023 19:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233128AbjISXJQ (ORCPT ); Tue, 19 Sep 2023 19:09:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9368C4 for ; Tue, 19 Sep 2023 16:09:10 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695164948; 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=fFf1kFlBgEjf3N0WbcHTHhbAP/Zmjn3VBhye6lfUWfg=; b=Ji/Nc38yfLVaVLklKC8ElmecwukK9eYHd/xy+zRdEHUz1FlAV5pEXIJiRvrf92e6/AffdU 3xSJZ9Rmc45lH6uh0CZvwv6VUYkSCGWl8Y3muVrFyNtA9tMp3vgrGqkpU2otzGFlzyPrnU aF72eJLOGgDavU7eZAugt5TQywfa+A4gIBvhsrh2MooZO735vePLxRGKGQZON7CSknjmWt G46xk49I3KWLkkVTzifElnnaTT13vJjniJlmQTeEwB2dGAQtzrlQ3jxX2ZBJIVf+RzXI2v jiSMfDQLTD2/3kQC1xOiLdWgn3W+w9Z9vKc0aOesag4So0OJvmSeaSf9EB8GqQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695164948; 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=fFf1kFlBgEjf3N0WbcHTHhbAP/Zmjn3VBhye6lfUWfg=; b=X8lELKW72ir/HEJ6adxk6nez4Z4oqG/cjZChnCPxzeFYkIeq3RqfDNN27LHnpOW3wYlgjY M5XJwZRtIwTzaFDw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH printk v2 02/11] printk: Let console_is_usable() handle nbcon Date: Wed, 20 Sep 2023 01:14:47 +0206 Message-Id: <20230919230856.661435-3-john.ogness@linutronix.de> In-Reply-To: <20230919230856.661435-1-john.ogness@linutronix.de> References: <20230919230856.661435-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 19 Sep 2023 16:09:28 -0700 (PDT) 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 --- 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 -- 2.39.2