From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F47FC433FE for ; Tue, 4 Oct 2022 07:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbiJDH3J (ORCPT ); Tue, 4 Oct 2022 03:29:09 -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> 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