Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6139121iog; Thu, 23 Jun 2022 12:09:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uAEnUXZYD1lMQgjwGIItVdQ+bBZcXzWmqjaQ8lUrZmygUnrAXp4y8qAxxBwxDTZZkG5+0l X-Received: by 2002:a17:906:5053:b0:70d:a0cc:b3fd with SMTP id e19-20020a170906505300b0070da0ccb3fdmr9514415ejk.162.1656011380103; Thu, 23 Jun 2022 12:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011380; cv=none; d=google.com; s=arc-20160816; b=kzGmZfZa8h0Z6wLZZEx/1yovk94+h2NZ5LzjaUpddGNzFSck0Kk4A35/cz0rmFGwIW KS0h0NOalPB87nWQ3KvjGlbxxfkxLm5fitPOZYrAFqnPWZ4e3m/nbVALSP/yrLobMbkY eTdUTfg2HzPiC5eZ0KWQXy3rxgWxNMyJO59Yzg6xZvmt94AZuAZsStXAmpPgsxW0yIGf v1az2GIJHFzZpDkPy/Azj0+lIzBOeZrV7HVQjCDeNmiZM/q5aPIZX/7mOpI0KBoNjLdS dGalZrc2LI8N9OK/wR/Ge1EkdFp9MuzVpTMD9JYynVPUGw0JlWPBUQv7ID6DtMyXZnZY /D8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Du79CfuAvOspfh2oFybqEB7MvivXUVkJYYj8ly8k+ko=; b=QJQiV27vjcf5+2L7r80TTLJorySKOb3IRgcTUOoLnWCVvfymxQB8p074WH2U9LWwOn tjdgOreYdLAZ9eist3PdzkPy870BhigyvNGnXDSK9tS6+aIJSuoV4rHiiuut5RBVu0nM VcbxMetU2ysHtRVbHr847gCZxZweD3SY6D+XPIllN3WfH9oE8ZPUTUm0Ryer5AVpNlpw q9Kag5Q+U1uzEd/DlT8khQqR+YzjKZbJIIu73OiISaLxlH7uzZm7HmwDSp6J2TxOZ+os 6PFGXAxgBacKBf9Zt8fRfkXYa8NTpyYVW204+i5493ERWNNX6azYYzBKL6IIf/JSQGbq zQqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs21-20020a170906dc9500b007232e05af5esi2005225ejc.287.2022.06.23.12.09.14; Thu, 23 Jun 2022 12:09:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234676AbiFWSgb (ORCPT + 99 others); Thu, 23 Jun 2022 14:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234594AbiFWSgT (ORCPT ); Thu, 23 Jun 2022 14:36:19 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D1328F9C7 for ; Thu, 23 Jun 2022 10:37:21 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1o4QkO-00079c-Ee; Thu, 23 Jun 2022 19:36:04 +0200 Message-ID: Date: Thu, 23 Jun 2022 19:35:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v2 2/2] of: base: Avoid console probe delay when fw_devlink.strict=1 Content-Language: en-US To: Saravana Kannan , sascha hauer Cc: andrew lunn , peng fan , Heikki Krogerus , "Rafael J. Wysocki" , linus walleij , ulf hansson , eric dumazet , pavel machek , will deacon , kevin hilman , Frank Rowand , joerg roedel , russell king , linux-acpi@vger.kernel.org, jakub kicinski , paolo abeni , kernel-team@android.com, Len Brown , len brown , kernel@pengutronix.de, linux-pm@vger.kernel.org, linux-gpio@vger.kernel.org, Rob Herring , Andy Shevchenko , hideaki yoshifuji , Greg Kroah-Hartman , david ahern , linux-kernel@vger.kernel.org, Daniel Scally , iommu@lists.linux-foundation.org, Sakari Ailus , netdev@vger.kernel.org, "david s. miller" , devicetree@vger.kernel.org, heiner kallweit References: <20220623080344.783549-1-saravanak@google.com> <20220623080344.783549-3-saravanak@google.com> <20220623100421.GY1615@pengutronix.de> From: Ahmad Fatoum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hello Saravana, On 23.06.22 19:26, Saravana Kannan wrote: > On Thu, Jun 23, 2022 at 3:05 AM sascha hauer wrote: >> >> On Thu, Jun 23, 2022 at 01:03:43AM -0700, Saravana Kannan wrote: >>> Commit 71066545b48e ("driver core: Set fw_devlink.strict=1 by default") >>> enabled iommus and dmas dependency enforcement by default. On some >>> systems, this caused the console device's probe to get delayed until the >>> deferred_probe_timeout expires. >>> >>> We need consoles to work as soon as possible, so mark the console device >>> node with FWNODE_FLAG_BEST_EFFORT so that fw_delink knows not to delay >>> the probe of the console device for suppliers without drivers. The >>> driver can then make the decision on where it can probe without those >>> suppliers or defer its probe. >>> >>> Fixes: 71066545b48e ("driver core: Set fw_devlink.strict=1 by default") >>> Reported-by: Sascha Hauer >>> Reported-by: Peng Fan >>> Signed-off-by: Saravana Kannan >>> Tested-by: Peng Fan >>> --- >>> drivers/of/base.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/drivers/of/base.c b/drivers/of/base.c >>> index d4f98c8469ed..a19cd0c73644 100644 >>> --- a/drivers/of/base.c >>> +++ b/drivers/of/base.c >>> @@ -1919,6 +1919,8 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) >>> of_property_read_string(of_aliases, "stdout", &name); >>> if (name) >>> of_stdout = of_find_node_opts_by_path(name, &of_stdout_options); >>> + if (of_stdout) >>> + of_stdout->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT; >> >> The device given in the stdout-path property doesn't necessarily have to >> be consistent with the console= parameter. The former is usually >> statically set in the device trees contained in the kernel while the >> latter is dynamically set by the bootloader. So if you change the >> console uart in the bootloader then you'll still run into this trap. >> >> It's problematic to consult only the device tree for dependencies. I >> found several examples of drivers in the tree for which dma support >> is optional. They use it if they can, but continue without it when >> not available. "hwlock" is another property which consider several >> drivers as optional. Also consider SoCs in early upstreaming phases >> when the device tree is merged with "dmas" or "hwlock" properties, >> but the corresponding drivers are not yet upstreamed. It's not nice >> to defer probing of all these devices for a long time. >> >> I wonder if it wouldn't be a better approach to just probe all devices >> and record the device(node) they are waiting on. Then you know that you >> don't need to probe them again until the device they are waiting for >> is available. > > That actually breaks things in a worse sense. There are cases where > the consumer driver is built in and the optional supplier driver is > loaded at boot. Without fw_devlink and the deferred probe timeout, we > end up probing the consumer with limited functionality. With the > current setup, sure we delay some probes a bit but at least everything > works with the right functionality. And you can reduce or remove the > delay if you want to optimize it. I have a system that doesn't use stdout-path and has the bootloader set console= either to ttynull when secure booting or to an UART when booting normally. How would I optimize the kernel to avoid my UART being loaded after DMA controller probe without touching the bootloader? Cheers, Ahmad > > -Saravana > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |