Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3214122iog; Mon, 27 Jun 2022 11:35:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5eyOAje9JDbB2SxVphMmH7SQG6mMivN30VVfQyvXqQHz+Z/oJHdI0mzHmbLWbOHthBLr1 X-Received: by 2002:a17:902:7c13:b0:16a:4e69:a5c3 with SMTP id x19-20020a1709027c1300b0016a4e69a5c3mr16041152pll.132.1656354938552; Mon, 27 Jun 2022 11:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656354938; cv=none; d=google.com; s=arc-20160816; b=GweTLRVcId2HgVHNJUYJPumNT1EkVZ4U11q9gDQ/t7rMw8b6o1TDOzDc+9/oJulmaN /O9f94Q3J7BN15vwW3RwdiI/kC9AK2IPTEdN4Ftsoa6obJ3Q1TqQqnUI7vz05+Axp96x OJKMevoIm6Z7yyBiN9z0/N0UQqhORVCd7NKhQLzs9oRRLe4tbQt9SyoEvPQU6KM5VMuB CI0w0U/wS0UXTj4uBrssNBWiJ2OjbcJCQtQXfKHJIcVOp4uuDAJvekq7fD/IMPKwBsnC 0AXRpImEGLCVxPwZl5wy5LDqBn2zYajUAuADPF57JqcS++CGCdAMOw9fYjgDe9/9+Gzh W9oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zAvy14WQSJajEvtEq9Z9V458WL9rypKqsSWZ5e8ff+Q=; b=YPSnQ5ihOahsDh/54PjYMb1dO1Yd7WRm2hXzK4dFSMqPivEAjJCzmkWi8WyCzbX32q ugokbPI3d+2TDd+x4QX8N7U0i0iGa82ld25Ebz979+Mh/EVE/KRqn1hljau7/eUeBgcZ wJJpZ/gB1UrsGge+fMKnprmGT1EHAsq1TMTY66F6qvklMaXHqj6G0Wi0AdIf1X3uyfaT om5p3Xnfix7Ke9DvquGwVaVX6nw4lCDCZs+GQlv1SjRicHpCUY5OCDKXblNnbQ5sE+ek pQechtzUkTDMTFTT0ThxszISS+kLqgv0H8g/wcdkCbxXq6q3G24Bu1wa70UiOHmeHFyv CUgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QfczmHRT; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 130-20020a630188000000b00408a74d3d14si15000594pgb.713.2022.06.27.11.35.26; Mon, 27 Jun 2022 11:35:38 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=QfczmHRT; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235417AbiF0SVY (ORCPT + 99 others); Mon, 27 Jun 2022 14:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240181AbiF0SVW (ORCPT ); Mon, 27 Jun 2022 14:21:22 -0400 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0087910561 for ; Mon, 27 Jun 2022 11:21:19 -0700 (PDT) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-2ef5380669cso93837647b3.9 for ; Mon, 27 Jun 2022 11:21:19 -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=zAvy14WQSJajEvtEq9Z9V458WL9rypKqsSWZ5e8ff+Q=; b=QfczmHRT9/HR8HyazKLbsqrs7cCP2iZKaxG/OXGSPnAc8W5YAiaVA0WqjZ3/6QtXqU 42K81l24QIf3XynW/JKjRGJ7dmfzwI2FUm73m5CnsNDIqxjEz+NWZjbRqeUpE3CO+oZH +WHVevlpyQHs4NMeAMNGbQrzcjZNAN6YiP+T/yfSSMD0p0fn3Nshe7kDoUKHwoSYa4N3 VnE5Z7u+uJPgYCZdcfgQYEKpStJa5alN/Ge9h9ME6zGeGt1uUwucGuzxD4iyBvikWn6I UNKi3EkIpSabWBkxoc2zg+IeRkTOZHzN8h/RLyTzMjG2hCOwCIaltZxdV6oluuLg1E7j RMQA== 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=zAvy14WQSJajEvtEq9Z9V458WL9rypKqsSWZ5e8ff+Q=; b=Xf3hBqAxkoSMcaK2l0oCyujqhRt/Ovczy1+puv+Rf4R8M/9NB/vX3sT40mgvMSpVNt BQdo/p0LR3HVH3tXqluzNt7AWfx31Mj+5/zXobobhr+blRML3SMK4iGf8tU9bD1q0bzk /yyrNpy5i4SWvmY9iZWkxp0LdUj8mvBfugOfdHL4uc7jZP6Ur9a9J+peRaftLBZX+uhO 6T0p7l0OtdK3p/RsicRK9i6CnuJbsNDMQnIgNZx7m2iLrH3ssQtb0SfHFZBTvcQii0I1 DWAGBTW+3cdlndRBABrLsGF7vshIRnM4/xpXjY9wVkpsttZNJw32iqjytwJLRdKe4vdI o6Wg== X-Gm-Message-State: AJIora98o5+8TUMUWldR8fC49Zyv5Gyo6fJe5QZQo7MpZarEKygNHDwb JTROujM/YpQApPNm1PtihLsFwtLhpaRJ9Tdd+ohPTQ== X-Received: by 2002:a0d:eace:0:b0:317:87ac:b3a8 with SMTP id t197-20020a0deace000000b0031787acb3a8mr16855244ywe.126.1656354078827; Mon, 27 Jun 2022 11:21:18 -0700 (PDT) MIME-Version: 1.0 References: <20220623080344.783549-1-saravanak@google.com> <20220623080344.783549-3-saravanak@google.com> <20220623100421.GY1615@pengutronix.de> <20220627175046.GA2644138-robh@kernel.org> In-Reply-To: <20220627175046.GA2644138-robh@kernel.org> From: Saravana Kannan Date: Mon, 27 Jun 2022 11:20:42 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] of: base: Avoid console probe delay when fw_devlink.strict=1 To: Rob Herring Cc: sascha hauer , Greg Kroah-Hartman , "Rafael J. Wysocki" , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown , peng fan , kevin hilman , ulf hansson , len brown , pavel machek , joerg roedel , will deacon , andrew lunn , heiner kallweit , russell king , "david s. miller" , eric dumazet , jakub kicinski , paolo abeni , linus walleij , hideaki yoshifuji , david ahern , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, iommu@lists.linux-foundation.org, netdev@vger.kernel.org, linux-gpio@vger.kernel.org, kernel@pengutronix.de, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Mon, Jun 27, 2022 at 10:50 AM Rob Herring wrote: > > On Thu, Jun 23, 2022 at 12:04:21PM +0200, 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. > > Can't we have a driver flag 'I have optional dependencies' that will > trigger probe without all dependencies and then the driver can defer > probe if required dependencies are not yet met. Haha... that's kinda what I'm working on right now. But named intentionally in a more limited sense of "I can't wait for the timeout" where fw_devlink will relax and allow the driver to probe (and have it make the call) once we hit late_initcall(). I'm explicitly limiting it to "timeout" because we don't want everyone adding this flag everytime they hit an issue. That'll beat the point of fw_devlink=on. Also, setting the flag for a driver to fix one system might break another system because in the other system the user might want to wait for the timeout because the supplier drivers would be loaded before the timeout. Another option is to restart the timer (if it hasn't expired) when filesystems get mounted (in addition to the current "when new driver gets registered). That way, we might be able to drop the timeout from 10s to 5s. -Saravana