Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6152187rwb; Tue, 22 Nov 2022 09:22:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf6n/K7eAoPxhDgSPDrPBprzMGn9xbxusKkSb7ZqRW/XbQbZu/1SOJZ/0kXbbtyqMf69ZQkr X-Received: by 2002:a65:67c3:0:b0:477:96e2:beb8 with SMTP id b3-20020a6567c3000000b0047796e2beb8mr5083041pgs.151.1669137779080; Tue, 22 Nov 2022 09:22:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669137779; cv=none; d=google.com; s=arc-20160816; b=Ew4k0cCgrP+CUHiyJBArMkZzLGAty4pEuObALvRyaxNQP+lMaIC4w2m/CfwwdQMUDu 5iQXguXvKWtvP6UNjSzkh2pkzNSAfRNNAWk/IQQo1n4nbxRtnrf/v9CQVSSBMwUpt7Gc LLsPIy3IXQd0OybE90O6Sv68uITtE/ycr32mqVpJMk42/wwhpESDhn3UHXdL3qg3ozi0 WjbFNM/uBRzcud3tYA9qvvqZeDdk0gMVTq6bOLtI4we+VCq6u+jFU0DRr82T3ivi1m9W KKfqOwpFp33wDX2yLT/VrOXk4LW2+TrZrZOIP2JWHDaASZ/Hkgv2Q/bt4hdqsHv8VLkH ldWg== 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=UEBqU41eaw4Iu2gTJcOWA11cIqE9b5bg/IxV78SP+a0=; b=UvNJPqsVWnLy2j/PHm3jMSQcAjxx6a4uiaA22CT/o3IiTmIba64vp/gtI76/P0xza+ dNmW+7a/taBDGR1j6k4zjau2+eCFtfie/9UcTdPHMxUtrgXARrWsrAETyf6I26gcrfV/ b4CLr2PGHB/+s+JsHXZv+TqNlLGeV3zd58Dq6uEmPXlJNhTzejK8pI3KoElCEobYNh89 83PbyjmD8rW3pmSImq7f/xmeYdf4052oOfI9qMNyXdBLZQoiEQi3VcSP/GkXZzVjlQHg IYZQv9QBMhI7DLrhQXioDDxwED49usLRHoz+ob5vN0WvLy+rRUuxSG4qxGBmaZpUCDGi HVpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ai29wCwr; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b004778463363csi4848250pgk.76.2022.11.22.09.22.45; Tue, 22 Nov 2022 09:22:59 -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=@linuxfoundation.org header.s=korg header.b=ai29wCwr; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234131AbiKVQne (ORCPT + 90 others); Tue, 22 Nov 2022 11:43:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234110AbiKVQnW (ORCPT ); Tue, 22 Nov 2022 11:43:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DABC61B8C; Tue, 22 Nov 2022 08:43:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0EAEE61796; Tue, 22 Nov 2022 16:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7CD1C433D6; Tue, 22 Nov 2022 16:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669135392; bh=HhGB03f7yfLJTw6SIRqhGxERi9Gom4x4ToervBUNQF8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ai29wCwrSrFMalECnQg3VZFE6JJ7w1PVvNsX/nUcTdZGvwJT9FgVXh0Qu1fP/KZjg gLL1mmmGyJUPfkwUZ8U8rfzyORb4k7cg2ocWkdlYVwXPJu4ByDHKX8FbqktGuqI0/r L84ihOeSNwOdUyo5JUrjvyIoAUgVxWDKIToY6zCM= Date: Tue, 22 Nov 2022 17:43:08 +0100 From: Greg Kroah-Hartman To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jason Wessel , Daniel Thompson , Douglas Anderson , Jiri Slaby , kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org, linux-fsdevel@vger.kernel.org, Miguel Ojeda , Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Aaron Tomlin , Luis Chamberlain , Andy Shevchenko , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Lukas Wunner , Geert Uytterhoeven , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Ard Biesheuvel , linux-efi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Michal Simek , Peter Zijlstra , Mathias Nyman , linux-usb@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Helge Deller , Thomas Zimmermann , Javier Martinez Canillas , Juergen Gross , Boris Ostrovsky , Tom Rix , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH printk v5 00/40] reduce console_lock scope Message-ID: References: <20221116162152.193147-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221116162152.193147-1-john.ogness@linutronix.de> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Wed, Nov 16, 2022 at 05:27:12PM +0106, John Ogness wrote: > This is v5 of a series to prepare for threaded/atomic > printing. v4 is here [0]. This series focuses on reducing the > scope of the BKL console_lock. It achieves this by switching to > SRCU and a dedicated mutex for console list iteration and > modification, respectively. The console_lock will no longer > offer this protection. > > Also, during the review of v2 it came to our attention that > many console drivers are checking CON_ENABLED to see if they > are registered. Because this flag can change without > unregistering and because this flag does not represent an > atomic point when an (un)registration process is complete, > a new console_is_registered() function is introduced. This > function uses the console_list_lock to synchronize with the > (un)registration process to provide a reliable status. > > All users of the console_lock for list iteration have been > modified. For the call sites where the console_lock is still > needed (for other reasons), comments are added to explain > exactly why the console_lock is needed. > > All users of CON_ENABLED for registration status have been > modified to use console_is_registered(). Note that there are > still users of CON_ENABLED, but this is for legitimate purposes > about a registered console being able to print. > > The base commit for this series is from Paul McKenney's RCU tree > and provides an NMI-safe SRCU implementation [1]. Without the > NMI-safe SRCU implementation, this series is not less safe than > mainline. But we will need the NMI-safe SRCU implementation for > atomic consoles anyway, so we might as well get it in > now. Especially since it _does_ increase the reliability for > mainline in the panic path. > > Changes since v4: > > printk: > > - Introduce console_init_seq() to handle the now rather complex > procedure to find an appropriate start sequence number for a > new console upon registration. > > - When registering a non-boot console and boot consoles are > registered, try to flush all the consoles to get the next @seq > value before falling back to use the @seq of the enabled boot > console that is furthest behind. > > - For console_force_preferred_locked(), make the console the > head of the console list. > Reviewed-by: Greg Kroah-Hartman