Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3730796rwb; Fri, 30 Sep 2022 07:36:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM49ez+w4/dNghLOF8C42z5yMFVSOm3Y0rkEsjz77ZH9Jav8yrjvDzZBZxjzYSxLqJbrfNrH X-Received: by 2002:a05:6402:11d0:b0:44e:ec42:e0b8 with SMTP id j16-20020a05640211d000b0044eec42e0b8mr8036990edw.131.1664548596842; Fri, 30 Sep 2022 07:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664548596; cv=none; d=google.com; s=arc-20160816; b=X8d6a5mCFpObsx3fWHREgIVlRNuiFoq5TB9OwnNCWToxcgtQARXsaIBBxEgkpxDf0C CDiOzj/iGOF8mhgjRL/rPk6VmPiWTVGxa3U9lLWN2/BwQxgCcc/Ru+JyqUE0VFkPS3FP NAlD13PMM+x6UMoB0hwKs33oSpFgM9B1j0kpIPD9pIV4ibfJHSE5dX4UHwDayfTQ7Ezd ay8fMX0X6H0Yi24vsSXe8tVvjAQRBgjaqKusw7ijWPUvaC17JLC9xsIS1rQCPWmossWP z3You5mZ0Cwbf25OUL7j93jEPK2AZDdCpJ3JRiyjrmTMykx3uqpxaswXG8+beum3Bvtp 3I4A== 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 :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=Ry4QlFwo1gESGnrQg4gCqlx6qV7ctJvMWgIsvIMNe9k=; b=OCZ3ZqReQwadVJtBTHSZjOKfUdTH0wxyYtNP5br8Ow2AuIlD28Ohr1wWO7GRozLvcS 7awvQoRubCYGN5rZ1WzUgb4al9sE7vZ28T/ZQfaT9ayz76f0jJmqMF7GyxJsdLYw/8Ms ftvXEN9SKT1UNjdEyCV0jIe+bQnde7uD1mQdaQQOSvAgr/zHnClQZAwrrndcZAPJPAnF mhqGFqfO4MFa6h1R7R3SXVSocZQbfkuLiSSWfTtA81oR7apeLeryhMv+5TkNGaPc2Fyr VMyn8390X2DUiX7fIMwSj92NpMgLAWXDnVjpYOq4jXiLs/jFrHRuqpeM8fd6OxV9TXFN zWWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=NudYvBiW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 k8-20020a50cb88000000b00451f749fbb4si1971480edi.411.2022.09.30.07.36.11; Fri, 30 Sep 2022 07:36:36 -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=NudYvBiW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S231745AbiI3OQj (ORCPT + 99 others); Fri, 30 Sep 2022 10:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbiI3OQh (ORCPT ); Fri, 30 Sep 2022 10:16:37 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C40AE1A1096 for ; Fri, 30 Sep 2022 07:16:33 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1664547391; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ry4QlFwo1gESGnrQg4gCqlx6qV7ctJvMWgIsvIMNe9k=; b=NudYvBiWcHUcfpPZSIVQAHEihzpl7U2L9iu7+lzpUd3ilO+/kLTwzbL4gVC2pbUsaH9ohh zyUc+KWxfzfAzT7aRTEB+IqV0gIMHFW6eKkwJQAmRXtbRW0Zwiq80ZvAcipvp/l31DlOox ETV4YnTAQlRUiuZMZwxJwFjWKDFGy8vyG/GsOT5afJ+AffMPAivR94rO9GMp0/8Xo0V/OQ nGKtysQQY3Y1HRfXdCW448w6ZgJv/cmFlHqX/e6SC2hL9LIwiuOjklseikw1yyxRcB4KmM Qd2Et+j6/7pDN6KGVn7jc9U2tKIZxn7bMTzBl1VyzueVE8Do2WgoAthvZHn7nw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1664547391; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ry4QlFwo1gESGnrQg4gCqlx6qV7ctJvMWgIsvIMNe9k=; b=0Tpl8UFtilzXpwMZ71nVcBnNTw9ivYM+nfxh7+7+q/G7tP327w8gnE1K0Df71vdGQ0H648 vd8UzodvVykoYSBg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH printk 06/18] printk: Protect [un]register_console() with a mutex In-Reply-To: References: <20220924000454.3319186-1-john.ogness@linutronix.de> <20220924000454.3319186-7-john.ogness@linutronix.de> <87mtajkqvu.fsf@jogness.linutronix.de> Date: Fri, 30 Sep 2022 16:22:30 +0206 Message-ID: <87leq1uev5.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-09-30, Petr Mladek wrote: > We should actually make the the reading of console->flags safe under > srcu_read_lock(). It would allow to use the SRCU walk by all the > readers. Agreed. I will do this for the next version. > That said, I could imagine implementing console_lock() so that it > would be implemented by mutex when the legacy mode is disabled and > semaphore when it is allowed. No, let's not imagine this. It is d=C3=A9j=C3=A0 vu for the code that was reverted. > You were talking about command-line option that would allow to > disable the legacy mode on production RT systems. And I guess > that you added mutex because it behaves better on RT. We added mutex because list updates are always in may_sleep context and we were moving to SRCU for list iteration. I think with v2, where SRCU will be introduced earlier, things will be much clearer. > Also I could imagine using console_list_lock() as a wrapper > to console_lock(). It might help to distinguish locations where > the list is traversed and where the console_lock() is used for > another reason. I mean to remove the big-kernel-lock character > of the console_lock(). No, locking the list should have nothing to do with console_lock(). We want to remove the list synchronization responsibilities from console_lock(). In this series, I did not make that clear in the commit messages. (Perhaps it was not entirely clear to me then.) For v2 I will make this point very clear. > You know, the more locks we have, the bigger is the risk of > deadlocks, and the more hacks would be needed in > console_flush_on_panic(). And I am afraid > that console_lock() will be with us for many years and > maybe forever. Sure. Removing console_lock() will be a long battle involving many drivers. I am not trying to fight that battle right now. I just want console_lock() out of the way of NOBKL consoles. John