Re: [PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-09 Thread David Miller
From: Rob Herring 
Date: Fri, 9 Nov 2018 07:02:46 -0600

> On Thu, Nov 8, 2018 at 9:13 PM David Miller  wrote:
>>
>> From: Rob Herring 
>> Date: Wed,  7 Nov 2018 16:31:46 -0600
>>
>> > In preparation to remove direct accesses to the device_node.name
>> > pointer, retrieve the node name from the "name" property instead.
>> >
>> > Cc: "David S. Miller" 
>> > Cc: sparcli...@vger.kernel.org
>> > Signed-off-by: Rob Herring 
>>
>> On some 32-bit sparcs, the OF runs in non-cached memory.
>>
>> Sucking in the OF device tree take a signficant amount of the
>> boot time on such systems.
>>
>> And these changes are going to make it even slower.
>>
>> Please just put a wrapper around dp->name or whatever and use that,
>> instead of making more get property OF calls which can be very
>> expensive.
> 
> It's not making calls into OF. It is retrieving the property from the
> kernel's copy of the DT (allocated by memblock). So the only
> difference is we have to walk the struct property list to find "name".
> That's perhaps offset by the fact that we'll be doing one less
> property retrieval from OF when this is all done. Right now, we
> retrieve "name" from OF twice per node.

Ok, now I understand, thanks.


Re: [PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-09 Thread David Miller
From: Rob Herring 
Date: Fri, 9 Nov 2018 07:02:46 -0600

> On Thu, Nov 8, 2018 at 9:13 PM David Miller  wrote:
>>
>> From: Rob Herring 
>> Date: Wed,  7 Nov 2018 16:31:46 -0600
>>
>> > In preparation to remove direct accesses to the device_node.name
>> > pointer, retrieve the node name from the "name" property instead.
>> >
>> > Cc: "David S. Miller" 
>> > Cc: sparcli...@vger.kernel.org
>> > Signed-off-by: Rob Herring 
>>
>> On some 32-bit sparcs, the OF runs in non-cached memory.
>>
>> Sucking in the OF device tree take a signficant amount of the
>> boot time on such systems.
>>
>> And these changes are going to make it even slower.
>>
>> Please just put a wrapper around dp->name or whatever and use that,
>> instead of making more get property OF calls which can be very
>> expensive.
> 
> It's not making calls into OF. It is retrieving the property from the
> kernel's copy of the DT (allocated by memblock). So the only
> difference is we have to walk the struct property list to find "name".
> That's perhaps offset by the fact that we'll be doing one less
> property retrieval from OF when this is all done. Right now, we
> retrieve "name" from OF twice per node.

Ok, now I understand, thanks.


Re: [PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-09 Thread Rob Herring
On Thu, Nov 8, 2018 at 9:13 PM David Miller  wrote:
>
> From: Rob Herring 
> Date: Wed,  7 Nov 2018 16:31:46 -0600
>
> > In preparation to remove direct accesses to the device_node.name
> > pointer, retrieve the node name from the "name" property instead.
> >
> > Cc: "David S. Miller" 
> > Cc: sparcli...@vger.kernel.org
> > Signed-off-by: Rob Herring 
>
> On some 32-bit sparcs, the OF runs in non-cached memory.
>
> Sucking in the OF device tree take a signficant amount of the
> boot time on such systems.
>
> And these changes are going to make it even slower.
>
> Please just put a wrapper around dp->name or whatever and use that,
> instead of making more get property OF calls which can be very
> expensive.

It's not making calls into OF. It is retrieving the property from the
kernel's copy of the DT (allocated by memblock). So the only
difference is we have to walk the struct property list to find "name".
That's perhaps offset by the fact that we'll be doing one less
property retrieval from OF when this is all done. Right now, we
retrieve "name" from OF twice per node.

Rob


Re: [PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-09 Thread Rob Herring
On Thu, Nov 8, 2018 at 9:13 PM David Miller  wrote:
>
> From: Rob Herring 
> Date: Wed,  7 Nov 2018 16:31:46 -0600
>
> > In preparation to remove direct accesses to the device_node.name
> > pointer, retrieve the node name from the "name" property instead.
> >
> > Cc: "David S. Miller" 
> > Cc: sparcli...@vger.kernel.org
> > Signed-off-by: Rob Herring 
>
> On some 32-bit sparcs, the OF runs in non-cached memory.
>
> Sucking in the OF device tree take a signficant amount of the
> boot time on such systems.
>
> And these changes are going to make it even slower.
>
> Please just put a wrapper around dp->name or whatever and use that,
> instead of making more get property OF calls which can be very
> expensive.

It's not making calls into OF. It is retrieving the property from the
kernel's copy of the DT (allocated by memblock). So the only
difference is we have to walk the struct property list to find "name".
That's perhaps offset by the fact that we'll be doing one less
property retrieval from OF when this is all done. Right now, we
retrieve "name" from OF twice per node.

Rob


Re: [PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-08 Thread David Miller
From: Rob Herring 
Date: Wed,  7 Nov 2018 16:31:46 -0600

> In preparation to remove direct accesses to the device_node.name
> pointer, retrieve the node name from the "name" property instead.
> 
> Cc: "David S. Miller" 
> Cc: sparcli...@vger.kernel.org
> Signed-off-by: Rob Herring 

On some 32-bit sparcs, the OF runs in non-cached memory.

Sucking in the OF device tree take a signficant amount of the
boot time on such systems.

And these changes are going to make it even slower.

Please just put a wrapper around dp->name or whatever and use that,
instead of making more get property OF calls which can be very
expensive.


Re: [PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-08 Thread David Miller
From: Rob Herring 
Date: Wed,  7 Nov 2018 16:31:46 -0600

> In preparation to remove direct accesses to the device_node.name
> pointer, retrieve the node name from the "name" property instead.
> 
> Cc: "David S. Miller" 
> Cc: sparcli...@vger.kernel.org
> Signed-off-by: Rob Herring 

On some 32-bit sparcs, the OF runs in non-cached memory.

Sucking in the OF device tree take a signficant amount of the
boot time on such systems.

And these changes are going to make it even slower.

Please just put a wrapper around dp->name or whatever and use that,
instead of making more get property OF calls which can be very
expensive.


[PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-07 Thread Rob Herring
In preparation to remove direct accesses to the device_node.name
pointer, retrieve the node name from the "name" property instead.

Cc: "David S. Miller" 
Cc: sparcli...@vger.kernel.org
Signed-off-by: Rob Herring 
---
 arch/sparc/kernel/prom_32.c | 20 ++--
 arch/sparc/kernel/prom_64.c | 47 +++--
 2 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c
index d41e2a749c5d..30e33b461970 100644
--- a/arch/sparc/kernel/prom_32.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -60,6 +60,7 @@ void * __init prom_early_alloc(unsigned long size)
  */
 static void __init sparc32_path_component(struct device_node *dp, char 
*tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_registers *regs;
struct property *rprop;
 
@@ -69,13 +70,14 @@ static void __init sparc32_path_component(struct 
device_node *dp, char *tmp_buf)
 
regs = rprop->value;
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
regs->which_io, regs->phys_addr);
 }
 
 /* "name@slot,offset"  */
 static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_registers *regs;
struct property *prop;
 
@@ -85,7 +87,7 @@ static void __init sbus_path_component(struct device_node 
*dp, char *tmp_buf)
 
regs = prop->value;
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
regs->which_io,
regs->phys_addr);
 }
@@ -93,6 +95,7 @@ static void __init sbus_path_component(struct device_node 
*dp, char *tmp_buf)
 /* "name@devnum[,func]" */
 static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_pci_registers *regs;
struct property *prop;
unsigned int devfn;
@@ -105,12 +108,12 @@ static void __init pci_path_component(struct device_node 
*dp, char *tmp_buf)
devfn = (regs->phys_hi >> 8) & 0xff;
if (devfn & 0x07) {
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
devfn >> 3,
devfn & 0x07);
} else {
sprintf(tmp_buf, "%s@%x",
-   dp->name,
+   name,
devfn >> 3);
}
 }
@@ -118,6 +121,7 @@ static void __init pci_path_component(struct device_node 
*dp, char *tmp_buf)
 /* "name@addrhi,addrlo" */
 static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_registers *regs;
struct property *prop;
 
@@ -128,13 +132,14 @@ static void __init ebus_path_component(struct device_node 
*dp, char *tmp_buf)
regs = prop->value;
 
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
regs->which_io, regs->phys_addr);
 }
 
 /* "name:vendor:device@irq,addrlo" */
 static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct amba_prom_registers *regs;
