Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1587335pxk; Fri, 2 Oct 2020 13:33:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmIikka1AmmXTfCVRyAZGjyCGTjrNtbork2PY+0smLks71kuVqJ3oQOJycJ+bxMJ3RCivB X-Received: by 2002:aa7:d783:: with SMTP id s3mr4503639edq.214.1601670813479; Fri, 02 Oct 2020 13:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601670813; cv=none; d=google.com; s=arc-20160816; b=P/9R1AH03xwlysmt06Pzss7GTPKWg7obNZ5hOFv+WsqPpz+8+C8ranYViccA1hutdQ QQx2Z4wi8zsRTmrvNg4a36kDelAsqMzRhIRtc02wzUZnbwD1LKjWJl7MfOIbQefRJuht ojnYWD1hNdhkKFuFJl9i5Cg2l4FAuEGwismJPFcJuAI+W7pLk2puH+vK42WPHEY5Qm8l ZzXcJPTCmYwg0dXZyQtu2OWJPk2MCOigdmyQEdHsEblt294/TJ2l1FMRyMV4MK1ikIXC SUiKkq3oLD4OHtZHXl2MSAZBXhZRY//eFe+y/1+RGJ0X5+cwWGKCJu0MIaMtsE+gFJUv Ps9Q== 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=yhIJp8QM2brZ/bsFoo98qHNoq3aVvjqJHLZhYw8qXTE=; b=PrEG+KSTADZEFhpHXujqNkkzQNv53DIX9laulvoUYhyUET6rsIWjF5qQEvZfRFzgfR MvTRE55gRU1ME3mEQfT63RAHL8hglksjuCf0uhzT72u65BiZocdDGBUOubtN06kWBTtg e1MQqQa3ngxyeWyyuC7z91XbLcxXbSnrGb6W3//K1IG/U9MetLCFhUhNBCn3YbfeUMy/ TSkyUY8yIOxspRMwOUCDOsNQfuxUfFAf7LkWdFf210ae/BbYlyq+YfsxnSQ4nwEhfBLK +YKRZQ0HaYfVM7+momWMMaqlDCEWc97sG9UqLRRTgKsQEWSIUUI0jq2m3BL5OH7ssYEG KENw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WwK+A1Vq; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si1363944ejs.327.2020.10.02.13.33.10; Fri, 02 Oct 2020 13:33:33 -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=@kernel.org header.s=default header.b=WwK+A1Vq; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725788AbgJBUaC (ORCPT + 99 others); Fri, 2 Oct 2020 16:30:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:36164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgJBU37 (ORCPT ); Fri, 2 Oct 2020 16:29:59 -0400 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A08EF20738; Fri, 2 Oct 2020 20:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601670598; bh=Jq5FzMIKmv4HKvsTHTbzBndTI/C6/P9+f3xYup51fmQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WwK+A1Vq7uhVXQ6AEmIpf3a+ikFA9l00RGtIbRbn7svPlKReu3uJ2XDx4v9mTHkTd BqyTfMjccoipnL81D2qcj2Nf/t1e7JYGdsKdCM6HH9KysPZvHZjN5nznCks6UFbILu zbvX4qFnrZ4ZC2FKS/kcgfrWAK0tlbs3Ie0RdyW0= Received: by mail-ot1-f53.google.com with SMTP id y5so2660532otg.5; Fri, 02 Oct 2020 13:29:58 -0700 (PDT) X-Gm-Message-State: AOAM531eVWlxxd36c/4qpI9bV/qRpLrKVzhzU6yPnKlnnHyWgX5/ym4/ z4K8THe8kfNFrue5aNeHGiKe9JPaug72PQiHMg== X-Received: by 2002:a9d:7998:: with SMTP id h24mr3076133otm.192.1601670597975; Fri, 02 Oct 2020 13:29:57 -0700 (PDT) MIME-Version: 1.0 References: <20201001225952.3676755-1-saravanak@google.com> In-Reply-To: From: Rob Herring Date: Fri, 2 Oct 2020 15:29:46 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1] of: platform: Batch fwnode parsing in the init_machine() path To: Saravana Kannan Cc: Frank Rowand , Geert Uytterhoeven , Greg Kroah-Hartman , Grygorii Strashko , Laurent Pinchart , linux-omap , "open list:THERMAL" , Peter Ujfalusi , "Rafael J. Wysocki" , Tomi Valkeinen , Tony Lindgren , Ulf Hansson , Android Kernel Team , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" 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 12:52 PM Saravana Kannan wrote: > > On Fri, Oct 2, 2020 at 7:08 AM Rob Herring wrote: > > > > On Thu, Oct 1, 2020 at 5:59 PM 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(). > > > > > > Reported-by: Tomi Valkeinen > > > Signed-off-by: Saravana Kannan > > > --- > > > drivers/of/platform.c | 19 +++++++++++++++---- > > > 1 file changed, 15 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > > > index 071f04da32c8..79972e49b539 100644 > > > --- a/drivers/of/platform.c > > > +++ b/drivers/of/platform.c > > > @@ -501,8 +501,21 @@ int of_platform_default_populate(struct device_node *root, > > > const struct of_dev_auxdata *lookup, > > > struct device *parent) > > > { > > > - return of_platform_populate(root, of_default_bus_match_table, lookup, > > > - parent); > > > + int ret; > > > + > > > + /* > > > + * fw_devlink_pause/resume() are only safe to be called around top > > > + * level device addition due to locking constraints. > > > + */ > > > + if (!root) > > > + fw_devlink_pause(); > > > + > > > + ret = of_platform_populate(root, of_default_bus_match_table, lookup, > > > + parent); > > > > of_platform_default_populate() vs. of_platform_populate() is just a > > different match table. I don't think the behavior should otherwise be > > different. > > > > There's also of_platform_probe() which has slightly different matching > > behavior. It should not behave differently either with respect to > > devlinks. > > So I'm trying to do this only when the top level devices are added for > the first time. of_platform_default_populate() seems to be the most > common path. For other cases, I think we just need to call > fw_devlink_pause/resume() wherever the top level devices are added for > the first time. > As I said in the other email, we can't add > fw_devlink_pause/resume() by default to of_platform_populate(). If you detect it's the first time, you could? > > Do you have other ideas for achieving "call fw_devlink_pause/resume() > only when top level devices are added for the first time"? Eliminate the cases not using of_platform_default_populate(). There's 2 main reasons for the non default cases. The first is auxdata. Really, for any modern platform that people care about (and care about the boot time), they should not be using auxdata. That's just for the DT transition. You know, a temporary thing from 9 years ago. The 2nd is having some parent device. This is typically an soc_device. I really think this is kind of dumb. We should either have the parent device always or never. After all, everything's an SoC right? Of course changing that will break some Android systems since they like to use non-ABI sysfs device paths. There could also be some initcall ordering issues. IIRC, in the last round of cleanups in this area, at91 gpio/pinctrl had an issue with that. I think I have a half done fix for that I started. Rob