Message ID | 20221107141638.3790965-39-john.ogness@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2079619wru; Mon, 7 Nov 2022 06:22:39 -0800 (PST) X-Google-Smtp-Source: AMsMyM5LF9X9ipuLo0Rm/2YuteAUr83p42aOwy+iUrKsvmDbATRQfVEFC5etNXzosfuoPtzcnp2H X-Received: by 2002:a05:6402:204d:b0:463:153d:6790 with SMTP id bc13-20020a056402204d00b00463153d6790mr48240119edb.293.1667830959157; Mon, 07 Nov 2022 06:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667830959; cv=none; d=google.com; s=arc-20160816; b=cYBd2QdWFrcR2o+vFDPd5YK36aOwkt5fLyxkCKlBUPqLcF5i75Sn0JKQCbxTuGyslF l4aaaeZKd+XyAOaEhDKytP7LsTwpekFXq0LXaRWvlKIyEPSODu7JCRcRI30+E6rOnrEe Pl7OMk4SbKKzFZZcngZu7X2M7ixMnhvrmrwYmBgz5Wf3xp8FUaimtU9h2GkkuNouodcE moGnZgpAvz8ZU2mysKRAOv/BIWsRv/WN2MEW45SQkTbFlow/UJAeEdqepRuAZVTn692f PacVkoStwwE5tJeUvUjXHsIjNluKKcz0wTYqWeWb3gCeaVflZQcT5W4FIQYjdwH9d8RU KZTg== 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=wUO1Wdk5xzj9Vs+pxrA7dhcSw4wLvHPzDi2xSOEA1ME=; b=erabvHrW217HISI01kMlQHzacvAC8pY3C9b5/dQq5YdjHQmxBtvnu6rHsHNXbgkgQj A0U8DioyOCu8nQQ02/Bx5/PqIunvHJBIlTbAtghWPaUINUpzxbhD3NBR0FnRGGynitTT 5wGOHeL+FaBsSko2pcyvpZ+Rsu3fz3y/ohEzY2lZP709dSKetmbywFswoHN87b+9BQZX 25YN2/kaasXlfLuNGbl5lLjqV1HAta7K/qYX5Njb4DBrAaUAM5NOEsAqXoPVYwZYI0G6 fBhh2tJJLte9BznIQVu0Z2esFiqvIZsG8jrhx+MtC9cNbTE4m2PYsWJNx5ueXWazo5yd UzBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MUs03b3d; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="y/4D56T+"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc18-20020a1709071c1200b00797e151e571si10907306ejc.36.2022.11.07.06.22.15; Mon, 07 Nov 2022 06:22:39 -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=MUs03b3d; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="y/4D56T+"; 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 S232462AbiKGOTb (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 09:19:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232271AbiKGORk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 09:17:40 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50A241D31D; Mon, 7 Nov 2022 06:16:59 -0800 (PST) From: John Ogness <john.ogness@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667830618; 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=wUO1Wdk5xzj9Vs+pxrA7dhcSw4wLvHPzDi2xSOEA1ME=; b=MUs03b3dJuWNfo7QVI5dMRKPmYfQe1AaNJ2UCFqmSPdHCpaerJkXb3JFXDpY8yzudMgvnP 61U2iJhwFpPiu02FexbWU0B8hzVeF59HrupwiQEC7KereqcT3hG2P1BwQAp1BnEjetn9Os VLR5NODmKIEmjVQZXGsbpSHYyLjvtewiY1to6bauh8e82VcN2YloCflvNTuVwlXypZ5AvZ tZvQA8n2lcbO4jAm0y2Iw584HkKm6Vkg/w3L2cfPtUw+CBVoFVvHQEVfVo0mPUpKxPR9JJ I4LIPcFhdvv006X3sdjQF2kzFT6wD4jjecuBt4WILIomm2h6+JrS8JvaVx9KhQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667830618; 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=wUO1Wdk5xzj9Vs+pxrA7dhcSw4wLvHPzDi2xSOEA1ME=; b=y/4D56T+eDpvRE8oe5A4x+AW38ZOTavCt3hqTDnko5X0Qde4DudGdqovNKjwfPfw9L1jQR KXKUXgdgHjl6TwCQ== To: Petr Mladek <pmladek@suse.com> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org, Jason Wessel <jason.wessel@windriver.com>, Daniel Thompson <daniel.thompson@linaro.org>, Douglas Anderson <dianders@chromium.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org Subject: [PATCH printk v3 38/40] tty: serial: kgdboc: use console_list_lock to trap exit Date: Mon, 7 Nov 2022 15:22:36 +0106 Message-Id: <20221107141638.3790965-39-john.ogness@linutronix.de> In-Reply-To: <20221107141638.3790965-1-john.ogness@linutronix.de> References: <20221107141638.3790965-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748847516199256158?= X-GMAIL-MSGID: =?utf-8?q?1748847516199256158?= |
Series |
reduce console_lock scope
|
|
Commit Message
John Ogness
Nov. 7, 2022, 2:16 p.m. UTC
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 <john.ogness@linutronix.de>
---
drivers/tty/serial/kgdboc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On Mon, Nov 07, 2022 at 03:22:36PM +0106, John Ogness wrote: > 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 <john.ogness@linutronix.de> I've not looked at the other patches in the series to understand the future tense here (e.g. why we need intermediate patches like this one). However I've no objections to the change so: Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Daniel. > --- > 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 >
On Mon 2022-11-07 15:22:36, John Ogness wrote: > 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 <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Best Regards, Petr
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;