unsigned int *intr, *device, *vendor, reg0;
struct property *prop;
@@ -168,7 +173,7 @@ static void __init ambapp_path_component(struct device_node 
*dp, char *tmp_buf)
device = prop->value;
 
sprintf(tmp_buf, "%s:%d:%d@%x,%x",
-   dp->name, *vendor, *device,
+   name, *vendor, *device,
*intr, reg0);
 }
 
@@ -196,12 +201,13 @@ static void __init __build_path_component(struct 
device_node *dp, char *tmp_buf)
 
 char * __init build_path_component(struct device_node *dp)
 {
+   const char *name = of_get_property(dp, "name", NULL);
char tmp_buf[64], *n;
 
tmp_buf[0] = '\0';
__build_path_component(dp, tmp_buf);
if (tmp_buf[0] == '\0')
-   strcpy(tmp_buf, dp->name);
+   strcpy(tmp_buf, name);
 
n = prom_early_alloc(strlen(tmp_buf) + 1);
strcpy(n, tmp_buf);
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index c37955d127fe..1667df573f6f 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -72,6 +72,7 @@ void * __init prom_early_alloc(unsigned long size)
  */
 static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom64_registers *regs;
struct property *rprop;
u32 high_bits, low_bits, type;
@@ -83,7 +84,7 @@ static void __init sun4v_path_component(struct device_node 
*dp, char *tmp_buf)
regs = rprop->value;
if 

[PATCH 3/8] sparc: prom: use property "name" directly to construct node names

2018-11-07 Thread Rob Herring
In preparation to remove direct accesses to the device_node.name
pointer, retrieve the node name from the "name" property instead.

Cc: "David S. Miller" 
Cc: sparcli...@vger.kernel.org
Signed-off-by: Rob Herring 
---
 arch/sparc/kernel/prom_32.c | 20 ++--
 arch/sparc/kernel/prom_64.c | 47 +++--
 2 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c
index d41e2a749c5d..30e33b461970 100644
--- a/arch/sparc/kernel/prom_32.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -60,6 +60,7 @@ void * __init prom_early_alloc(unsigned long size)
  */
 static void __init sparc32_path_component(struct device_node *dp, char 
*tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_registers *regs;
struct property *rprop;
 
@@ -69,13 +70,14 @@ static void __init sparc32_path_component(struct 
device_node *dp, char *tmp_buf)
 
regs = rprop->value;
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
regs->which_io, regs->phys_addr);
 }
 
 /* "name@slot,offset"  */
 static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_registers *regs;
