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 X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BBF2C3404B for ; Tue, 18 Feb 2020 22:51:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B053207FD for ; Tue, 18 Feb 2020 22:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582066314; bh=JVw1/p6FsCoqbFDqyFKAI1rqvqyAc6BMfIKN4ddINoY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=W1SsYysNgE7wvh9S+6s61G2AQ7X659msLhIt3V96RuOh8rZ2x2sdk385ziO6fQF2D qSpoNzln8QWOhTdmD0DFZzPXUOIbbFaYhec44R+5Cj916VHffYewBZSLJxaAVICY/z UZQ4HqnkLIDOdqyM+6eZEHw4jQUiNd3EgRhcr7zs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726852AbgBRWvw (ORCPT ); Tue, 18 Feb 2020 17:51:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:33792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726641AbgBRWvw (ORCPT ); Tue, 18 Feb 2020 17:51:52 -0500 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 5598024670; Tue, 18 Feb 2020 22:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582066311; bh=JVw1/p6FsCoqbFDqyFKAI1rqvqyAc6BMfIKN4ddINoY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YpnOCoaOARlUo9rIPwheEZK5IyhakaAX1XnEh505iecYtcQ8SEISOzJujPOHQCZX3 daj+f64uNxcQzCzerBrnps0WKfP99Ga1Bqur6KfuBteNP9UnGYYKo7mGTEnjt6bh/M VYXbuJCthr56ppJQ896BnSJN2rz8/bewhbTUR+9M= Received: by mail-qk1-f174.google.com with SMTP id u124so20746845qkh.13; Tue, 18 Feb 2020 14:51:51 -0800 (PST) X-Gm-Message-State: APjAAAVMS5VXyubtyunRMRv/Az822nPf2t2DpP68anXRnEcuyuHW8Qpn Sg0hfgZLVyLd/HEyGPhk2LqzRiguvfs+RlIffg== X-Google-Smtp-Source: APXvYqzOycS54fdMe+Mi6jmD1eUPFXsnxiEYEUbIZ2YhQGSynwd5BRWP7iCohzeOF1d0omgODT8b2Ln6vs5ynpThWSg= X-Received: by 2002:a37:5347:: with SMTP id h68mr20566408qkb.393.1582066310364; Tue, 18 Feb 2020 14:51:50 -0800 (PST) MIME-Version: 1.0 References: <20200218220748.54823-1-john.stultz@linaro.org> In-Reply-To: <20200218220748.54823-1-john.stultz@linaro.org> From: Rob Herring Date: Tue, 18 Feb 2020 16:51:39 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/2] driver core: Rework logic in __driver_deferred_probe_check_state to allow EPROBE_DEFER to be returned for longer To: John Stultz Cc: lkml , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Greg Kroah-Hartman , "open list:THERMAL" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 18, 2020 at 4:07 PM John Stultz wrote: > > Due to commit e01afc3250255 ("PM / Domains: Stop deferring probe > at the end of initcall"), along with commit 25b4e70dcce9 > ("driver core: allow stopping deferred probe after init") after > late_initcall, drivers will stop getting EPROBE_DEFER, and > instead see an error causing the driver to fail to load. > > That change causes trouble when trying to use many clk drivers > as modules, as the clk modules may not load until much later > after init has started. If a dependent driver loads and gets an > error instead of EPROBE_DEFER, it won't try to reload later when > the dependency is met, and will thus fail to load. > > This patch reworks some of the logic in > __driver_deferred_probe_check_state() so that if the > deferred_probe_timeout value is set, we will return EPROBE_DEFER > until that timeout expires, which may be after initcalls_done > is set to true. > > Specifically, on db845c, this change (when combined with booting > using deferred_probe_timeout=30) allows us to set SDM_GPUCC_845, > QCOM_CLK_RPMH and COMMON_CLK_QCOM as modules and get a working > system, where as without it the display will fail to load. I would change the default for deferred_probe_timeout to 30 and then regulator code can rely on that. Curious, why 30 sec is fine now when you originally had 2 min? I'd just pick what you think is best. I doubt Mark had any extensive experiments to come up with 30sec. > Cc: Rob Herring > Cc: "Rafael J. Wysocki" > Cc: Kevin Hilman > Cc: Ulf Hansson > Cc: Pavel Machek > Cc: Len Brown > Cc: Todd Kjos > Cc: Bjorn Andersson > Cc: Liam Girdwood > Cc: Mark Brown > Cc: Greg Kroah-Hartman > Cc: linux-pm@vger.kernel.org > Signed-off-by: John Stultz > --- > v2: > * Add calls to driver_deferred_probe_trigger() after the two minute timeout, > as suggested by Bjorn > * Minor whitespace cleanups > * Switch to 30 second timeout to match what the regulator code is doing as > suggested by Rob. > v3: > * Rework to reuse existing deferred_probe_timeout value, suggested by Rob > * Dropped Fixes: tags as Rob requested (Not my hill to die on :) > --- > drivers/base/dd.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > index b25bcab2a26b..9d916a7b56a6 100644 > --- a/drivers/base/dd.c > +++ b/drivers/base/dd.c > @@ -237,13 +237,12 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); > > static int __driver_deferred_probe_check_state(struct device *dev) > { > - if (!initcalls_done) > - return -EPROBE_DEFER; > - > - if (!deferred_probe_timeout) { > + if (initcalls_done && !deferred_probe_timeout) { > dev_WARN(dev, "deferred probe timeout, ignoring dependency"); > return -ETIMEDOUT; > } > + if (!initcalls_done || deferred_probe_timeout > 0) > + return -EPROBE_DEFER; > > return 0; > } > -- > 2.17.1 >