linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: reduce the number of PROBE_DEFERs
@ 2013-08-20 10:01 Jean-Francois Moine
  2013-08-20 10:13 ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Francois Moine @ 2013-08-20 10:01 UTC (permalink / raw)
  To: linux-arm-kernel

This patch populates the platform from the device tree into two steps:
the first step creates the nodes that are referenced by a phandle,
the second step creates the other nodes.

This permits to reduce the number of PROBE_DEFERs.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
A better way to reduce probe deferral could be sorting the nodes
according to their phandle level in the DT blob at compilation time ...
---
 drivers/of/platform.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index e0a6514..a2ea858 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -382,8 +382,23 @@ static int of_platform_bus_create(struct device_node *bus,
 	if (!dev || !of_match_node(matches, bus))
 		return 0;
 
+	/* first step: create the nodes that are referenced by phandle */
 	for_each_child_of_node(bus, child) {
-		pr_debug("   create child: %s\n", child->full_name);
+		if (child->phandle == 0)
+			continue;
+		pr_debug("   create child 1: %s\n", child->full_name);
+		rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
+		if (rc) {
+			of_node_put(child);
+			return rc;
+		}
+	}
+
+	/* second step: create the other nodes */
+	for_each_child_of_node(bus, child) {
+		if (child->phandle != 0)
+			continue;
+		pr_debug("   create child 2: %s\n", child->full_name);
 		rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
 		if (rc) {
 			of_node_put(child);


-- 
Ken ar c'henta?	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] of: reduce the number of PROBE_DEFERs
  2013-08-20 10:01 [PATCH] of: reduce the number of PROBE_DEFERs Jean-Francois Moine
@ 2013-08-20 10:13 ` Grant Likely
  2013-08-22  8:00   ` Jean-Francois Moine
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2013-08-20 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 20, 2013 at 11:01 AM, Jean-Francois Moine <moinejf@free.fr> wrote:
> This patch populates the platform from the device tree into two steps:
> the first step creates the nodes that are referenced by a phandle,
> the second step creates the other nodes.
>
> This permits to reduce the number of PROBE_DEFERs.
>
> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> ---
> A better way to reduce probe deferral could be sorting the nodes
> according to their phandle level in the DT blob at compilation time ...

Have you got measurements or statistics that show this making a
difference? I suspect you'll find for boot time it will have little to
no affect since the device driver probe order is more closely related
to the kernel link order than the order that devices were registered.

g.

> ---
>  drivers/of/platform.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index e0a6514..a2ea858 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -382,8 +382,23 @@ static int of_platform_bus_create(struct device_node *bus,
>         if (!dev || !of_match_node(matches, bus))
>                 return 0;
>
> +       /* first step: create the nodes that are referenced by phandle */
>         for_each_child_of_node(bus, child) {
> -               pr_debug("   create child: %s\n", child->full_name);
> +               if (child->phandle == 0)
> +                       continue;
> +               pr_debug("   create child 1: %s\n", child->full_name);
> +               rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
> +               if (rc) {
> +                       of_node_put(child);
> +                       return rc;
> +               }
> +       }
> +
> +       /* second step: create the other nodes */
> +       for_each_child_of_node(bus, child) {
> +               if (child->phandle != 0)
> +                       continue;
> +               pr_debug("   create child 2: %s\n", child->full_name);
>                 rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
>                 if (rc) {
>                         of_node_put(child);
>
>
> --
> Ken ar c'henta? |             ** Breizh ha Linux atav! **
> Jef             |               http://moinejf.free.fr/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] of: reduce the number of PROBE_DEFERs
  2013-08-20 10:13 ` Grant Likely
@ 2013-08-22  8:00   ` Jean-Francois Moine
  2013-08-22 10:20     ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Francois Moine @ 2013-08-22  8:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 20 Aug 2013 11:13:24 +0100
Grant Likely <grant.likely@linaro.org> wrote:

> On Tue, Aug 20, 2013 at 11:01 AM, Jean-Francois Moine <moinejf@free.fr> wrote:
> > This patch populates the platform from the device tree into two steps:
> > the first step creates the nodes that are referenced by a phandle,
> > the second step creates the other nodes.
> >
> > This permits to reduce the number of PROBE_DEFERs.
> >
> > Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> > ---
> > A better way to reduce probe deferral could be sorting the nodes
> > according to their phandle level in the DT blob at compilation time ...  
> 
> Have you got measurements or statistics that show this making a
> difference? I suspect you'll find for boot time it will have little to
> no affect since the device driver probe order is more closely related
> to the kernel link order than the order that devices were registered.

With the device tree and most drivers as modules, the kernel link order
does not matter.

I admit that the gain may be small: I just get none or just one probe
deferral instead of 3 on my cubox with this patch.

-- 
Ken ar c'henta?	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] of: reduce the number of PROBE_DEFERs
  2013-08-22  8:00   ` Jean-Francois Moine
@ 2013-08-22 10:20     ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2013-08-22 10:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Aug 22, 2013 at 9:00 AM, Jean-Francois Moine <moinejf@free.fr> wrote:
> On Tue, 20 Aug 2013 11:13:24 +0100
> Grant Likely <grant.likely@linaro.org> wrote:
>
>> On Tue, Aug 20, 2013 at 11:01 AM, Jean-Francois Moine <moinejf@free.fr> wrote:
>> > This patch populates the platform from the device tree into two steps:
>> > the first step creates the nodes that are referenced by a phandle,
>> > the second step creates the other nodes.
>> >
>> > This permits to reduce the number of PROBE_DEFERs.
>> >
>> > Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
>> > ---
>> > A better way to reduce probe deferral could be sorting the nodes
>> > according to their phandle level in the DT blob at compilation time ...
>>
>> Have you got measurements or statistics that show this making a
>> difference? I suspect you'll find for boot time it will have little to
>> no affect since the device driver probe order is more closely related
>> to the kernel link order than the order that devices were registered.
>
> With the device tree and most drivers as modules, the kernel link order
> does not matter.
>
> I admit that the gain may be small: I just get none or just one probe
> deferral instead of 3 on my cubox with this patch.

If you've only got 3 probe deferrals, then is this really an issue
worth complicating the code over? I'd like to see a more significant
impact before taking this step.

g.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-22 10:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20 10:01 [PATCH] of: reduce the number of PROBE_DEFERs Jean-Francois Moine
2013-08-20 10:13 ` Grant Likely
2013-08-22  8:00   ` Jean-Francois Moine
2013-08-22 10:20     ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).