Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5745281rwb; Mon, 14 Nov 2022 08:54:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5AgQpNwO+pTVN9T+fg0n1Kug8SMGWdeqq5OV5XutqRIjVt6ZzkA0rZmt3ARM1HtP3jcTkf X-Received: by 2002:a05:6a00:10d4:b0:56d:a2be:ebe4 with SMTP id d20-20020a056a0010d400b0056da2beebe4mr14316331pfu.28.1668444870553; Mon, 14 Nov 2022 08:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668444870; cv=none; d=google.com; s=arc-20160816; b=l+Xmed0U2M7SdNWGVWY7a8MDQGhsOk+dz+Nja/Gq7ft5RvsrwtLop/HA5Q2rnXyoWC yjepbg+80u1laX7alaYJ38PFOmRwXE6ncpCQNQjY48ekaO1DsAgSLJ31bTSRTsydEzn2 R5y1FVfJNPuQV2kWVMAL97mwDhnh1QVFFkdh6zNSUvbBdJpg7son0Zg7sS5R/WSaLJj6 OtoQzYj5bQ6ZNu6rUoxna8K0rSZPre/F/DDZyoImYIIp2AzSH24ewGBGhArr1k+0CJz8 r2irnr02WqI9c+E0UZnGANtbcYEs54JMdqsZqceWLHLZ+tFG1nCd+54mF6Wkn02rwQ2B q9EA== 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=R9VqGyF+glKoWbwrATKZGXQP3ZfoC2SELt3pYx7i6e4=; b=JOkvrhbt4At3+KGKt3iXGDkaWWXyub8ioYY3kksA+KNQvYAuGzCMGYF71+QxOJMlOY 9ugqWK/X51K7Lchxk8CAhwT4+Ood3rH8tV6dCc63xWUCdoPBfwYdXrfFpyuyZ7EhHkVM uTMvJ5eonyHvqhoquCTrbcHU1k+leWEleiooHWv54n7n5RylcfpD9CD1Tp+wuHe8HwQC Lp86ODcdISFyvIlIn8pWuLpm5mi/lc8nxEDrEDoeAKIsK3mQlHswdN8hUK4TeH+YFLIf lmmiYond0nEntXcrOH/4It+5kcKBOwhgOatMhiDUIoAMcFDR0slwm23s/0vNfuVIVSt5 8sTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DacyzsBc; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="5U/0tNMt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i12-20020a63cd0c000000b0047063e59929si9799477pgg.836.2022.11.14.08.54.18; Mon, 14 Nov 2022 08:54:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DacyzsBc; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="5U/0tNMt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237872AbiKNQby (ORCPT + 87 others); Mon, 14 Nov 2022 11:31:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237715AbiKNQaw (ORCPT ); Mon, 14 Nov 2022 11:30:52 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80A682F3B0; Mon, 14 Nov 2022 08:29:52 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668443391; 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=R9VqGyF+glKoWbwrATKZGXQP3ZfoC2SELt3pYx7i6e4=; b=DacyzsBcp752j0f06x6Q5nIQ3Y5gHBQvOHj6L2Z1z+kRtb13uwnRXYW37qeBlA7kgq5U5n OaG76pGwOCwmTLoNnu/ZsGzwldP/gJxxLG3s06WbdxVYr9g1JXPqk0nThtOkMIKl8nD9ZC J5NDzg7I6YeBPhNNt11xV2oCLyep6w6l3sQDsNbw86SZHUUGw3Z7L59dKKhdvveul7RcQw gTAN2eDqhT8DvmFpCl3VGyA+CLcij+AIKpEnvnW1Y2ot2Pkpr7hjHH5KLAm7Due/1vwzjr AB7lVHWHuwghLHNLPcTikzz1Xbjg9af9IqHrb2u8wSXUTwh+qQgOKXTfbaCX7Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668443391; 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=R9VqGyF+glKoWbwrATKZGXQP3ZfoC2SELt3pYx7i6e4=; b=5U/0tNMtf/1+xSx/qQ15ry4JRyEwzML/OTxzN7u46NDdwk8a6TlIBlnh67P6RTs4qrLo08 vYO+POSL/MrszBCw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Douglas Anderson , Greg Kroah-Hartman , Jiri Slaby , kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org Subject: [PATCH printk v4 37/39] tty: serial: kgdboc: use console_list_lock to trap exit Date: Mon, 14 Nov 2022 17:35:30 +0106 Message-Id: <20221114162932.141883-38-john.ogness@linutronix.de> In-Reply-To: <20221114162932.141883-1-john.ogness@linutronix.de> References: <20221114162932.141883-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 kgdboc_earlycon_init() uses the console_lock to ensure that no consoles are unregistered until the kgdboc_earlycon is setup. The console_list_lock should be used instead because list synchronization responsibility will be removed from the console_lock in a later change. Signed-off-by: John Ogness Reviewed-by: Daniel Thompson Reviewed-by: Petr Mladek --- drivers/tty/serial/kgdboc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c index 8c2b7ccdfebf..a3ed9b34e2ab 100644 --- a/drivers/tty/serial/kgdboc.c +++ b/drivers/tty/serial/kgdboc.c @@ -558,13 +558,13 @@ static int __init kgdboc_earlycon_init(char *opt) */ /* - * Hold the console_lock to guarantee that no consoles are + * Hold the console_list_lock to guarantee that no consoles are * unregistered until the kgdboc_earlycon setup is complete. * Trapping the exit() callback relies on exit() not being * called until the trap is setup. This also allows safe * traversal of the console list and race-free reading of @flags. */ - console_lock(); + console_list_lock(); for_each_console(con) { if (con->write && con->read && (con->flags & (CON_BOOT | CON_ENABLED)) && @@ -606,7 +606,7 @@ static int __init kgdboc_earlycon_init(char *opt) } unlock: - console_unlock(); + console_list_unlock(); /* Non-zero means malformed option so we always return zero */ return 0; -- 2.30.2