Message ID | 20221019145600.1282823-25-john.ogness@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp379199wrs; Wed, 19 Oct 2022 08:10:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5OTGnh4LOJBYHRDdJRgr1+X2ccd0hhLgFCKuZMELWK6JjakRjP/ig8YY4Am3tb1mVZ3YMC X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr7903623edb.320.1666192228720; Wed, 19 Oct 2022 08:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666192228; cv=none; d=google.com; s=arc-20160816; b=VpudNb9ScR97OM6zvG8NQHev1CWGZRodSHE3Cgzjrx2XWvv5hbicrTcepQikt1JZ3+ GmyopQUuME6W4l9cmMiYnq8G34c36ZijJDbeuq2VgfO/PAeNlG+ucoEnpPJo7V6iBpvF adt2jroU6E0cHH3YwDdaRjeGO2MhjvHQWdMfynxf4Db4Gk0HZekCayuNqbVCOtj2CPn5 dAURpB+FsU4g0Bx25dYkKPFqg0XmYjtzFLZZS36mj8h2CTMUiq8zWcNcyZDwE065IlB2 QI3fVVKR6t6+1gKMH53sKUJaObQO9qgyfAL1J73vQm65ixzIL4kK06ke9K043e1gNSZl INhQ== 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=yQcHjaE6CQfq7iO6zRmu96wMYI8aMwb9KZsnUEYxyHY=; b=ZoMQ890reTKR7xFYFleckeKRx+rvhYq+wso337IQGh26ukuNgBA1j16ExuWvYYIV3C kNMM23zVyIpcnjidvmO2SUQj5kh3xUTgW8Ml1ZZlrnifxvG6jiKk1z3nfx7dCbeko8SB s/2GiUkQ8WF+nEYEqJWLBCp3w8uW97zGbeHAJP61PhijXguF9MKuWxF+kpcsbltYQaU8 4urmvPa3gdYUbS/nAYPwsUBDtDYT31C9Vflpk+2pIx7hkygnVMkKAVfk3OjHh2Xu83kv LFmx1sUT6W2ExcF4SP2tXScIFNQ+MQsMxt9Gl2/Xyq75z1+Xhu0qKYHdIXTlU5blAMbE QzfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=uJxwQf34; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=FnIygPB0; 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 z96-20020a509e69000000b00459148fbcc4si13367979ede.483.2022.10.19.08.09.44; Wed, 19 Oct 2022 08:10:28 -0700 (PDT) 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=uJxwQf34; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=FnIygPB0; 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 S230393AbiJSPGu (ORCPT <rfc822;samuel.l.nystrom@gmail.com> + 99 others); Wed, 19 Oct 2022 11:06:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231878AbiJSPFm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 19 Oct 2022 11:05:42 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87FCD38A0; Wed, 19 Oct 2022 07:59:21 -0700 (PDT) From: John Ogness <john.ogness@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666191375; 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=yQcHjaE6CQfq7iO6zRmu96wMYI8aMwb9KZsnUEYxyHY=; b=uJxwQf34Ytc+E+xlVFr+QJdkNyrMOfUvwvaZcWKOsw0HPBVGrb4yMLRvikG5fD7cUCCc3C 28HKnPfM+uG1Z5z4L56fxWXyrRIKTZSVZptsjItATwqm3Q4MhzYIPKqCJpyLB7fFVS0j6u /X9PqMg8IxzzFdciI7TDe8A+OYuDmG+ME1toyuS2fFqmqa1hTm+YBUxQV3oCJZHXuqalbQ QU8S/p/3lIK/8LUUToUovSXE4jfY76zMpDU7MTtRzM++2mNnVj7bKvcl8AgTMdYYD4YXz3 z8y5puCaOyxnbNpSsfsdnnyyPts9YXiBFHfz2EsNyXbwpHaTQcRNqZA6iu/ZOw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666191375; 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=yQcHjaE6CQfq7iO6zRmu96wMYI8aMwb9KZsnUEYxyHY=; b=FnIygPB0dsrSCCUyaFzWqQi5S8pnwh8nD/V378wLSKMrAbys4FHt9SsFaYaowHj8t+QBgh QwF/uqpaFI+ppICQ== 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, Helge Deller <deller@gmx.de>, Thomas Zimmermann <tzimmermann@suse.de>, Javier Martinez Canillas <javierm@redhat.com>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, Juergen Gross <jgross@suse.com>, Tom Rix <trix@redhat.com>, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH printk v2 24/38] xen: fbfront: use srcu console list iterator Date: Wed, 19 Oct 2022 17:01:46 +0206 Message-Id: <20221019145600.1282823-25-john.ogness@linutronix.de> In-Reply-To: <20221019145600.1282823-1-john.ogness@linutronix.de> References: <20221019145600.1282823-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?1747129182273632452?= X-GMAIL-MSGID: =?utf-8?q?1747129182273632452?= |
Series |
reduce console_lock scope
|
|
Commit Message
John Ogness
Oct. 19, 2022, 2:55 p.m. UTC
Since the console_lock is not being used for anything other than
safe console list traversal, use srcu console list iteration instead.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
drivers/video/fbdev/xen-fbfront.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On Wed 2022-10-19 17:01:46, John Ogness wrote: > Since the console_lock is not being used for anything other than > safe console list traversal, use srcu console list iteration instead. > > Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> > --- > drivers/video/fbdev/xen-fbfront.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c > index 4d2694d904aa..2552c853c6c2 100644 > --- a/drivers/video/fbdev/xen-fbfront.c > +++ b/drivers/video/fbdev/xen-fbfront.c > @@ -500,16 +500,18 @@ static int xenfb_probe(struct xenbus_device *dev, > static void xenfb_make_preferred_console(void) Just for record. This function is a dirty hack how to associate "ttyX" console with /dev/console. A clean solution would be to just reshuffle console_drivers list. I have a patch for this in my bottom drawer. It is part of a bigger clean up that it not ready for upstreaming yet. Best Regards, Petr > { > struct console *c; > + int cookie; > > if (console_set_on_cmdline) > return; > > - console_lock(); > - for_each_console(c) { > + cookie = console_srcu_read_lock(); > + for_each_console_srcu(c) { > if (!strcmp(c->name, "tty") && c->index == 0) > break; > } > - console_unlock(); > + console_srcu_read_unlock(cookie); > + > if (c) { > unregister_console(c); > c->flags |= CON_CONSDEV; > -- > 2.30.2
diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c index 4d2694d904aa..2552c853c6c2 100644 --- a/drivers/video/fbdev/xen-fbfront.c +++ b/drivers/video/fbdev/xen-fbfront.c @@ -500,16 +500,18 @@ static int xenfb_probe(struct xenbus_device *dev, static void xenfb_make_preferred_console(void) { struct console *c; + int cookie; if (console_set_on_cmdline) return; - console_lock(); - for_each_console(c) { + cookie = console_srcu_read_lock(); + for_each_console_srcu(c) { if (!strcmp(c->name, "tty") && c->index == 0) break; } - console_unlock(); + console_srcu_read_unlock(cookie); + if (c) { unregister_console(c); c->flags |= CON_CONSDEV;