From patchwork Thu Jan 7 08:05:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Meyer X-Patchwork-Id: 1423179 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=m3y3r.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=mFDEb3iY; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBJhY4hvXz9sVk for ; Thu, 7 Jan 2021 19:06:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=O3m4wObz1j7RxaSeUO5T/+BdzfC8xjv45XotMMipMRY=; b=mFDEb3iYeHbt2taCvGFt9vwQeS CnKEwd5++nntRW6zTxOmAQWVfTORF7vr7OD4Hqh1FdfdEJVPRkLWGmCVPq7OCnDbm2oWFvBIvi2Kt 1sJCQw/4qPPqpuVPu+AYh6wI1mm7EIydqQzX2qtk/mR6ZmyjV5LjF7Ait1KHWZefnsJsb/1UMNFMg P9uH+sX0ZoEK/3VPgScbLG67SUerfYLdAOkFaW5LLXEfx0jfmHc4H91ftJp8frFCncXa2Re62jFvr MdFhgceNQ9+1TPcEf4XiJSm1k26AEQtCKERUoJohsoQF5TbG/+iBBSUZSEfdiWsTLGFyvx/7VtIwA 70iocipw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxQIu-0006BO-3B; Thu, 07 Jan 2021 08:05:56 +0000 Received: from www17.your-server.de ([213.133.104.17]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxQIr-0006Ac-H3 for linux-um@lists.infradead.org; Thu, 07 Jan 2021 08:05:54 +0000 Received: from sslproxy03.your-server.de ([88.198.220.132]) by www17.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1kxQIp-0000MJ-QL; Thu, 07 Jan 2021 09:05:51 +0100 Received: from [95.222.19.205] (helo=DESKTOP-DQBDJ0U.localdomain) by sslproxy03.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kxQIp-0006b1-Ja; Thu, 07 Jan 2021 09:05:51 +0100 From: Thomas Meyer To: richard@nod.at, linux-um@lists.infradead.org Subject: [PATCH] um: kmsg_dumper: always dump when not tty console Date: Thu, 7 Jan 2021 09:05:31 +0100 Message-Id: <20210107080531.17936-1-thomas@m3y3r.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Authenticated-Sender: thomas@m3y3r.de X-Virus-Scanned: Clear (ClamAV 0.102.4/26041/Wed Jan 6 13:36:32 2021) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210107_030553_604177_A03F4576 X-CRM114-Status: GOOD ( 12.14 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [213.133.104.17 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Meyer Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org With the addition of the ttynull console driver, the chance that a console driver was already registerd did increase. Refine the logic when to dump the kernel message buffer: always dump the buffer, when the UML stdio console driver is not active and the preferred console. Signed-off-by: Thomas Meyer --- arch/um/kernel/kmsg_dump.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/um/kernel/kmsg_dump.c b/arch/um/kernel/kmsg_dump.c index e4abac6c9727..9dd91fc09421 100644 --- a/arch/um/kernel/kmsg_dump.c +++ b/arch/um/kernel/kmsg_dump.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include #include #include @@ -16,8 +17,12 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, if (!console_trylock()) return; - for_each_console(con) - break; + for_each_console(con) { + if(strcmp(con->name, "tty") == 0 && + con->flags & (CON_ENABLED | CON_CONSDEV) != 0) { + break; + } + } console_unlock();