Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8630369rwi; Tue, 25 Oct 2022 08:58:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZeoheaIKbDvHZUYu2GSm6V4Qzs1aHoNprPrd5VFAgvSdYaN/xP+SdOLtrCZcAJcS7vngh X-Received: by 2002:a17:907:6087:b0:78d:ee99:a06a with SMTP id ht7-20020a170907608700b0078dee99a06amr33198885ejc.52.1666713505732; Tue, 25 Oct 2022 08:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666713505; cv=none; d=google.com; s=arc-20160816; b=wJns3NRFuxLnnRxLyJ9KpwU8wSUSztqHEGr3Q8jvElhpg7lnMHbq6NwrRX4G9Dyvxn bGOCyohmhj/OSGdzvvHVaOk9zOuE1mUVtoVPBBalj4buIyhKjCrTPRd6+0xaclvwzurZ 8cSGNzu87k9L8aOIOraPPVrVi5wJiRV5jbkbPuqr53umPpBoXLqOnuUANoHYOfOPvXOC U4jFfpHohz83av6UFVE3GqhRLQFToNmLtR4ZN0ndqE9b/CFCkt2bW5u0JaAZRVjcMnuz CSQTtCiQr4CtIXzP5/JX+2TQ0rIuyNf1MPoPPxyvd76ow0FUMybLsLEKhCt0wfOwhsgD 5mdQ== 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=/o9zDdOplWoFe1gHONmvf+OT1OCX1C3rPWeCJRA+vow=; b=FoPHTrNMLDblfKOpNL4JG9OmOYeRw1VlTffDV0NEKJOl2ElWi9T9WAt5twKXZS4wjP NGXoOWX+UeysHSCPXPI0zakPfBxqsw1nv1UrVh0Bo9W1emI66IlhQHAHz/H6BcezYw5u 03QRpXtrtllk7SfLF5TBunHbUMOvxtLZ5rJtRraRGjGXgvHdUcFViw0tdCCQT2dWfeAs ejZ7kfNIl86nGrz3OlLIWflVr9lNoSZ6nnP+uwTv1e5Ok72RmbAfDN+A2ozdKQH/GNF4 Dhfha1/vMzuscVGn4RIhQiQeuuKlRooMxd9esBo9Rxha35OQZ7xkRjdx54JeHfDdfwvz VTbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="m/UDYWeR"; 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 qa12-20020a170907868c00b0078dffe01cbesi3133136ejc.4.2022.10.25.08.57.59; Tue, 25 Oct 2022 08:58:25 -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="m/UDYWeR"; 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 S232504AbiJYP21 (ORCPT + 99 others); Tue, 25 Oct 2022 11:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233228AbiJYP2X (ORCPT ); Tue, 25 Oct 2022 11:28:23 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D153410F884 for ; Tue, 25 Oct 2022 08:28:20 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 7E2171F8A8; Tue, 25 Oct 2022 15:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666711699; 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=/o9zDdOplWoFe1gHONmvf+OT1OCX1C3rPWeCJRA+vow=; b=m/UDYWeRmAsgd5J6xxh9UQbdgDthjZcFr035rIKrnUTvna/6Li0J/KF/Vi6xmxd74eVBg7 yxfKiAZ7JC3UAkGpER+u1Y+moRfUNHIPJt7uVTnBRMVBY4HLLoRF5lnRijtIOlwhEntHI4 g+xHtiwsctK9jYjJ8862iUUqinJ3YfM= 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 5E3DC2C141; Tue, 25 Oct 2022 15:28:19 +0000 (UTC) Date: Tue, 25 Oct 2022 17:28:18 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk v2 28/38] printk: console_unblank: use srcu console list iterator Message-ID: References: <20221019145600.1282823-1-john.ogness@linutronix.de> <20221019145600.1282823-29-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221019145600.1282823-29-john.ogness@linutronix.de> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 2022-10-19 17:01:50, John Ogness wrote: > Use srcu console list iteration for console list traversal. > > Document why the console_lock is still necessary. > > Signed-off-by: John Ogness Reviewed-by: Petr Mladek See a note below. > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2948,10 +2948,14 @@ EXPORT_SYMBOL(console_conditional_schedule); > void console_unblank(void) > { > struct console *c; > + int cookie; > > /* > - * console_unblank can no longer be called in interrupt context unless > - * oops_in_progress is set to 1.. > + * Stop console printing because the unblank() callback may > + * assume the console is not within its write() callback. From some reason, I believe this even without more details. I expect that unbank() would need to refresh the screen and use similar code as the write() callback. It is different than the device() callback where the dependency is less obvious. Best Regards, Petr > + * > + * If @oops_in_progress is set, this may be an atomic context. > + * In that case, attempt a trylock as best-effort. > */ > if (oops_in_progress) { > if (down_trylock_console_sem() != 0) > @@ -2961,9 +2965,14 @@ void console_unblank(void) > > console_locked = 1; > console_may_schedule = 0; > - for_each_console(c) > + > + cookie = console_srcu_read_lock(); > + for_each_console_srcu(c) { > if (console_is_enabled(c) && c->unblank) > c->unblank(); > + } > + console_srcu_read_unlock(cookie); > + > console_unlock(); > > if (!oops_in_progress)