mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Collins <collinsd@codeaurora.org>
To: Saravana Kannan <saravanak@google.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@android.com
Subject: Re: [PATCH v3 0/4] Solve postboot supplier cleanup and optimize probe ordering
Date: Tue, 2 Jul 2019 17:03:49 -0700	[thread overview]
Message-ID: <7900c670-5b3a-f950-dec9-70d98d94a84f@codeaurora.org> (raw)
In-Reply-To: <20190702004811.136450-1-saravanak@google.com>

Hello Saravana,

On 7/1/19 5:48 PM, Saravana Kannan wrote:
...
> TODO:
> - For the case of consumer child sub-nodes being added by a parent
>   device after late_initcall_sync we might be able to address that by
>   recursively parsing all child nodes and adding all their suppliers as
>   suppliers of the parent node too. The parent probe will add the
>   children before its probe is completed and that will prevent the
>   supplier's sync_state from being executed before the children are
>   probed.
> 
> But I'll write that part once I see how this series is received.

I don't think that this scheme will work in all cases.  It can also lead
to probing deadlock.

Here is an example:

Three DT devices (top level A with subnodes B and C):
/A
/A/B
/A/C
C is a consumer of B.

When device A is created, a search of its subnodes will find the link from
C to B.  Since device B hasn't been created yet, of_link_to_suppliers()
will fail and add A to the wait_for_suppliers list.  This will cause the
probe of A to fail with -EPROBE_DEFER (thanks to the check in
device_links_check_suppliers()).  As a result device B will not be created
and device A will never probe.

You could try to resolve this situation by detecting the cycle and *not*
adding A to the wait_for_suppliers list.  However, that would get us back
to the problem we had before.  A would be allowed to probe which would
then result in devices being added for B and C.  If the device for B is
added before C, then it would be allowed to immediately probe and
(assuming this all takes place after late_initcall_sync thanks to modules)
its sync_state() callback would be called since no consumer devices are
linked to B.

Please note that to change this example from theoretical to practical,
replace "A" with apps_rsc, "B" with pmi8998-rpmh-regulators, and "C" with
pm8998-rpmh-regulators in [1].

Take care,
David

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sdm845-mtp.dts?h=v5.2-rc7#n55

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2019-07-03  0:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02  0:48 Saravana Kannan
2019-07-02  0:48 ` [PATCH v3 1/4] driver core: Add support for linking devices during device addition Saravana Kannan
2019-07-02  0:48 ` [PATCH v3 2/4] of/platform: Add functional dependency link from DT bindings Saravana Kannan
2019-07-02  1:31   ` Rob Herring
2019-07-02  3:25     ` Saravana Kannan
2019-07-15 14:26       ` Frank Rowand
2019-07-15 14:38         ` Frank Rowand
2019-07-15 18:40           ` Saravana Kannan
2019-07-16  1:05             ` Frank Rowand
2019-07-16 22:56               ` Rob Herring
2019-07-16 23:49                 ` Saravana Kannan
2019-07-19  2:49                 ` Frank Rowand
2019-07-02  0:48 ` [PATCH v3 3/4] driver core: Add sync_state driver/bus callback Saravana Kannan
2019-07-02  0:48 ` [PATCH v3 4/4] driver core: Add edit_links() callback for drivers Saravana Kannan
2019-07-02  1:46   ` Rob Herring
2019-07-02  3:40     ` Saravana Kannan
2019-07-03  0:03 ` David Collins [this message]
2019-07-03  0:59   ` [PATCH v3 0/4] Solve postboot supplier cleanup and optimize probe ordering Saravana Kannan
2019-07-03 22:26     ` Saravana Kannan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7900c670-5b3a-f950-dec9-70d98d94a84f@codeaurora.org \
    --to=collinsd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=saravanak@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®