Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp87644rwb; Tue, 4 Oct 2022 00:41:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41obAZqANXa3De5EVIJTkt2myoy2a3rbXsmfm9wOJgdGVDGccLaCc9MKgL6/vLDq4SHwbC X-Received: by 2002:a05:6a00:2392:b0:549:be0:cd3c with SMTP id f18-20020a056a00239200b005490be0cd3cmr26638121pfc.8.1664869290532; Tue, 04 Oct 2022 00:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664869290; cv=none; d=google.com; s=arc-20160816; b=q/vG5DrikltlLZFLc8lEzWIgLvTSghm7oXesrF9OI9IniFYNFJTXoQiARdz+dTEF0e gTK9a3Fw5PO7mnm8Ug+ikET2lFiY0aAnYVxCDSsHhoeapaKsQKkFUNykyawdAv+92xOG 01JKVOxanLEYagSe5BGl9UaJVcYlT/XcL23KZEiWDq57T+Q+/Yzd43nrUIDJsV5GZQZb LDnuN55m4sFacdM6FSfsvFd58BBY01gsEs+MKYDiE0LgNVVJm7qNE88xdLBUfuOKtkR1 HhOqHh8RU5wcepFtt0vT/5StRMoIA9lIQbxO2U2dmD7vMeML4lEkQt3cGsJkgkQeGSE0 5zRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Yu0Bj/Z++bDprCboDOYyy/3zE2MzwZRpWsw/NxS0jsE=; b=D6grfX1kai6qhSmwFLUwG9qPrLyWAhPoPYtqnKM8BgfOvB8ss91uldGG7NzCtCPCVz BZ/jc+lt4Rwv+EOpd2bH4ALN4tyLrIVXFl5RpHjNdPH/e4RT4rcT94CjTn20i7WQRhB4 w/Po8b0P00+yEExgd/5Zxi6tQPKtU1a4MSXUnUZZIA9VrZvgqkH3wPhhbf3vmQ5EV/Rw enIqY0FwsGacQRj9tTtYRbzdnx+qg02+lVMZ/qk1bm98x9S6ZnvSKg6ZCHhOnUI+KIF8 vlVEOETAHaEny+vtjC+GkvYDR5q22zW3FF9VQdH9Hfyac/TswR4m+SBJTlRadk+KiOuM DFeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Dnb6xDnJ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 73-20020a63014c000000b0045190ea3f14si4362244pgb.471.2022.10.04.00.41.16; Tue, 04 Oct 2022 00:41:30 -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=@suse.com header.s=susede1 header.b=Dnb6xDnJ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbiJDH3H (ORCPT + 99 others); Tue, 4 Oct 2022 03:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229817AbiJDH3C (ORCPT ); Tue, 4 Oct 2022 03:29:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 749B94D244 for ; Tue, 4 Oct 2022 00:28:55 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id DB0871F914; Tue, 4 Oct 2022 07:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1664868533; h=from:from:reply-to: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=Yu0Bj/Z++bDprCboDOYyy/3zE2MzwZRpWsw/NxS0jsE=; b=Dnb6xDnJvDPplCbzyU8Snt+kaQUa/z3rBZ2H8cgT8hU/IFxRBriDDqWWecCxzm7liKGvgk OZybRD4lUAsyHChbiEl+gllTxGOtmGMootg6MANx5pK/Gtqd47ex9+XIj+zr5n3VAIK0gF YiLWWSlD586woGtZQIEExU3CvKmBmfQ= Received: from suse.cz (unknown [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8B83F2C143; Tue, 4 Oct 2022 07:28:53 +0000 (UTC) Date: Tue, 4 Oct 2022 09:28:53 +0200 From: Petr Mladek To: John Ogness 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 Message-ID: References: <20220924000454.3319186-7-john.ogness@linutronix.de> <87mtajkqvu.fsf@jogness.linutronix.de> <87leq1uev5.fsf@jogness.linutronix.de> <87zgeg7gnb.fsf@jogness.linutronix.de> <87a66c66px.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a66c66px.fsf@jogness.linutronix.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Mon 2022-10-03 21:41:22, John Ogness wrote: > On 2022-10-03, Petr Mladek wrote: > > What is exactly wrong with console_lock, please? > > It is ambiguously performing multiple tasks: > > - protecting the console list > - protecting individual console fields > - serializing console printing > - stopping all console printing > > And the answer to that is: A BKL is preventing us from optimizing the > kernel by decoupling unrelated activities. > > > The above proposal suggests that it might be something like: > > > > register_console() > > { > > console_list_lock(); > > > > if (!need_console()) > > goto out; > > > > if (!try_enable_console()) > > goto out; > > > > if (!(con->flags & CON_NOBLK)) > > console_lock() > > Why are you taking the console_lock here? The console_list_lock needs to > replace this responsibility. I realize the RFC and this v1 series does > not do this. For v2, it will be clear. This is the important information that I missed. It is a great idea. I agree that console_list_lock() would be a step forward if this worked. As you say, in the RFC and this v1, console_lock() was still used to synchronize the list and the metadata manipulation. It means that console_lock() was as complex as before. In fact, it was even more complex because console_list_lock() appeared in its lock dependency chains. And it was not clear that v2 would be any different in this regard. Best Regards, Petr