Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1860926rwb; Thu, 17 Nov 2022 03:11:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Jeesy7ka7TqrylMTMRh7L0VUGJCqji7OTwys7kyQBQI9Tb0Xwca2VvVO/S2N2S6THH+AD X-Received: by 2002:a17:902:f283:b0:188:ef29:fe0e with SMTP id k3-20020a170902f28300b00188ef29fe0emr2178990plc.143.1668683503481; Thu, 17 Nov 2022 03:11:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668683503; cv=none; d=google.com; s=arc-20160816; b=a/GAufyDWpSOrpMN91LbTj7lo3wuQyTyz/1PfoK/gpYQzVZDlsCxinTl6G0M1DDN3r SIxA2sqJl/4XjNnhkI3379SVzYiqF/rCQNN0IbDyO1NWbfgfj33z3Dh3O4RZLJMJ3lVv leDQA70Tr/T18UcWJZs0h+ICb2rapT1f9I9/Lr8uKX6j7fl+BqxKDAWg9VwjCrOOjruB 0ExdjW9n+bXl17S3mKFvPV1Pzzl/rGmdp9PP36mwWX+L/k8BADwwQCI7Ta32IZnR8V6T eY2I1heGEvwKZyR1gCq++34+2TF9BRHFU2f4wkY6c0QR8hRqWPvD2JFytskphSw5uo/j PB8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=fM6pYfjkvRx7D7oK5QPuCSEfKgQ75z+OzhgRrY5Yew0=; b=SAJZS+xHE3YJXBJ7O7qPFrI3Z4XX+QKNlu6/sFjCc9L3nXPXesLU18zSQafGT+c85i qNUlsHgcmS2WZGZ4tc4af8LxWuDUmLqBJgAQcFpyY59V5jwP0Lj/qhJmpui5JeyjkurG X5cawJVFrb/Dp63wL0o7xB5BaiBjwvlWGLh5GsNEfPNRIsjsBjRmWZh6uiV56bH1nWae us+uRen4tQ6LzGFMVld/KgiciSM0SLVMe/C7Lxdi1A5wv1jnqXgU7fI2b/EiBsE7U6uf /WwNvezYM6H/FG7yt36KA86hIUq45E9PwWxWXpNhGgI7Y+mmNg17ZKRnl6gr7iW8Uo1Y tKbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=NHfM5e69; dkim=neutral (no key) header.i=@linutronix.de header.b=2VKA10Ov; 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 my10-20020a17090b4c8a00b002130c156ee5si599533pjb.152.2022.11.17.03.11.30; Thu, 17 Nov 2022 03:11:43 -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=NHfM5e69; dkim=neutral (no key) header.i=@linutronix.de header.b=2VKA10Ov; 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 S234017AbiKQLJS (ORCPT + 92 others); Thu, 17 Nov 2022 06:09:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239771AbiKQLIQ (ORCPT ); Thu, 17 Nov 2022 06:08:16 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E55BD69DEF; Thu, 17 Nov 2022 03:08:14 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668683293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fM6pYfjkvRx7D7oK5QPuCSEfKgQ75z+OzhgRrY5Yew0=; b=NHfM5e69zJKKBVggrBKMdzCfCQ/i0woaUHO1FuTmngDf6Enqb3JsIZ5OslxwnAjQaI5YnF 2fyOkINghdiSpnDop2rk5F1FCadPVLEiYjRD9shRNBjzEBkQe3pKtMakInkjLEubdyfadX CKnygxiBuqGR+qkcO4YIDgFUo/67kb8yc+FazMktocPrN2HR65KngYoBpFmoKT4x3yLobC hlZAt0vuzLQw2tsfrQ+sHg+U4NwpsJBjSM8eWRaQfJqvD1TsbI5Gk/3Y+AxIjjAQeK1Wf6 vG7s1rP4bMgrdVKNWHYnpfPlh1STzAphJo3fL84enaSIWWmhZpnfSENZNSXeZg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668683293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fM6pYfjkvRx7D7oK5QPuCSEfKgQ75z+OzhgRrY5Yew0=; b=2VKA10Ovb0d8YDLPtBnjaYd9pwyjhK6e+g1zXJWgFLQB0TUpM7kQQM/siDEKLe9NLpdKQX 1C2bbwpsn4uPCEAw== To: Doug Anderson Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Greg Kroah-Hartman , Jiri Slaby , kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org Subject: Re: [PATCH printk v5 38/40] tty: serial: kgdboc: use console_list_lock to trap exit In-Reply-To: References: <20221116162152.193147-1-john.ogness@linutronix.de> <20221116162152.193147-39-john.ogness@linutronix.de> Date: Thu, 17 Nov 2022 12:14:09 +0106 Message-ID: <87mt8pon3a.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain 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 On 2022-11-16, Doug Anderson wrote: >> /* >> - * 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)) && > > Officially don't we need both the list lock and normal lock here since > we're reaching into the consoles? AFAICT the only synchronization we need here is iterating the console list, reading con->flags of a registered console, and modifying con->exit of a registered console. The console_list_lock provides synchronization for all of these things. By the end of this series the console_lock does not provide synchronization for any of these things. Is there something else that requires synchronization here? After this series the console_lock is still responsible for: - serializing console->write() callbacks - stopping console->write() callbacks - stopping console->device() callbacks - synchronizing console->seq - synchronizing console->dropped - synchronizing the global @console_suspended - providing various unclear protection for vt consoles - some bizarre misuses in bcache The scope may be larger than the above list. The investigation is still ongoing. John