Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7193854rwb; Tue, 15 Nov 2022 08:49:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5nQ52OmIskvtl8nHaPw5bWDNpRYHsNhic5FzZBo0WJzXO63tuNxANUt3bYYxVwlWEujQyz X-Received: by 2002:a17:906:6c81:b0:7a6:ea24:7b01 with SMTP id s1-20020a1709066c8100b007a6ea247b01mr13709282ejr.410.1668530997534; Tue, 15 Nov 2022 08:49:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668530997; cv=none; d=google.com; s=arc-20160816; b=QtZ1goj/7gFnxVniUESvuHlak6db1iNTLnHVXGVkBqPuMS2QMvPQX/OchNQsFHCKo3 NXTomxXAzKy9d0ex4aeV7g4fa8xvOiM5mOReO4PVn+wFYCg8Ta3L/SsgIH6fcI78FIEd 2zWDJZV5eO7uO1AzvYJ1F45NnySeYHMWJheY+jnDnpfr6nQipxyweKk2AY4AVoGlnN0k LkqA9PNKTN1PagYetjeDYM47IrcjL9OkO7XEFQJdAQ6LVMwn2gZZg6+80dic48/ikoyC QBx8EazPmWj7M80lP3t8yVkFvxRb4K3yAW2Mo7tLydXPZzeUtPxhpvrznCW6ZiMUgNbN SNgw== 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=fp5QcrHVvziCUNf95TE2tiPSkunTivk9nv+QjUBLUYc=; b=aSuF8YlVbbKvQywQdruhjgP3G7Dhdf7Ipe/AQ31hZGZkLCU9hZMKcorC/Ss0PFeNxa ARxxNIP5PlQfZvlrBXg/JHVecYkb+UeQ75SPuTqeVJVr2l5oQXD0gwIV+x6b1HwshFny kx9xZaeNm/AIeLkr+Mmgvlo6LE/6zD14DnzhGUvuOW2EfR9g0iqfTs/vU7/bzK+e27U5 Ia7kor2wzwAwrPe3klt+qd0JQfJg3ux4zNaHmxXs8V2OYfCkp+VpakyAilexklrdlJtf MiVrNJV1aosaKf6u2XQbE37vuZMvpHG6pZU6S4rch9La7W3TIYZ8wQguYvF158IJDnBO rE/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=DuI+pBPW; 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 jr13-20020a170906a98d00b007a835c56b70si9739693ejb.267.2022.11.15.08.49.34; Tue, 15 Nov 2022 08:49:57 -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=@suse.com header.s=susede1 header.b=DuI+pBPW; 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 S230368AbiKOQnt (ORCPT + 90 others); Tue, 15 Nov 2022 11:43:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238703AbiKOQnl (ORCPT ); Tue, 15 Nov 2022 11:43:41 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D3A313CCA; Tue, 15 Nov 2022 08:43:39 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3A56D1F8D7; Tue, 15 Nov 2022 16:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1668530618; 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=fp5QcrHVvziCUNf95TE2tiPSkunTivk9nv+QjUBLUYc=; b=DuI+pBPW9cPLeFgTUc8qq6JcnB8YMbdXCCKmj/VkmKXQEOJiQGxHQifk91b5K7HbP6jtNB Uq1ybCS4qBXvhOllYVSMaq0J07cfltsC0Xy0eGgPgZiviaLmrHSQvSQ/keV2DA/qXrahAH 498ArqD0N8Ee/uLQ/20i067xlnBI0bE= 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 F37422C142; Tue, 15 Nov 2022 16:43:37 +0000 (UTC) Date: Tue, 15 Nov 2022 17:43:37 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Linux-sh list , Linux-Renesas , Geert Uytterhoeven Subject: Re: [PATCH printk v4 39/39] tty: serial: sh-sci: use setup() callback for early console Message-ID: References: <20221114162932.141883-1-john.ogness@linutronix.de> <20221114162932.141883-40-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221114162932.141883-40-john.ogness@linutronix.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Mon 2022-11-14 17:35:32, John Ogness wrote: > When setting up the early console, the setup() callback of the > regular console is used. It is called manually before registering > the early console instead of providing a setup() callback for the > early console. This is probably because the early setup needs a > different @options during the early stage. > > The issue here is that the setup() callback is called without the > console_list_lock held and functions such as uart_set_options() > expect that. > > Rather than manually calling the setup() function before registering, > provide an early console setup() callback that will use the different > early options. This ensures that the error checking, ordering, and > locking context when setting up the early console are correct. > > Since this early console can only be registered via the earlyprintk= > parameter, the @options argument of the setup() callback will always > be NULL. Rather than simply ignoring the argument, add a WARN_ON() > to get our attention in case the setup() callback semantics should > change in the future. > > Note that technically the current implementation works because it is > only used in early boot. And since the early console setup is > performed before registering, it cannot race with anything and thus > does not need any locking. However, longterm maintenance is easier > when drivers rely on the subsystem API rather than manually > implementing steps that could cause breakage in the future. > > Signed-off-by: John Ogness > Reviewed-by: Geert Uytterhoeven Reviewed-by: Petr Mladek Best Regards, Petr