struct property *prop;
 
@@ -85,7 +87,7 @@ static void __init sbus_path_component(struct device_node 
*dp, char *tmp_buf)
 
regs = prop->value;
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
regs->which_io,
regs->phys_addr);
 }
@@ -93,6 +95,7 @@ static void __init sbus_path_component(struct device_node 
*dp, char *tmp_buf)
 /* "name@devnum[,func]" */
 static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_pci_registers *regs;
struct property *prop;
unsigned int devfn;
@@ -105,12 +108,12 @@ static void __init pci_path_component(struct device_node 
*dp, char *tmp_buf)
devfn = (regs->phys_hi >> 8) & 0xff;
if (devfn & 0x07) {
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
devfn >> 3,
devfn & 0x07);
} else {
sprintf(tmp_buf, "%s@%x",
-   dp->name,
+   name,
devfn >> 3);
}
 }
@@ -118,6 +121,7 @@ static void __init pci_path_component(struct device_node 
*dp, char *tmp_buf)
 /* "name@addrhi,addrlo" */
 static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom_registers *regs;
struct property *prop;
 
@@ -128,13 +132,14 @@ static void __init ebus_path_component(struct device_node 
*dp, char *tmp_buf)
regs = prop->value;
 
sprintf(tmp_buf, "%s@%x,%x",
-   dp->name,
+   name,
regs->which_io, regs->phys_addr);
 }
 
 /* "name:vendor:device@irq,addrlo" */
 static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct amba_prom_registers *regs;
unsigned int *intr, *device, *vendor, reg0;
struct property *prop;
@@ -168,7 +173,7 @@ static void __init ambapp_path_component(struct device_node 
*dp, char *tmp_buf)
device = prop->value;
 
sprintf(tmp_buf, "%s:%d:%d@%x,%x",
-   dp->name, *vendor, *device,
+   name, *vendor, *device,
*intr, reg0);
 }
 
@@ -196,12 +201,13 @@ static void __init __build_path_component(struct 
device_node *dp, char *tmp_buf)
 
 char * __init build_path_component(struct device_node *dp)
 {
+   const char *name = of_get_property(dp, "name", NULL);
char tmp_buf[64], *n;
 
tmp_buf[0] = '\0';
__build_path_component(dp, tmp_buf);
if (tmp_buf[0] == '\0')
-   strcpy(tmp_buf, dp->name);
+   strcpy(tmp_buf, name);
 
n = prom_early_alloc(strlen(tmp_buf) + 1);
strcpy(n, tmp_buf);
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index c37955d127fe..1667df573f6f 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -72,6 +72,7 @@ void * __init prom_early_alloc(unsigned long size)
  */
 static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
 {
+   const char *name = of_get_property(dp, "name", NULL);
struct linux_prom64_registers *regs;
struct property *rprop;
u32 high_bits, low_bits, type;
@@ -83,7 +84,7 @@ static void __init sun4v_path_component(struct device_node 
*dp, char *tmp_buf)
regs = rprop->value;
if