Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7205288rwb; Tue, 15 Nov 2022 09:00:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf4MuCuT4zNwuUR01tTstmtwjugjufQIM/WuSPfK+ZPlnFteXkJlJfp4JccMvlTZmhw/qA1y X-Received: by 2002:aa7:d751:0:b0:467:42a9:3568 with SMTP id a17-20020aa7d751000000b0046742a93568mr15483462eds.70.1668531616262; Tue, 15 Nov 2022 09:00:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668531616; cv=none; d=google.com; s=arc-20160816; b=H8lXbfS72WnzLx60S8YUf7GNLb4Vcn9k9D/8W7Q29EdApPOldQkyyC+u6fnCHUXgQG a5UkSDy3flDTXBHSNM5tFjWWe4uxaRgrWn7O+BagX4jmOPDGMDM1ftAusB3VVZO585m+ CezSJv+ORNV7+rZ+5QlucOrXIZNEvkbSAv+XNnz4FOug+37/XUsp5FSD0tDmpRjhD1Bl vFLwUPGjSD2uqDe08uCsZ65jG2iXEkA0pvf9QY2S0o6PABe4rUfOcbGLrgoeZ1gj/YXW b/dH0Akp+Kxfot1j1gN/mhbALWGaBQgf7Zi21F1KP1Klajdkk6BlNwA1CK0cLg5Q/t+D n6fA== 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=/xR+jrAqBn0QmtFB6L1W7zGcypE9YglefwWtVgrPSgA=; b=jryRCc6h+qwufo0TAN3zfKFToU8pzE2QSvcSq50/oNogbNWrFz2xFzCFoFaERFVyHu xtL+gxHxCrDQjAEvnD+t1BR2Rz0E1DpKcMCI0UFHUmgpG/k6KnzYuXop/0f6lXvkGJHa ZhdV0A2efHrb0F0hBZFJhPYViaaMjMM06SlQtU8k36O9V2d2QWEhYj0G3HJGklKN/YFI lLCyRAmSMKcH64TTePoe8hgdbLNp9CZkytDtbwlWt/JLpMxbzr22AVnSUEnlpwTPw1RZ o+lSyiOAY9sHTyxQqRN6DC3ryuydyUpTmPTjnV0GEJhf496U7H0Of2UEJjUKYx69CVSk yWKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=aNjUKlEK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 dr4-20020a170907720400b007ae86742c3bsi11976428ejc.1009.2022.11.15.08.59.53; Tue, 15 Nov 2022 09:00:16 -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=aNjUKlEK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S237972AbiKOQkr (ORCPT + 90 others); Tue, 15 Nov 2022 11:40:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231582AbiKOQkp (ORCPT ); Tue, 15 Nov 2022 11:40:45 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3317727CF1 for ; Tue, 15 Nov 2022 08:40:44 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668530441; 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=/xR+jrAqBn0QmtFB6L1W7zGcypE9YglefwWtVgrPSgA=; b=aNjUKlEK6R/6i9SxWa/ZTCuVjX5ILDtArd/mahUfVl/3Zaw4zXjlXKVFaBx9r08rfjvsq0 /HPK9hJ8KghUCFNowia2H9aVvn/4Sj0bO9GjkbezjKPW557iodZhD86XuUg2y/Cn+ReTPe YXYbwZfL9fU+RlrJoxgrLrKRx+06ZxSRDJPRj161713GihNkI31dasOBIcQKBwrCTHDikL diZuaV33nvuXjPoB0lujyCBBcxwh30G2Uf4PBXzbhlAGqfR9pCk7UAM+Mo0COVl6QRbLrw rs0wH6d6nHszyAgfBgJ5UwHN/hoOOBjQ/1oeKTQNrlJ7vpTzWYWPKsupVTRYJA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668530441; 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=/xR+jrAqBn0QmtFB6L1W7zGcypE9YglefwWtVgrPSgA=; b=18yaXQKTblvTGshcgQDnEySBGpX6O1eGKiu5M8sioCHa9GEB1KU1ToAyI0MYbmlcWyJTFR DXbvKLlm9vNjeVAA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: replay log: Re: [PATCH printk v4 38/39] printk: relieve console_lock of list synchronization duties In-Reply-To: References: <20221114162932.141883-1-john.ogness@linutronix.de> <20221114162932.141883-39-john.ogness@linutronix.de> Date: Tue, 15 Nov 2022 17:47:12 +0106 Message-ID: <87tu30maqf.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-15, Petr Mladek wrote: > On Mon 2022-11-14 17:35:31, John Ogness wrote: >> --- a/kernel/printk/printk.c >> +++ b/kernel/printk/printk.c >> @@ -3334,6 +3330,11 @@ void register_console(struct console *newcon) >> * boot console that is the furthest behind. >> */ >> if (bootcon_registered && !keep_bootcon) { >> + /* >> + * Hold the console_lock to guarantee safe access to >> + * console->seq. >> + */ >> + console_lock(); >> for_each_console(con) { >> if ((con->flags & CON_BOOT) && >> (con->flags & CON_ENABLED) && >> @@ -3341,6 +3342,7 @@ void register_console(struct console *newcon) >> newcon->seq = con->seq; >> } >> } >> + console_unlock(); > > Thinking more about it. This console_unlock() will actually cause > flushing the boot consoles. A solution would be to call > console_flush_all() here. console_flush_all() requires the console_lock, so I don't think it would be different. The correct solution would be to recognize if nextcon is taking over a bootcon. If yes, that bootcon could be unregistered right here with unregister_console_locked() and then seq for nextcon set appropriately to perfectly take over. But we will need to think about how we could recognize the same device. I was thinking about if consoles hat some attribute showing their io-membase or something so that it could be clear that the two are the same hardware. > And we could/should solve this in a separate patch. This code was not > locked before. It is a corner case. It could be solved later. Agreed. John