From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F595C433EF for ; Thu, 23 Jun 2022 19:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229615AbiFWTNe (ORCPT ); Thu, 23 Jun 2022 15:13:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiFWTNS (ORCPT ); Thu, 23 Jun 2022 15:13:18 -0400 Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 825086360A for ; Thu, 23 Jun 2022 11:17:42 -0700 (PDT) Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-318889e6a2cso2334207b3.1 for ; Thu, 23 Jun 2022 11:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p5I7lwaxg3ERNdh1USCLL4gsDNHBsesSwjbd6s/cNSY=; b=HJ6V5dP4AOSSwMe7wcgfuDX/clqSs9gbT7weCDHIdQMoMq/tOG9jM9s9f0AVeRDeGC 6i5p1kAgTQDU+NkxVXG7PAUzfambG55P1F4tcUrSXCH+tWquWb0GtqXEg+nA8Dchanzn HRW1WDYo5QE/5U8e3rDPy8HatPAjphhwWyXIsW7bt1MI5QLeN/88pxyeRjlGf5flDm1D YFJuq5/ejD0Xbcv02GN2um3+I2gA0lfF+XZedqX37LXzCxA7LGwtr/E9d95mnlTXfr5z bsQ/MyVF23+eCsn7mS+xZwrqAGSVGxeXvWRjd8N+eXvQsslukdaOR7K9u2E0eGYmGLYO oqag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p5I7lwaxg3ERNdh1USCLL4gsDNHBsesSwjbd6s/cNSY=; b=KdKVFld9Iuw73xng0OMspZY9WXnHUfZI401Lk0j/QHtMCVuScBNBs+w2ZpXBjlmN3L 1RX3XmiCaUcu5IAWNlfkccagzY1NVUunQenvQxyL97OO/OqTsXPdEuUTCVyAICM88Cnt X2cUdJSJlLz1ok/nmLUuDTEj2rt2MDof5GLzZbTMDOhq2D4s9nCFPkKsCFhsOlDJIuaD c/Qdtfbul21ySbz++BQClFn0GvtsrTFd9xFC6KgPEzKVrgAuid+6+eD5Duj9jKL1TNBo dNiC1smhE5xmks2oG857L/GYtoWGc6NUXxkgL4RazF7MLIqoQyLsRq2hG8xSw12fQI84 a+zA== X-Gm-Message-State: AJIora/f8eJoXG9aNtt7W4ZRH8D8XBeKz3Cwhsch1DmuXi7p5+vGhT/C vwErqV945KaLAePVD2ZAiFl9vG2qgRiQR4E4GXiJyA== X-Google-Smtp-Source: AGRyM1uilfZ0qukZAX74cZpSq2rgoRk3U9n8kYZfj2P22qz/S+S3tWRG5TkEZw7C9nYFw+KJ3ktelnjUqr/SV5UBD5M= X-Received: by 2002:a81:4896:0:b0:317:f767:95f8 with SMTP id v144-20020a814896000000b00317f76795f8mr12660216ywa.218.1656008259994; Thu, 23 Jun 2022 11:17:39 -0700 (PDT) MIME-Version: 1.0 References: <20220623080344.783549-1-saravanak@google.com> <20220623080344.783549-3-saravanak@google.com> <20220623100421.GY1615@pengutronix.de> In-Reply-To: From: Saravana Kannan Date: Thu, 23 Jun 2022 11:17:03 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] of: base: Avoid console probe delay when fw_devlink.strict=1 To: Ahmad Fatoum Cc: sascha hauer , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 23, 2022 at 10:36 AM Ahmad Fatoum wrote: > > 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? > Thanks for the report Ahmad. I think someone else reported a similar thing in another thread. I plan to take a look at it. It should be possible to find the device and set the flag for those devices too. -Saravana