Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp862464rwb; Thu, 10 Nov 2022 08:15:44 -0800 (PST) X-Google-Smtp-Source: AMsMyM4HX978HiSZcdqSEoiqO1Oayea7s8QBq9Dert1M4V3o9NK1b8y324HdxTGSDtf5Ge6yDoco X-Received: by 2002:aa7:8887:0:b0:56d:41a9:dbb7 with SMTP id z7-20020aa78887000000b0056d41a9dbb7mr60052120pfe.82.1668096944521; Thu, 10 Nov 2022 08:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668096944; cv=none; d=google.com; s=arc-20160816; b=OaO2urZAyDHnEohnGdK94QacKWM8+l3OEx0PUhr27hKVcPQ7uI7F9nKPigDFbNcUUO bMbqlkjU4TULOJExnusIvs2dt6qQkYQ31FbV7CaBomBJ66kdnc5JhYucnideUYKKJHY0 LT10K/apiYV1q7A7BoNmWsLPt32nA9KLg34Jy1R8ZASIxJVNqr2Hqzmed6Q7BL3jcXia oFmILkV23SuobqzBx0hbpbxIYbz0H5yfSskSYBgzyvUotiU1Czx90Xpsgvy0NlvSg5tL wjDxqwJVYEzFdoecILhbBJs8aHjZ1gx2825FQPmMrdWIO8YZ1w/eyzfqQQpm+ynP5bNX exOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=S2ekXh2GYs190EffPperJZ/U7GEy4Ue5lLOHn3cnsTY=; b=MHyEbLGHc+2JUKaDDSVn6uvOdvHIzF0Ct4yOWSGNefe+KhWLRyFFksrtIaSIq4PXUS 2jRefgPWNr1+YD4I3mOzWKYUB+Bkl+dw5H161j9io8ra1Mnqx8Ccj7So8JL+vJohOOzb NSWwwDsS/zZps6df9y23XfWd0w6q0xgf0RffKuSyM4R+Z/SrKRnLSrVmbFDXoWbhLljd gjTRi9zu7ft3m9P+mbAeCNKMOyLZUFb3uaNl2SxohTzFyyjmBEHDpH4CCOzZ9vOJ4KjH 8Uo3D7/Bq6DKGn6OoRJjdueZLqX5Kyug98I0VWJ6Fhu7q/tDBHSofSxz3tSekGeMu0Au DA2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=D1AzsMAd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=UIWSEc3u; 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 t7-20020a632247000000b0046fcf7aca3dsi18411502pgm.675.2022.11.10.08.15.21; Thu, 10 Nov 2022 08:15:44 -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=@linutronix.de header.s=2020 header.b=D1AzsMAd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=UIWSEc3u; 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 S230494AbiKJQDR (ORCPT + 93 others); Thu, 10 Nov 2022 11:03:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiKJQDP (ORCPT ); Thu, 10 Nov 2022 11:03:15 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91EAF303EA; Thu, 10 Nov 2022 08:03:14 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668096193; 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: in-reply-to:in-reply-to:references:references; bh=S2ekXh2GYs190EffPperJZ/U7GEy4Ue5lLOHn3cnsTY=; b=D1AzsMAdXVSDzz5kJrt9f713AtZ5rwnGbtn8uOef0JjHAAhBhyzEyiDq1I4hJFtlHwHh7m GX7kiyvgZ3PjN+ftd7LtrFABw4GFID9mZN+agIDdaqey1U4NW5RLby7bOch02j8RPrSQtP KTqpF0M+gkCE7sCeHQTPScGxCAPJKuWP/T2Xxk9rVHONfbgP9UaFMP37fW/W0INgYEmOYx 0MR6EQms1qzi0t7s4cUwMnj75aA6oMqWPYYwkFXWQ2lSLfxYtxcfXX3CB4j1rGNpUxmnOM +5J1Oi3XlYw6P51/QXLvftS8uzOWlMfNROslqy9yksaFLsFqyScc1+JGHlVleA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668096193; 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: in-reply-to:in-reply-to:references:references; bh=S2ekXh2GYs190EffPperJZ/U7GEy4Ue5lLOHn3cnsTY=; b=UIWSEc3uFNBtJFNIDDChRw/avEosrXGr8wJbKqiOCuw8HBJGUZix7GKEv6AtQEYcN/OaQw EMckQVr9OCZKoJDg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Helge Deller , Greg Kroah-Hartman , Javier Martinez Canillas , Thomas Zimmermann , Juergen Gross , Boris Ostrovsky , Tom Rix , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH printk v3 33/40] printk, xen: fbfront: create/use safe function for forcing preferred In-Reply-To: References: <20221107141638.3790965-1-john.ogness@linutronix.de> <20221107141638.3790965-34-john.ogness@linutronix.de> Date: Thu, 10 Nov 2022 17:09:12 +0106 Message-ID: <877d026blr.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain 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-11-10, Petr Mladek wrote: >> +void console_force_preferred_locked(struct console *con) >> +{ >> + struct console *cur_pref_con; >> + >> + if (!console_is_registered_locked(con)) >> + return; >> + >> + cur_pref_con = console_first(); >> + >> + /* Already preferred? */ >> + if (cur_pref_con == con) >> + return; >> + >> + hlist_del_init_rcu(&con->node); > > We actually should re-initialize the node only after all existing > console list walks are finished. Se we should use here: > > hlist_del_rcu(&con->node); hlist_del_init_rcu() only re-initializes @pprev pointer. But maybe you are concerned that there is a window where list_unhashed() becomes true? I agree that it should be changed to hlist_del_rcu() because there should not be a window where this console appears unregistered. >> + /* Only the new head can have CON_CONSDEV set. */ >> + WRITE_ONCE(cur_pref_con->flags, cur_pref_con->flags & ~CON_CONSDEV); > > As mentioned in the reply for 7th patch, I would prefer to hide this > WRITE_ONCE into a wrapper, e.g. console_set_flag(). It might also > check that the console_list_lock is taken... Agreed. For v4 it will become: console_srcu_write_flags(cur_pref_con->flags & ~CON_CONSDEV); John