Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp897414rwb; Wed, 16 Nov 2022 09:04:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf4o5+YaFtsdh4Uo9A556gRSkDDzybRCPKZbGw2HNzCDFLMmoYOOQZxIwyTQ/S0rjq2nf98G X-Received: by 2002:a17:902:74c1:b0:186:c3b2:56d1 with SMTP id f1-20020a17090274c100b00186c3b256d1mr9831255plt.15.1668618292144; Wed, 16 Nov 2022 09:04:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668618292; cv=none; d=google.com; s=arc-20160816; b=UoFA0y5sGHsoJ84Bq6f9eKsKZdjX/1emh5bvPP0apibSJmD/F7MgamujuXVxhH0YvF xNm/l2R6jyWfk1WFpkCgsgkuMKf3MjbaGjEwbZ9lfCc9YmJGFLiDgKF+i6QaxbI4xPDr wZfJ0sUVjmDwMv60PYJJtgDwMKSgeEOFkT3tEdl1ejWS9fBOqaQtUFp2XJf01teFOY4B cAq9Cl5Y2IH8+M7MP5v1ANkf/IajGb18aw7JlZmuRttg/g454DIuSH0QPgIIrVI4IhSV GcZtdTVzMtBT6L+sKw+B6azA55a8M5+ZNJGwHY+5X2bwwkNM9hUA1Q2PXwLKP6e0V/Be IHqg== 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=oOkr1ysd9dSsSBi+pjKUthH9Z9sePRO3HCeKMfHwYbyQD1bdvXFgj/X1SRTuC5QiaC BMrJU5BSQhIGPLEdq6IMcZcZOKqFqmy+fdXBJlK2ax5axiUAlYUrWE6OUEjIkQwg6irc yS2XweBukzZRtBBys1cjW1dES3RT/NQypo3d9tyfGT7qoJWCV8fwFYXfAN33VGnpqKvY 7a8sVvWpCMH8rtMwe3YOHTlMglTGJJKoFFW1l6EeUDnpUM5eZNxzdQhfdgl//H79Gsin goc+8mvOhQbfrFcALZdtyBJgYGodfFVbdk6bFXEYIOquWMesQouMsTTMSE/k5y+/EV7b FdBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JFsQt9Ym; dkim=neutral (no key) header.i=@linutronix.de header.b=4QlR9bdm; 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 h17-20020a170902f55100b0018018272902si16866454plf.554.2022.11.16.09.04.27; Wed, 16 Nov 2022 09:04:52 -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=JFsQt9Ym; dkim=neutral (no key) header.i=@linutronix.de header.b=4QlR9bdm; 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 S238808AbiKPQ0I (ORCPT + 91 others); Wed, 16 Nov 2022 11:26:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238551AbiKPQXR (ORCPT ); Wed, 16 Nov 2022 11:23:17 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FED059848; Wed, 16 Nov 2022 08:22:18 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668615736; 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=JFsQt9YmKmGYiNMCmtvxB3r69uHQoFqE8e46/QPCeV4UzhXpIrH/WBkT8OVqrE9LmK1igd 8MYMnuoCiKcekVXCEqztixtf06Z+X0tmr4ZCp4z2KnxJX4XizYz6iFOt4XbmEnOrfWpMEd 9pJfm2udp0lnzaqCp9qDyM7fk/zZO8dGcumh8J4QcUMBqF2OsCea9tAj0AmtK+QRm10uw2 STmOa5knG3Xl4Ae3JELKSNNr1ur3iSmPTmxeT36HTAadHweraHKRNB9IUvEnThYR5yot/r BFK8xrc0lOODKN2Lb2Rqnd0X+EUw0Z5u+ngrj+fd0rY+uQAN8YbkjA/WOCmrAw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668615736; 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=4QlR9bdmeVF94Qc5Vu64CzXPINchKf2DFGK9G/aISYm0uexwOLYizOLQ6gSDk2jDy/Sr04 FB7QWs6ZgcD1g+Cw== 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 v5 38/40] tty: serial: kgdboc: use console_list_lock to trap exit Date: Wed, 16 Nov 2022 17:27:50 +0106 Message-Id: <20221116162152.193147-39-john.ogness@linutronix.de> In-Reply-To: <20221116162152.193147-1-john.ogness@linutronix.de> References: <20221116162152.193147-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