Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1494354pxk; Fri, 2 Oct 2020 10:52:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCR9AzzyLPsQfbYZgMokbeqnM50DjtG6kn/GTC/tQUO/aEahaNQdLKoXI/Xn7cQPdNsAn/ X-Received: by 2002:a17:907:2076:: with SMTP id qp22mr3434908ejb.358.1601661155271; Fri, 02 Oct 2020 10:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601661155; cv=none; d=google.com; s=arc-20160816; b=x1bejMDKFueZaF+YQ0MTw5LcMEvLzZ3KruZ81B9DmlBTzs2Wz2tFDjSUBKguEDFJAo XqDSzEZCmom/51MNIgMu7B32lWR5CbMGD6NJtwBthb4YyppQQ72iT+9PdO6tZt/FbLFl Z25zMdZtOoW3F/E7cn4oNj1wC5GFIXMxHTGFuc2PN9Z0+HQvmC6Wumdwr7DvAbeGHwPI qluFAfOW3z9MhguVW82mofmyzm1WOGqfWnVAG69ZFNc0Kuh34+SiWMtVUh62AmwTtr7s N3sbDwonGL9fKMbZpKcgDgyFTI7ftTqoSTUHcm9B+2s/3IQbmvU24emLwRJzR5Xzwff0 Wavg== 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=QS77N6+CVhOOVc5MzAkxD23OY8NSVhkBewUyPpHdYlc=; b=l4B6OcZK1hcuL7MEuZ9Mb6mqLtP6jmMlr3DnWFg9GTaov9WE79C6gblPcOcXhjeXus FWWJtKjWg1RGyoBY4ItYSUN+5l0p0Z/Pb7CxG2ba/bItQiSGkUY+RuVCnQ4sYQfnYJPt oX6Zaa3+XhAFpcajXVi73kFURs1Dr0qEh3cGf2C5lxCmMpGNX6w9ObuMb8xcum445DBa WkAka2e3m06IcArXVKH1RDk/kORqyieLiO5wAhXKGsmB7wz0vaGh4j5+TXXDCw8niZrV nYaDJf89a6urZEkLNZ+a3NOd9XmsRFWbfBtkVN9Eu+Mnvm8ubSB+pHAoVGpblM355hD1 h9uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=K7c10yve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 16si1439930edv.551.2020.10.02.10.52.12; Fri, 02 Oct 2020 10:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=K7c10yve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2388312AbgJBRs7 (ORCPT + 99 others); Fri, 2 Oct 2020 13:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387602AbgJBRs7 (ORCPT ); Fri, 2 Oct 2020 13:48:59 -0400 Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F3AC0613E2 for ; Fri, 2 Oct 2020 10:48:59 -0700 (PDT) Received: by mail-yb1-xb41.google.com with SMTP id k18so1763253ybh.1 for ; Fri, 02 Oct 2020 10:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QS77N6+CVhOOVc5MzAkxD23OY8NSVhkBewUyPpHdYlc=; b=K7c10yve+m/Ym4Ka9KOtXjRc9l7h/9hkwYlCtP8U1y4i6VsUSwagmYsszDYzzPWyAP doQk7cUQ9E4iFl5joVcME6pkx0+Pj0NsYO3HE/qyf6VtbK2Diua2nRDGfeOBwoWALiim +Ebyf6fiS6NK0ZzNY7ZIsUiq/eTsSs7/ZOWOi3yFac6jJuSuHA4dSGIgkHWCbpBogq9q eYFwMnw1+qz+fp/jKT6fALkj+dHmdwbAH14KNPVxicedjtSDsBGonfJnlK3l+dBoLnRC PE82kdBmi+UIMhTe/CkBfifxDFqTUbuUX0IJm9YVYH55/UwM/DFQdEknfpHW3ogGenQe rVPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QS77N6+CVhOOVc5MzAkxD23OY8NSVhkBewUyPpHdYlc=; b=qthhrsFvnA8Fv5zCtQuWdmMI9uJ27vdJY4FvFjQ1E3HSY6y9FVR1yHo1OUwH3V8+/4 p4d4hAzEAzPVoTmm/zjxSB6yWujjS37qy5FbUk5alS+uNjMTDbsk1dA/hLjzwfNnLS4d y2TPrdBwvRoeTFe2ixw5b/U6ppTF0GBIvK4mLQ22pzQmKHfyp7InkuqdMoVE5E4lZhvT 7YfVABcmtq1IWhDGsumnnNo/CjX4dkwPk8o9BgNR2z8BPmRF2iIPEflIkjgPXHcjc3R2 gbaLjQITSeGtvuhw6BXtmhBI6ear5FbFw6jviAmSnH+rYt55BQMcw+TifReM/R+LnXLd rd5w== X-Gm-Message-State: AOAM532iP6bUX9lWETvv4okm1uwO26wGvaAhtWjz2JRk1WsKPrkSvzbg 7SGWuzBpyPUgs7JQ23HwyYCBQGNHA8+X8mvrLNUnrQ== X-Received: by 2002:a05:6902:725:: with SMTP id l5mr4087154ybt.346.1601660938079; Fri, 02 Oct 2020 10:48:58 -0700 (PDT) MIME-Version: 1.0 References: <20201001225952.3676755-1-saravanak@google.com> <20201001231922.GG3722@pendragon.ideasonboard.com> <17bdc3f0-d816-151a-fef2-88cd38fc8621@ti.com> In-Reply-To: From: Saravana Kannan Date: Fri, 2 Oct 2020 10:48:22 -0700 Message-ID: Subject: Re: [PATCH v1] of: platform: Batch fwnode parsing in the init_machine() path To: Grygorii Strashko Cc: Laurent Pinchart , Rob Herring , Frank Rowand , Geert Uytterhoeven , Greg Kroah-Hartman , Linux-OMAP , Linux PM , Peter Ujfalusi , "Rafael J. Wysocki" , Tomi Valkeinen , Tony Lindgren , Ulf Hansson , Android Kernel Team , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 2, 2020 at 8:03 AM 'Grygorii Strashko' via kernel-team wrote: > > > > On 02/10/2020 14:40, Grygorii Strashko wrote: > > > > > > On 02/10/2020 02:19, Laurent Pinchart wrote: > >> Hi Saravana, > >> > >> Thank you for the patch. > >> > >> On Thu, Oct 01, 2020 at 03:59:51PM -0700, Saravana Kannan wrote: > >>> When commit 93d2e4322aa7 ("of: platform: Batch fwnode parsing when > >>> adding all top level devices") optimized the fwnode parsing when all top > >>> level devices are added, it missed out optimizing this for platform > >>> where the top level devices are added through the init_machine() path. > >>> > >>> This commit does the optimization for all paths by simply moving the > >>> fw_devlink_pause/resume() inside of_platform_default_populate(). > >> > >> Based on v5.9-rc5, before the patch: > >> > >> [ 0.652887] cpuidle: using governor menu > >> [ 12.349476] No ATAGs? > >> > >> After the patch: > >> > >> [ 0.650460] cpuidle: using governor menu > >> [ 12.262101] No ATAGs? > >> > >> :-( > > > > This is kinda expected :( because omap2 arch doesn't call of_platform_default_populate() > > > > Call path: > > board-generic.c > > DT_MACHINE_START() > > .init_machine = omap_generic_init, > > > > omap_generic_init() > > pdata_quirks_init(omap_dt_match_table); > > of_platform_populate(NULL, omap_dt_match_table, > > omap_auxdata_lookup, NULL); > > > > Other affected platforms > > arm: mach-ux500 > > some mips > > some powerpc > > > > there are also case when a lot of devices placed under bus node, in such case > > of_platform_populate() calls from bus drivers will also suffer from this issue. > > > > I think one option could be to add some parameter to _populate() or introduce new api. > > > > By the way, is there option to disable this feature at all? > > Is there Kconfig option? > > Is there any reasons why such complex and time consuming code added to the kernel and not implemented on DTC level? > > > > > > Also, I've came with another diff, pls check. > > > > [ 0.000000] Booting Linux on physical CPU 0x0 > > [ 0.000000] Linux version 5.9.0-rc6-01791-g9acba6b38757-dirty (grygorii@grygorii-XPS-13-9370) (arm-linux-gnueabihf-gcc (GNU Toolcha0 > > [ 0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=10c5387d > > [ 0.000000] CPU: div instructions available: patching division code > > [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache > > [ 0.000000] OF: fdt: Machine model: TI AM5718 IDK > > ... > > [ 0.053443] cpuidle: using governor ladder > > [ 0.053470] cpuidle: using governor menu > > [ 0.089304] No ATAGs? > > ... > > [ 3.092291] devtmpfs: mounted > > [ 3.095804] Freeing unused kernel memory: 1024K > > [ 3.100483] Run /sbin/init as init process > > > > > > > > ------ >< --- > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > > index 071f04da32c8..4521b26e7745 100644 > > --- a/drivers/of/platform.c > > +++ b/drivers/of/platform.c > > @@ -514,6 +514,12 @@ static const struct of_device_id reserved_mem_matches[] = { > > {} > > }; > > > > +static int __init of_platform_fw_devlink_pause(void) > > +{ > > + fw_devlink_pause(); > > +} > > +core_initcall(of_platform_fw_devlink_pause); > > + > > static int __init of_platform_default_populate_init(void) > > { > > struct device_node *node; > > @@ -538,9 +544,7 @@ static int __init of_platform_default_populate_init(void) > > } > > > > /* Populate everything else. */ > > - fw_devlink_pause(); > > of_platform_default_populate(NULL, NULL, NULL); > > - fw_devlink_resume(); > > > > return 0; > > } > > @@ -548,6 +552,7 @@ arch_initcall_sync(of_platform_default_populate_init); > > > > static int __init of_platform_sync_state_init(void) > > { > > + fw_devlink_resume(); > > ^ it seems has to be done earlier, like > +static int __init of_platform_fw_devlink_resume(void) > +{ > + fw_devlink_resume(); > + return 0; > +} > +device_initcall_sync(of_platform_fw_devlink_resume); This will mean no device will probe until device_initcall_sync(). Unfortunately, I don't think we can make such a sweeping assumption. -Saravana