Message ID | 20221107141638.3790965-15-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 l7csp2078662wru; Mon, 7 Nov 2022 06:20:55 -0800 (PST) X-Google-Smtp-Source: AMsMyM5ndenX0VuVg5w3nsC/ovv6sAnVkbvk2J4Is1H/EOcBQiy94l5PYjISaN+DM/p3XK7NX9mI X-Received: by 2002:a17:902:d2c9:b0:186:f355:a42b with SMTP id n9-20020a170902d2c900b00186f355a42bmr50110681plc.58.1667830855672; Mon, 07 Nov 2022 06:20:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667830855; cv=none; d=google.com; s=arc-20160816; b=ZbzHD4SQ7N1eJptmOuHGtJ8/5enbZunEBu22efDJTTbJhr71zY2mJM7e4TnsO+ArSI IPzu08pTy2Qf0KFJ2NSv4jaX1oANsSPGV9Ji+oaRLMDFLjPN8tcIM8st5NMpSoM6qBrH h3u9HWxxOTKYp4hyEZaA1e9QJcdvu7undd+tRH93QHhKDM+heRx8XqmoYfQy235BhIPj efBVRTWOBmqe1MQyBeH/K3erz9GPdMJoOnP5UalTauofFhkLzZ4efZntclpL6L9yc5Ry TcarjxDfYcoNLH//T/6jxus92UZZEzN3sB6FLueuEX8kuFDR+ISgekdBprMxb7mkQYKm xiAw== 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=I3yaMFjrCtNc3Px6vqfLokWlErUgA/SSe6zXZ59V8XY=; b=XylTgzFGGiw/CjeqD63Cl/o5w8VHWsgwWvby+wzi4CPgK1DI2qKUvQuzAoi6NqcS+Q AGGHz/VPAwYBC53RjOxfs74oFvUXAAekkErI8q/nUlkROj9d7Oo5H570UrPbZPgsrJ1y slbnvzB2U2MBGwk8aRohmFn0L6+SbMT0JzVs7/am5WBFVX9AWtMIoJGME/+Fhdq3/wA7 eCM0Y6/3UtrEoHRMdDIFBUHvHpMgLGbDQ4OvIsoWmTFIPDuZoM7kAbtiZqllzyawBhNo KweO7z54vk6tjpD9ZtinxEexSjTDRu4z7YrVc509miu5p6KEPgvfjY9JRQEwDbOcNoVi CNdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=W7M6kX4a; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=YNgZvTTc; 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 e14-20020a170902ed8e00b0018659963cdcsi9163344plj.514.2022.11.07.06.20.40; Mon, 07 Nov 2022 06:20:55 -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=W7M6kX4a; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=YNgZvTTc; 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 S232285AbiKGORp (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 09:17:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232148AbiKGOQu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 09:16:50 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54DE11D0FE; Mon, 7 Nov 2022 06:16:48 -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=1667830607; 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=I3yaMFjrCtNc3Px6vqfLokWlErUgA/SSe6zXZ59V8XY=; b=W7M6kX4aY2WaQhigk++ZxU/cDgnvB3Dl9STk1+geoLoCGHp7UPBDY5v+NeZ90ucRfC2HZc lDRqkLNmPbRjBpCbHs5tsKGthjWVMLdZWMxiNEI7NckgFq/qionlE3HamxH3X/5XmEp8i/ LvYvxgNjfgydovwy55cK34wbW767izonqt76pbi9y9xO0RkwY4CcHMM+xntUfQSktX66yz ojtVw2XzoK4YTR9iApgdp4QpWG0d3UrJirmW+3fYtI6H0PCdW8LnrEW/UfVs02EMFXShG/ ChC8lj5RsSsKp0+AoiQTwUUxu+kE5nZjTLQvr/wycTrZpqCOEAgBCZU8fBxvGg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667830607; 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=I3yaMFjrCtNc3Px6vqfLokWlErUgA/SSe6zXZ59V8XY=; b=YNgZvTTcrT+PyJJnxSALPiorJ0D8azX4yxEjkhd6xJt1i0DwjJgqovqxZLibOchEzYHoDL 88GvZxS2AnRgV7CQ== 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, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-fsdevel@vger.kernel.org Subject: [PATCH printk v3 14/40] proc: consoles: document console_lock usage Date: Mon, 7 Nov 2022 15:22:12 +0106 Message-Id: <20221107141638.3790965-15-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?1748847407172052984?= X-GMAIL-MSGID: =?utf-8?q?1748847407172052984?= |
Series |
reduce console_lock scope
|
|
Commit Message
John Ogness
Nov. 7, 2022, 2:16 p.m. UTC
The console_lock is held throughout the start/show/stop procedure
to print out device/driver information about all registered
consoles. Since the console_lock is being used for multiple reasons,
explicitly document these reasons. This will be useful when the
console_lock is split into fine-grained locking.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
fs/proc/consoles.c | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
On Mon 2022-11-07 15:22:12, John Ogness wrote: > The console_lock is held throughout the start/show/stop procedure > to print out device/driver information about all registered > consoles. Since the console_lock is being used for multiple reasons, > explicitly document these reasons. This will be useful when the > console_lock is split into fine-grained locking. > > Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Best Regards, Petr
diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c index cf2e0788f9c7..46b305fa04ed 100644 --- a/fs/proc/consoles.c +++ b/fs/proc/consoles.c @@ -63,6 +63,15 @@ static void *c_start(struct seq_file *m, loff_t *pos) struct console *con; loff_t off = 0; + /* + * Take console_lock to serialize device() callback with + * other console operations. For example, fg_console is + * modified under console_lock when switching vt. + * + * Hold the console_lock to guarantee safe traversal of the + * console list. SRCU cannot be used because there is no + * place to store the SRCU cookie. + */ console_lock(); for_each_console(con) if (off++ == *pos)