Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311695 > unrolled thread

[PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms

Started byGanapatrao Kulkarni <gkulkarni@caviumnetworks.com>
First post2016-01-18 18:20 +0100
Last post2016-01-26 22:00 +0100
Articles 12 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com> - 2016-01-18 18:20 +0100
    Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa  aware David Daney <ddaney.cavm@gmail.com> - 2016-01-18 18:50 +0100
      Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware Ganapatrao Kulkarni <gpkulkarni@gmail.com> - 2016-01-19 07:00 +0100
        Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa  aware Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-01-19 10:50 +0100
          Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware Ganapatrao Kulkarni <gpkulkarni@gmail.com> - 2016-01-19 13:40 +0100
    Re: [PATCH v9 4/6] arm64, dt, thunderx: Add initial dts for Cavium  Thunderx in 2 node topology. David Daney <ddaney.cavm@gmail.com> - 2016-01-18 19:00 +0100
    Re: [PATCH v9 2/6] Documentation, dt, arm64/arm: dt bindings for  numa. Rob Herring <robh@kernel.org> - 2016-01-20 15:20 +0100
      Re: [PATCH v9 2/6] Documentation, dt, arm64/arm: dt bindings for numa. Ganapatrao Kulkarni <gpkulkarni@gmail.com> - 2016-01-26 18:20 +0100
    Re: [PATCH v9 1/6] arm64, numa: adding numa support for arm64  platforms. Bjorn Helgaas <helgaas@kernel.org> - 2016-01-26 20:00 +0100
    Re: [PATCH v9 3/6] arm64/arm, numa, dt: adding numa dt binding  implementation for arm64 platforms. Bjorn Helgaas <helgaas@kernel.org> - 2016-01-26 21:40 +0100
    Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa  aware Bjorn Helgaas <helgaas@kernel.org> - 2016-01-26 22:00 +0100
    Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa  aware Bjorn Helgaas <helgaas@kernel.org> - 2016-01-26 22:00 +0100

#1311695 — [PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms

FromGanapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Date2016-01-18 18:20 +0100
Subject[PATCH v9 0/6] arm64, numa: Add numa support for arm64 platforms
Message-ID<qSlDc-3Oc-29@gated-at.bofh.it>
v9:	- Added cleanup patch to reuse and avoid redefinition of cpumask_of_pcibus
	  as suggested from Will Deacon and Bjorn Helgaas.
	- Including patch to Make pci-host-generic driver numa aware.
	- Incorporated comment from Shannon Zhao.

v8:
	- Incorporated review comments of Mark Rutland and Will Deacon.
	- Added pci helper function and macro for numa.

v7:
	- managing numa memory mapping using memblock.
	- Incorporated review comments of Mark Rutland.

v6:
	- defined and implemented the numa dt binding using
	node property proximity and device node distance-map.
	- renamed dt_numa to of_numa

v5:
        - created base verion of numa.c which creates dummy numa without using dt
          on single socket platforms. Then added patches for dt support.
        - Incorporated review comments from Hanjun Guo.

v4:
done changes as per Arnd review comments.

v3:
Added changes to support numa on arm64 based platforms.
Tested these patches on cavium's multinode(2 node topology) platform.
In this patchset, defined and implemented dt bindings for numa mapping
for core and memory using device node property arm,associativity.

v2:
Defined and implemented numa map for memory, cores to node and
proximity distance matrix of nodes.

v1:
Initial patchset to support numa on arm64 platforms.

Note:
        1. This patchset is tested for numa with dt on
           thunderx single socket and dual socket boards.
        2. Numa DT booting needs the dt memory nodes, which are deleted in current efi-stub,
        hence to try numa with dt, you need to rebase with ard's patchset.
        http://git.linaro.org/people/ard.biesheuvel/linux-arm.git/shortlog/refs/heads/arm64-uefi-early-fdt-handling
	3. PATCH 6 is not tested for other architectures.

Ganapatrao Kulkarni (6):
  arm64, numa: adding numa support for arm64 platforms.
  Documentation, dt, arm64/arm: dt bindings for numa.
  arm64/arm, numa, dt: adding numa dt binding implementation for arm64
    platforms.
  arm64, dt, thunderx: Add initial dts for Cavium Thunderx in 2 node
    topology.
  PCI: generic: Make pci-host-generic driver numa aware
  topology, cleanup: Avoid redefinition of cpumask_of_pcibus in asm
    header files.

 Documentation/devicetree/bindings/arm/numa.txt  | 272 ++++++++
 arch/arm64/Kconfig                              |  35 +
 arch/arm64/boot/dts/cavium/Makefile             |   2 +-
 arch/arm64/boot/dts/cavium/thunder-88xx-2n.dts  |  83 +++
 arch/arm64/boot/dts/cavium/thunder-88xx-2n.dtsi | 806 ++++++++++++++++++++++++
 arch/arm64/include/asm/mmzone.h                 |  18 +
 arch/arm64/include/asm/numa.h                   |  50 ++
 arch/arm64/include/asm/topology.h               |   7 +
 arch/arm64/kernel/Makefile                      |   1 +
 arch/arm64/kernel/of_numa.c                     | 257 ++++++++
 arch/arm64/kernel/pci.c                         |   8 +
 arch/arm64/kernel/setup.c                       |   4 +
 arch/arm64/kernel/smp.c                         |   4 +
 arch/arm64/mm/Makefile                          |   1 +
 arch/arm64/mm/init.c                            |  31 +-
 arch/arm64/mm/mmu.c                             |   1 +
 arch/arm64/mm/numa.c                            | 395 ++++++++++++
 arch/ia64/include/asm/topology.h                |   4 -
 arch/metag/include/asm/topology.h               |   3 -
 arch/powerpc/include/asm/topology.h             |   4 -
 arch/s390/include/asm/pci.h                     |   2 +-
 arch/s390/include/asm/topology.h                |   1 +
 arch/sh/include/asm/topology.h                  |   3 -
 arch/x86/include/asm/pci.h                      |   2 +-
 arch/x86/include/asm/topology.h                 |   1 +
 drivers/pci/host/pci-host-generic.c             |   9 +-
 include/asm-generic/topology.h                  |   4 +-
 27 files changed, 1981 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/numa.txt
 create mode 100644 arch/arm64/boot/dts/cavium/thunder-88xx-2n.dts
 create mode 100644 arch/arm64/boot/dts/cavium/thunder-88xx-2n.dtsi
 create mode 100644 arch/arm64/include/asm/mmzone.h
 create mode 100644 arch/arm64/include/asm/numa.h
 create mode 100644 arch/arm64/kernel/of_numa.c
 create mode 100644 arch/arm64/mm/numa.c

-- 
1.8.1.4

[toc] | [next] | [standalone]


#1311714 — Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware

FromDavid Daney <ddaney.cavm@gmail.com>
Date2016-01-18 18:50 +0100
SubjectRe: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware
Message-ID<qSm6e-3ZZ-17@gated-at.bofh.it>
In reply to#1311695
On 01/18/2016 08:36 AM, Ganapatrao Kulkarni wrote:
> update numa_node of device associated with pci bus.
> moved down devm_kzalloc to allocate from node memory.
>
> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> ---
>   drivers/pci/host/pci-host-generic.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
> index 5434c90..0e1ce06 100644
> --- a/drivers/pci/host/pci-host-generic.c
> +++ b/drivers/pci/host/pci-host-generic.c
> @@ -215,11 +215,9 @@ static int gen_pci_probe(struct platform_device *pdev)
>   	const struct of_device_id *of_id;
>   	struct device *dev = &pdev->dev;
>   	struct device_node *np = dev->of_node;
> -	struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> +	struct gen_pci *pci;
>   	struct pci_bus *bus, *child;
>
> -	if (!pci)
> -		return -ENOMEM;
>
>   	type = of_get_property(np, "device_type", NULL);
>   	if (!type || strcmp(type, "pci")) {
> @@ -230,6 +228,11 @@ static int gen_pci_probe(struct platform_device *pdev)
>   	of_pci_check_probe_only();
>
>   	of_id = of_match_node(gen_pci_of_match, np);
> +	set_dev_node(dev, of_node_to_nid(np));

This shouldn't be done in individual platform_drivers, but instead in 
the device probing code.

There is code that does this in drivers/of/platform.c and 
drivers/of/device.c  Is that not being called for the pci-host-gweneric 
devices?  If not, we should figure out why, and perhaps attempt to fix 
it rather than doing it here.


> +	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> +	if (!pci)
> +		return -ENOMEM;
> +
>   	pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
>   	pci->host.dev.parent = dev;
>   	INIT_LIST_HEAD(&pci->host.windows);
>

[toc] | [prev] | [next] | [standalone]


#1311948 — Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware

FromGanapatrao Kulkarni <gpkulkarni@gmail.com>
Date2016-01-19 07:00 +0100
SubjectRe: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware
Message-ID<qSxuF-3je-1@gated-at.bofh.it>
In reply to#1311714
On Mon, Jan 18, 2016 at 11:11 PM, David Daney <ddaney.cavm@gmail.com> wrote:
> On 01/18/2016 08:36 AM, Ganapatrao Kulkarni wrote:
>>
>> update numa_node of device associated with pci bus.
>> moved down devm_kzalloc to allocate from node memory.
>>
>> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
>> ---
>>   drivers/pci/host/pci-host-generic.c | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-host-generic.c
>> b/drivers/pci/host/pci-host-generic.c
>> index 5434c90..0e1ce06 100644
>> --- a/drivers/pci/host/pci-host-generic.c
>> +++ b/drivers/pci/host/pci-host-generic.c
>> @@ -215,11 +215,9 @@ static int gen_pci_probe(struct platform_device
>> *pdev)
>>         const struct of_device_id *of_id;
>>         struct device *dev = &pdev->dev;
>>         struct device_node *np = dev->of_node;
>> -       struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
>> +       struct gen_pci *pci;
>>         struct pci_bus *bus, *child;
>>
>> -       if (!pci)
>> -               return -ENOMEM;
>>
>>         type = of_get_property(np, "device_type", NULL);
>>         if (!type || strcmp(type, "pci")) {
>> @@ -230,6 +228,11 @@ static int gen_pci_probe(struct platform_device
>> *pdev)
>>         of_pci_check_probe_only();
>>
>>         of_id = of_match_node(gen_pci_of_match, np);
>> +       set_dev_node(dev, of_node_to_nid(np));
>
>
> This shouldn't be done in individual platform_drivers, but instead in the
> device probing code.
>
> There is code that does this in drivers/of/platform.c and
> drivers/of/device.c  Is that not being called for the pci-host-gweneric
> devices?  If not, we should figure out why, and perhaps attempt to fix it
> rather than doing it here.
is it more appropriate to call of_platform_device_create ?

--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -24,6 +24,7 @@
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 #include <linux/platform_device.h>
+#include <linux/of_platform.h>

 struct gen_pci;

@@ -466,7 +467,7 @@ static int gen_pci_probe(struct platform_device *pdev)
        of_pci_check_probe_only();

        of_id = of_match_node(gen_pci_of_match, np);
-       set_dev_node(dev, of_node_to_nid(np));
+       of_platform_device_create(np, NULL, NULL);
        pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
        if (!pci)
                return -ENOMEM;

>
>
>
>> +       pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
>> +       if (!pci)
>> +               return -ENOMEM;
>> +
>>         pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
>>         pci->host.dev.parent = dev;
>>         INIT_LIST_HEAD(&pci->host.windows);
>>
>
thanks
Ganapat

[toc] | [prev] | [next] | [standalone]


#1312049 — Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware

FromLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Date2016-01-19 10:50 +0100
SubjectRe: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware
Message-ID<qSB5f-5UF-15@gated-at.bofh.it>
In reply to#1311948
On Tue, Jan 19, 2016 at 11:28:56AM +0530, Ganapatrao Kulkarni wrote:
> On Mon, Jan 18, 2016 at 11:11 PM, David Daney <ddaney.cavm@gmail.com> wrote:
> > On 01/18/2016 08:36 AM, Ganapatrao Kulkarni wrote:
> >>
> >> update numa_node of device associated with pci bus.
> >> moved down devm_kzalloc to allocate from node memory.
> >>
> >> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> >> ---
> >>   drivers/pci/host/pci-host-generic.c | 9 ++++++---
> >>   1 file changed, 6 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/pci/host/pci-host-generic.c
> >> b/drivers/pci/host/pci-host-generic.c
> >> index 5434c90..0e1ce06 100644
> >> --- a/drivers/pci/host/pci-host-generic.c
> >> +++ b/drivers/pci/host/pci-host-generic.c
> >> @@ -215,11 +215,9 @@ static int gen_pci_probe(struct platform_device
> >> *pdev)
> >>         const struct of_device_id *of_id;
> >>         struct device *dev = &pdev->dev;
> >>         struct device_node *np = dev->of_node;
> >> -       struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> >> +       struct gen_pci *pci;
> >>         struct pci_bus *bus, *child;
> >>
> >> -       if (!pci)
> >> -               return -ENOMEM;
> >>
> >>         type = of_get_property(np, "device_type", NULL);
> >>         if (!type || strcmp(type, "pci")) {
> >> @@ -230,6 +228,11 @@ static int gen_pci_probe(struct platform_device
> >> *pdev)
> >>         of_pci_check_probe_only();
> >>
> >>         of_id = of_match_node(gen_pci_of_match, np);
> >> +       set_dev_node(dev, of_node_to_nid(np));
> >
> >
> > This shouldn't be done in individual platform_drivers, but instead in the
> > device probing code.
> >
> > There is code that does this in drivers/of/platform.c and
> > drivers/of/device.c  Is that not being called for the pci-host-gweneric
> > devices?  If not, we should figure out why, and perhaps attempt to fix it
> > rather than doing it here.
> is it more appropriate to call of_platform_device_create ?

That's already done to create the platform device by OF core when
populating devices from DT, what David suggested is that you should
add set_dev_node() to core OF code instead of adding it specifically
to the PCI host generic code.

Lorenzo

[toc] | [prev] | [next] | [standalone]


#1312181 — Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware

FromGanapatrao Kulkarni <gpkulkarni@gmail.com>
Date2016-01-19 13:40 +0100
SubjectRe: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware
Message-ID<qSDJM-7SY-7@gated-at.bofh.it>
In reply to#1312049
On Tue, Jan 19, 2016 at 3:11 PM, Lorenzo Pieralisi
<lorenzo.pieralisi@arm.com> wrote:
> On Tue, Jan 19, 2016 at 11:28:56AM +0530, Ganapatrao Kulkarni wrote:
>> On Mon, Jan 18, 2016 at 11:11 PM, David Daney <ddaney.cavm@gmail.com> wrote:
>> > On 01/18/2016 08:36 AM, Ganapatrao Kulkarni wrote:
>> >>
>> >> update numa_node of device associated with pci bus.
>> >> moved down devm_kzalloc to allocate from node memory.
>> >>
>> >> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
>> >> ---
>> >>   drivers/pci/host/pci-host-generic.c | 9 ++++++---
>> >>   1 file changed, 6 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/drivers/pci/host/pci-host-generic.c
>> >> b/drivers/pci/host/pci-host-generic.c
>> >> index 5434c90..0e1ce06 100644
>> >> --- a/drivers/pci/host/pci-host-generic.c
>> >> +++ b/drivers/pci/host/pci-host-generic.c
>> >> @@ -215,11 +215,9 @@ static int gen_pci_probe(struct platform_device
>> >> *pdev)
>> >>         const struct of_device_id *of_id;
>> >>         struct device *dev = &pdev->dev;
>> >>         struct device_node *np = dev->of_node;
>> >> -       struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
>> >> +       struct gen_pci *pci;
>> >>         struct pci_bus *bus, *child;
>> >>
>> >> -       if (!pci)
>> >> -               return -ENOMEM;
>> >>
>> >>         type = of_get_property(np, "device_type", NULL);
>> >>         if (!type || strcmp(type, "pci")) {
>> >> @@ -230,6 +228,11 @@ static int gen_pci_probe(struct platform_device
>> >> *pdev)
>> >>         of_pci_check_probe_only();
>> >>
>> >>         of_id = of_match_node(gen_pci_of_match, np);
>> >> +       set_dev_node(dev, of_node_to_nid(np));
>> >
>> >
>> > This shouldn't be done in individual platform_drivers, but instead in the
>> > device probing code.
>> >
>> > There is code that does this in drivers/of/platform.c and
>> > drivers/of/device.c  Is that not being called for the pci-host-gweneric
>> > devices?  If not, we should figure out why, and perhaps attempt to fix it
>> > rather than doing it here.
>> is it more appropriate to call of_platform_device_create ?
>
> That's already done to create the platform device by OF core when
> populating devices from DT, what David suggested is that you should
> add set_dev_node() to core OF code instead of adding it specifically
> to the PCI host generic code.
This patch was worked on 4.2(inherited to 4.4) to have correct
numa_node populated on sysfs.
however, on 4.4, OF  is fixed to set numa_node(fixed by
56f2de81e020c537f7e35550d13840143cb765cd)

This patch (patch #5) is not required and will be dropped.
thanks for your comments.


>
> Lorenzo
thanks
Ganapat

[toc] | [prev] | [next] | [standalone]


#1311726 — Re: [PATCH v9 4/6] arm64, dt, thunderx: Add initial dts for Cavium Thunderx in 2 node topology.

FromDavid Daney <ddaney.cavm@gmail.com>
Date2016-01-18 19:00 +0100
SubjectRe: [PATCH v9 4/6] arm64, dt, thunderx: Add initial dts for Cavium Thunderx in 2 node topology.
Message-ID<qSmfU-43l-5@gated-at.bofh.it>
In reply to#1311695
On 01/18/2016 08:36 AM, Ganapatrao Kulkarni wrote:
> Adding dt file for Cavium's Thunderx dual socket platform.
>
> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> ---
>   arch/arm64/boot/dts/cavium/Makefile             |   2 +-
>   arch/arm64/boot/dts/cavium/thunder-88xx-2n.dts  |  83 +++
>   arch/arm64/boot/dts/cavium/thunder-88xx-2n.dtsi | 806 ++++++++++++++++++++++++
>   3 files changed, 890 insertions(+), 1 deletion(-)
>   create mode 100644 arch/arm64/boot/dts/cavium/thunder-88xx-2n.dts
>   create mode 100644 arch/arm64/boot/dts/cavium/thunder-88xx-2n.dtsi
>

These files are useless, they don't contain device nodes for anything 
other than the UARTs.  There is no existing system that has only UARTs 
and no other devices, so these files cannot be (and can never be) used 
anywhere.

Since the boot firmware in all real, and emulated, systems is supplying 
correct DTBs, we should consider not merging these files, and removing 
the likewise useless thunder-88xx.dts  thunder-88xx.dtsi

David Daney


[...]

[toc] | [prev] | [next] | [standalone]


#1313243 — Re: [PATCH v9 2/6] Documentation, dt, arm64/arm: dt bindings for numa.

FromRob Herring <robh@kernel.org>
Date2016-01-20 15:20 +0100
SubjectRe: [PATCH v9 2/6] Documentation, dt, arm64/arm: dt bindings for numa.
Message-ID<qT1M7-7FE-25@gated-at.bofh.it>
In reply to#1311695
On Mon, Jan 18, 2016 at 10:06:01PM +0530, Ganapatrao Kulkarni wrote:
> DT bindings for numa mapping of memory, cores and IOs.
> 
> Reviewed-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> ---
>  Documentation/devicetree/bindings/arm/numa.txt | 272 +++++++++++++++++++++++++
>  1 file changed, 272 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/arm/numa.txt

This is looks okay to me, but some cosmetic things on the example.

> +==============================================================================
> +4 - Example dts
> +==============================================================================
> +
> +2 sockets system consists of 2 boards connected through ccn bus and
> +each board having one socket/soc of 8 cpus, memory and pci bus.
> +
> +	memory@00c00000 {

Drop the leading 0s on unit addresses.

> +		device_type = "memory";
> +		reg = <0x0 0x00c00000 0x0 0x80000000>;
> +		/* node 0 */
> +		numa-node-id = <0>;
> +	};
> +
> +	memory@10000000000 {
> +		device_type = "memory";
> +		reg = <0x100 0x00000000 0x0 0x80000000>;
> +		/* node 1 */
> +		numa-node-id = <1>;
> +	};
> +
> +	cpus {
> +		#address-cells = <2>;
> +		#size-cells = <0>;
> +
> +		cpu@000 {

Same here (leaving one of course).

> +			device_type = "cpu";
> +			compatible =  "arm,armv8";
> +			reg = <0x0 0x000>;
> +			enable-method = "psci";
> +			/* node 0 */
> +			numa-node-id = <0>;
> +		};
> +		cpu@001 {

and so on...

> +			device_type = "cpu";
> +			compatible =  "arm,armv8";
> +			reg = <0x0 0x001>;

Either all leading 0s or none.

> +			reg = <0x0 0x008>;
> +			enable-method = "psci";
> +			/* node 1 */

Kind of a pointless comment.

Wouldn't each cluster of cpus for a given numa node be in a different 
cpu affinity? Certainly not required by the architecture, but the common 
case at least.

> +			numa-node-id = <1>;
> +		};

[...]

> +	pcie0: pcie0@0x8480,00000000 {

Drop the 0x and the comma.

> +		compatible = "arm,armv8";
> +		device_type = "pci";
> +		bus-range = <0 255>;
> +		#size-cells = <2>;
> +		#address-cells = <3>;
> +		reg = <0x8480 0x00000000 0 0x10000000>;  /* Configuration space */
> +		ranges = <0x03000000 0x8010 0x00000000 0x8010 0x00000000 0x70 0x00000000>;
> +		/* node 0 */
> +		numa-node-id = <0>;
> +        };
> +
> +	pcie1: pcie1@0x9480,00000000 {

ditto

> +		compatible = "arm,armv8";
> +		device_type = "pci";
> +		bus-range = <0 255>;
> +		#size-cells = <2>;
> +		#address-cells = <3>;
> +		reg = <0x9480 0x00000000 0 0x10000000>;  /* Configuration space */
> +		ranges = <0x03000000 0x9010 0x00000000 0x9010 0x00000000 0x70 0x00000000>;
> +		/* node 1 */
> +		numa-node-id = <1>;
> +        };
> +
> +	distance-map {
> +		compatible = "numa-distance-map-v1";
> +		distance-matrix = <0 0 10>,
> +				  <0 1 20>,
> +				  <1 1 10>;
> +	};
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1318183 — Re: [PATCH v9 2/6] Documentation, dt, arm64/arm: dt bindings for numa.

FromGanapatrao Kulkarni <gpkulkarni@gmail.com>
Date2016-01-26 18:20 +0100
SubjectRe: [PATCH v9 2/6] Documentation, dt, arm64/arm: dt bindings for numa.
Message-ID<qVfrD-7iQ-67@gated-at.bofh.it>
In reply to#1313243
Hi Rob, Mark,


On Wed, Jan 20, 2016 at 7:48 PM, Rob Herring <robh@kernel.org> wrote:
> On Mon, Jan 18, 2016 at 10:06:01PM +0530, Ganapatrao Kulkarni wrote:
>> DT bindings for numa mapping of memory, cores and IOs.
>>
>> Reviewed-by: Robert Richter <rrichter@cavium.com>
>> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
>> ---
>>  Documentation/devicetree/bindings/arm/numa.txt | 272 +++++++++++++++++++++++++
>>  1 file changed, 272 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/arm/numa.txt
>
> This is looks okay to me, but some cosmetic things on the example.
can i have your Ack please?
>
>> +==============================================================================
>> +4 - Example dts
>> +==============================================================================
>> +
>> +2 sockets system consists of 2 boards connected through ccn bus and
>> +each board having one socket/soc of 8 cpus, memory and pci bus.
>> +
>> +     memory@00c00000 {
>
> Drop the leading 0s on unit addresses.
i will correct these in next version.
>
>> +             device_type = "memory";
>> +             reg = <0x0 0x00c00000 0x0 0x80000000>;
>> +             /* node 0 */
>> +             numa-node-id = <0>;
>> +     };
>> +
>> +     memory@10000000000 {
>> +             device_type = "memory";
>> +             reg = <0x100 0x00000000 0x0 0x80000000>;
>> +             /* node 1 */
>> +             numa-node-id = <1>;
>> +     };
>> +
>> +     cpus {
>> +             #address-cells = <2>;
>> +             #size-cells = <0>;
>> +
>> +             cpu@000 {
>
> Same here (leaving one of course).
>
>> +                     device_type = "cpu";
>> +                     compatible =  "arm,armv8";
>> +                     reg = <0x0 0x000>;
>> +                     enable-method = "psci";
>> +                     /* node 0 */
>> +                     numa-node-id = <0>;
>> +             };
>> +             cpu@001 {
>
> and so on...
>
>> +                     device_type = "cpu";
>> +                     compatible =  "arm,armv8";
>> +                     reg = <0x0 0x001>;
>
> Either all leading 0s or none.
>
>> +                     reg = <0x0 0x008>;
>> +                     enable-method = "psci";
>> +                     /* node 1 */
>
> Kind of a pointless comment.
>
> Wouldn't each cluster of cpus for a given numa node be in a different
> cpu affinity? Certainly not required by the architecture, but the common
> case at least.
>
>> +                     numa-node-id = <1>;
>> +             };
>
> [...]
>
>> +     pcie0: pcie0@0x8480,00000000 {
>
> Drop the 0x and the comma.
>
>> +             compatible = "arm,armv8";
>> +             device_type = "pci";
>> +             bus-range = <0 255>;
>> +             #size-cells = <2>;
>> +             #address-cells = <3>;
>> +             reg = <0x8480 0x00000000 0 0x10000000>;  /* Configuration space */
>> +             ranges = <0x03000000 0x8010 0x00000000 0x8010 0x00000000 0x70 0x00000000>;
>> +             /* node 0 */
>> +             numa-node-id = <0>;
>> +        };
>> +
>> +     pcie1: pcie1@0x9480,00000000 {
>
> ditto
>
>> +             compatible = "arm,armv8";
>> +             device_type = "pci";
>> +             bus-range = <0 255>;
>> +             #size-cells = <2>;
>> +             #address-cells = <3>;
>> +             reg = <0x9480 0x00000000 0 0x10000000>;  /* Configuration space */
>> +             ranges = <0x03000000 0x9010 0x00000000 0x9010 0x00000000 0x70 0x00000000>;
>> +             /* node 1 */
>> +             numa-node-id = <1>;
>> +        };
>> +
>> +     distance-map {
>> +             compatible = "numa-distance-map-v1";
>> +             distance-matrix = <0 0 10>,
>> +                               <0 1 20>,
>> +                               <1 1 10>;
>> +     };
>> --
>> 1.8.1.4
thanks
Ganapat
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1318257 — Re: [PATCH v9 1/6] arm64, numa: adding numa support for arm64 platforms.

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-01-26 20:00 +0100
SubjectRe: [PATCH v9 1/6] arm64, numa: adding numa support for arm64 platforms.
Message-ID<qVh0m-8go-7@gated-at.bofh.it>
In reply to#1311695
On Mon, Jan 18, 2016 at 10:06:00PM +0530, Ganapatrao Kulkarni wrote:
> Adding numa support for arm64 based platforms.
> This patch adds by default the dummy numa node and
> maps all memory and cpus to node 0.
> using this patch, numa can be simulated on single node arm64 platforms.

> diff --git a/arch/arm64/include/asm/mmzone.h b/arch/arm64/include/asm/mmzone.h
> new file mode 100644
> index 0000000..2cd804d
> --- /dev/null
> +++ b/arch/arm64/include/asm/mmzone.h
> @@ -0,0 +1,18 @@
> +#ifndef __ASM_MMZONE_H
> +#define __ASM_MMZONE_H
> +
> +#ifdef CONFIG_NUMA
> +
> +#include <linux/mmdebug.h>
> +#include <linux/types.h>
> +
> +#include <asm/smp.h>
> +#include <asm/numa.h>

Are all these #includes really necessary?  s390 looks very similar and
doesn't need the #includes.

> +extern struct pglist_data *node_data[];
> +
> +#define NODE_DATA(nid)		(node_data[(nid)])
> +
> +#endif /* CONFIG_NUMA */
> +
> +#endif /* __ASM_MMZONE_H */

> diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h
> new file mode 100644
> index 0000000..f28f15b0
> --- /dev/null
> +++ b/arch/arm64/include/asm/numa.h
> @@ -0,0 +1,40 @@
> +#ifndef __ASM_NUMA_H
> +#define __ASM_NUMA_H
> +
> +#include <linux/nodemask.h>
> +#include <asm/topology.h>
> +
> +#ifdef CONFIG_NUMA
> +
> +/* currently, arm64 implements flat NUMA topology */
> +#define parent_node(node)	(node)
> +
> +extern int __node_distance(int from, int to);

Below you add some extern function declarations without the "extern"
keyword.  I don't know what the convention is for arm64 (I omit the
"extern" for PCI), but it seems like you should at least be
consistent.

> +#define node_distance(a, b) __node_distance(a, b)
> +
> +extern int cpu_to_node_map[NR_CPUS];
> +extern nodemask_t numa_nodes_parsed __initdata;
> +
> +/* Mappings between node number and cpus on that node. */
> +extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
> +extern void numa_clear_node(unsigned int cpu);
> +#ifdef CONFIG_DEBUG_PER_CPU_MAPS
> +extern const struct cpumask *cpumask_of_node(int node);
> +#else
> +/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
> +static inline const struct cpumask *cpumask_of_node(int node)
> +{
> +	return node_to_cpumask_map[node];
> +}
> +#endif
> +
> +void __init arm64_numa_init(void);
> +int __init numa_add_memblk(int nodeid, u64 start, u64 end);
> +void __init numa_set_distance(int from, int to, int distance);
> +void __init numa_reset_distance(void);
> +void numa_store_cpu_info(unsigned int cpu);

[toc] | [prev] | [next] | [standalone]


#1318347 — Re: [PATCH v9 3/6] arm64/arm, numa, dt: adding numa dt binding implementation for arm64 platforms.

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-01-26 21:40 +0100
SubjectRe: [PATCH v9 3/6] arm64/arm, numa, dt: adding numa dt binding implementation for arm64 platforms.
Message-ID<qViz8-10v-15@gated-at.bofh.it>
In reply to#1311695
Subject is "arm64/arm, numa, dt: adding ..."  What is the significance
of the "arm" part?  The other patches only mention "arm64".

General comment: the code below has little, if anything, that is
actually arm64-specific.  Maybe this is the first DT-based NUMA
platform?  I don't see other similar code for other arches, so maybe
it's too early to try to generalize it, but we should try to avoid
adding duplicates of this code if/when other arches do show up.

On Mon, Jan 18, 2016 at 10:06:02PM +0530, Ganapatrao Kulkarni wrote:
> Adding numa dt binding support for arm64 based platforms.
> dt node parsing for numa topology is done using device property
> numa-node-id and device node distance-map.
> 
> Reviewed-by: Robert Richter <rrichter@cavium.com>
> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> ---
>  arch/arm64/Kconfig            |  10 ++
>  arch/arm64/include/asm/numa.h |  10 ++
>  arch/arm64/kernel/Makefile    |   1 +
>  arch/arm64/kernel/of_numa.c   | 257 ++++++++++++++++++++++++++++++++++++++++++
>  arch/arm64/kernel/smp.c       |   2 +
>  arch/arm64/mm/numa.c          |  10 +-
>  6 files changed, 289 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm64/kernel/of_numa.c
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 74f5d73..775cf4a 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -515,6 +515,16 @@ config NUMA
>  	  local memory of the CPU and add some more
>  	  NUMA awareness to the kernel.
>  
> +config OF_NUMA
> +	bool "Device Tree NUMA support"
> +	depends on NUMA
> +	depends on OF
> +	default y
> +	help
> +	  Enable Device Tree NUMA support.
> +	  This enables the numa mapping of cpu, memory, io and
> +	  inter node distances using dt bindings.
> +
>  config NODES_SHIFT
>  	int "Maximum NUMA Nodes (as a power of 2)"
>  	range 1 10
> diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h
> index f28f15b0..54deb38 100644
> --- a/arch/arm64/include/asm/numa.h
> +++ b/arch/arm64/include/asm/numa.h
> @@ -37,4 +37,14 @@ void numa_store_cpu_info(unsigned int cpu);
>  static inline void numa_store_cpu_info(unsigned int cpu)		{ }
>  static inline void arm64_numa_init(void)		{ }
>  #endif	/* CONFIG_NUMA */
> +
> +struct device_node;
> +#ifdef CONFIG_OF_NUMA
> +int __init arm64_of_numa_init(void);
> +void __init of_numa_set_node_info(unsigned int cpu, struct device_node *dn);
> +#else
> +static inline void of_numa_set_node_info(unsigned int cpu,
> +		struct device_node *dn) { }
> +#endif
> +
>  #endif	/* __ASM_NUMA_H */
> diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
> index 474691f..7987763 100644
> --- a/arch/arm64/kernel/Makefile
> +++ b/arch/arm64/kernel/Makefile
> @@ -41,6 +41,7 @@ arm64-obj-$(CONFIG_EFI)			+= efi.o efi-entry.stub.o
>  arm64-obj-$(CONFIG_PCI)			+= pci.o
>  arm64-obj-$(CONFIG_ARMV8_DEPRECATED)	+= armv8_deprecated.o
>  arm64-obj-$(CONFIG_ACPI)		+= acpi.o
> +arm64-obj-$(CONFIG_OF_NUMA)		+= of_numa.o
>  
>  obj-y					+= $(arm64-obj-y) vdso/
>  obj-m					+= $(arm64-obj-m)
> diff --git a/arch/arm64/kernel/of_numa.c b/arch/arm64/kernel/of_numa.c
> new file mode 100644
> index 0000000..2f9e34b
> --- /dev/null
> +++ b/arch/arm64/kernel/of_numa.c
> @@ -0,0 +1,257 @@
> +/*
> + * OF NUMA Parsing support.
> + *
> + * Copyright (C) 2015 Cavium Inc.
> + * Author: Ganapatrao Kulkarni <gkulkarni@cavium.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <linux/ctype.h>
> +#include <linux/memblock.h>
> +#include <linux/module.h>
> +#include <linux/nodemask.h>
> +#include <linux/of.h>
> +#include <linux/of_fdt.h>
> +
> +#include <asm/smp_plat.h>
> +
> +/* define default numa node to 0 */
> +#define DEFAULT_NODE 0
> +#define OF_NUMA_PROP "numa-node-id"
> +
> +/* Returns nid in the range [0..MAX_NUMNODES-1],
> + * or NUMA_NO_NODE if no valid numa-node-id entry found
> + * or DEFAULT_NODE if no numa-node-id entry exists
> + */
> +static int of_numa_prop_to_nid(const __be32 *of_numa_prop, int length)
> +{
> +	int nid;
> +
> +	if (!of_numa_prop)
> +		return DEFAULT_NODE;
> +
> +	if (length != sizeof(*of_numa_prop)) {
> +		pr_warn("NUMA: Invalid of_numa_prop length %d found.\n",
> +				length);
> +		return NUMA_NO_NODE;
> +	}
> +
> +	nid = of_read_number(of_numa_prop, 1);
> +	if (nid >= MAX_NUMNODES) {
> +		pr_warn("NUMA: Invalid numa node %d found.\n", nid);
> +		return NUMA_NO_NODE;
> +	}
> +
> +	return nid;
> +}
> +
> +/* Must hold reference to node during call */
> +static int of_get_numa_nid(struct device_node *device)
> +{
> +	int length;
> +	const __be32 *of_numa_prop;
> +
> +	of_numa_prop = of_get_property(device, OF_NUMA_PROP, &length);
> +
> +	return of_numa_prop_to_nid(of_numa_prop, length);
> +}
> +
> +static int __init early_init_of_get_numa_nid(unsigned long node)
> +{
> +	int length;
> +	const __be32 *of_numa_prop;
> +
> +	of_numa_prop = of_get_flat_dt_prop(node, OF_NUMA_PROP, &length);
> +
> +	return of_numa_prop_to_nid(of_numa_prop, length);
> +}
> +
> +/* Walk the device tree upwards, looking for a numa-node-id property */
> +int of_node_to_nid(struct device_node *device)
> +{
> +	struct device_node *parent;
> +	int nid = NUMA_NO_NODE;
> +
> +	of_node_get(device);
> +	while (device) {
> +		const __be32 *of_numa_prop;
> +		int length;
> +
> +		of_numa_prop = of_get_property(device, OF_NUMA_PROP, &length);
> +		if (of_numa_prop) {
> +			nid = of_numa_prop_to_nid(of_numa_prop, length);
> +			break;
> +		}
> +
> +		parent = device;
> +		device = of_get_parent(parent);
> +		of_node_put(parent);
> +	}
> +	of_node_put(device);
> +
> +	return nid;
> +}
> +
> +void __init of_numa_set_node_info(unsigned int cpu, struct device_node *device)
> +{
> +	int nid = DEFAULT_NODE;
> +
> +	if (device)
> +		nid = of_get_numa_nid(device);
> +
> +	cpu_to_node_map[cpu] = nid;
> +}
> +
> +/*
> + * Even though we connect cpus to numa domains later in SMP
> + * init, we need to know the node ids now for all cpus.
> +*/
> +static int __init early_init_parse_cpu_node(unsigned long node)
> +{
> +	int nid;
> +
> +	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> +
> +	/* We are scanning "cpu" nodes only */
> +	if (type == NULL)
> +		return 0;
> +	else if (strcmp(type, "cpu") != 0)
> +		return 0;
> +
> +	nid = early_init_of_get_numa_nid(node);
> +
> +	if (nid == NUMA_NO_NODE)
> +		return -EINVAL;
> +
> +	node_set(nid, numa_nodes_parsed);
> +	return 0;
> +}
> +
> +static int __init early_init_parse_memory_node(unsigned long node)
> +{
> +	const __be32 *reg, *endp;
> +	int length;
> +	int nid;
> +
> +	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> +
> +	/* We are scanning "memory" nodes only */
> +	if (type == NULL)
> +		return 0;
> +	else if (strcmp(type, "memory") != 0)
> +		return 0;
> +
> +	nid = early_init_of_get_numa_nid(node);
> +
> +	if (nid == NUMA_NO_NODE)
> +		return -EINVAL;
> +
> +	reg = of_get_flat_dt_prop(node, "reg", &length);
> +	endp = reg + (length / sizeof(__be32));
> +
> +	while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
> +		u64 base, size;
> +
> +		base = dt_mem_next_cell(dt_root_addr_cells, &reg);
> +		size = dt_mem_next_cell(dt_root_size_cells, &reg);
> +		pr_debug("NUMA-DT:  base = %llx , node = %u\n",
> +				base, nid);
> +
> +		if (numa_add_memblk(nid, base, size) < 0)
> +			return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static int __init early_init_parse_distance_map_v1(unsigned long node,
> +		const char *uname)
> +{
> +
> +	const __be32 *prop_dist_matrix;
> +	int length = 0, i, matrix_count;
> +	int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
> +
> +	pr_info("NUMA: parsing numa-distance-map-v1\n");
> +
> +	prop_dist_matrix =
> +		of_get_flat_dt_prop(node, "distance-matrix", &length);
> +
> +	if (!length) {
> +		pr_err("NUMA: failed to parse distance-matrix\n");
> +		return  -ENODEV;
> +	}
> +
> +	matrix_count = ((length / sizeof(__be32)) / (3 * nr_size_cells));
> +
> +	if ((matrix_count * sizeof(__be32) * 3 * nr_size_cells) !=  length) {
> +		pr_warn("NUMA: invalid distance-matrix length %d\n", length);
> +		return -EINVAL;
> +	}
> +
> +	for (i = 0; i < matrix_count; i++) {
> +		u32 nodea, nodeb, distance;
> +
> +		nodea = dt_mem_next_cell(nr_size_cells, &prop_dist_matrix);
> +		nodeb = dt_mem_next_cell(nr_size_cells, &prop_dist_matrix);
> +		distance = dt_mem_next_cell(nr_size_cells, &prop_dist_matrix);
> +		numa_set_distance(nodea, nodeb, distance);
> +		pr_debug("NUMA-DT:  distance[node%d -> node%d] = %d\n",
> +				nodea, nodeb, distance);
> +
> +		/* Set default distance of node B->A same as A->B */
> +		if (nodeb > nodea)
> +			numa_set_distance(nodeb, nodea, distance);
> +	}
> +
> +	return 0;
> +}
> +
> +static int __init early_init_parse_distance_map(unsigned long node,
> +		const char *uname)
> +{
> +
> +	if (strcmp(uname, "distance-map") != 0)
> +		return 0;
> +
> +	if (of_flat_dt_is_compatible(node, "numa-distance-map-v1"))
> +		return early_init_parse_distance_map_v1(node, uname);
> +
> +	return -EINVAL;
> +}
> +
> +/**
> + * early_init_of_scan_numa_map - parse memory node and map nid to memory range.
> + */
> +int __init early_init_of_scan_numa_map(unsigned long node, const char *uname,
> +				     int depth, void *data)
> +{
> +	int ret;
> +
> +	ret = early_init_parse_cpu_node(node);
> +
> +	if (!ret)
> +		ret = early_init_parse_memory_node(node);
> +
> +	if (!ret)
> +		ret = early_init_parse_distance_map(node, uname);
> +
> +	return ret;
> +}
> +
> +/* DT node mapping is done already early_init_of_scan_memory */
> +int __init arm64_of_numa_init(void)
> +{
> +	return of_scan_flat_dt(early_init_of_scan_numa_map, NULL);
> +}
> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
> index d6e7d6a..a2a8c2d 100644
> --- a/arch/arm64/kernel/smp.c
> +++ b/arch/arm64/kernel/smp.c
> @@ -520,6 +520,8 @@ static void __init of_parse_and_init_cpus(void)
>  
>  		pr_debug("cpu logical map 0x%llx\n", hwid);
>  		cpu_logical_map(cpu_count) = hwid;
> +		/* map logical cpu to node */
> +		of_numa_set_node_info(cpu_count, dn);
>  next:
>  		cpu_count++;
>  	}
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index 050b083..9e8704b 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -383,5 +383,13 @@ static int __init dummy_numa_init(void)
>   */
>  void __init arm64_numa_init(void)
>  {
> -	numa_init(dummy_numa_init);
> +	int ret = -ENODEV;
> +
> +#ifdef CONFIG_OF_NUMA
> +	if (!numa_off)
> +		ret = numa_init(arm64_of_numa_init);
> +#endif
> +
> +	if (ret)
> +		numa_init(dummy_numa_init);
>  }
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arch" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1318357 — Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-01-26 22:00 +0100
SubjectRe: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware
Message-ID<qViSu-1iC-15@gated-at.bofh.it>
In reply to#1311695
On Tue, Jan 26, 2016 at 02:50:05PM -0600, Bjorn Helgaas wrote:
> On Mon, Jan 18, 2016 at 10:06:04PM +0530, Ganapatrao Kulkarni wrote:
> > update numa_node of device associated with pci bus.
> > moved down devm_kzalloc to allocate from node memory.
> > 
> > Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> > ---
> >  drivers/pci/host/pci-host-generic.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
> > index 5434c90..0e1ce06 100644
> > --- a/drivers/pci/host/pci-host-generic.c
> > +++ b/drivers/pci/host/pci-host-generic.c
> > @@ -215,11 +215,9 @@ static int gen_pci_probe(struct platform_device *pdev)
> >  	const struct of_device_id *of_id;
> >  	struct device *dev = &pdev->dev;
> >  	struct device_node *np = dev->of_node;
> > -	struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> > +	struct gen_pci *pci;
> >  	struct pci_bus *bus, *child;
> >  
> > -	if (!pci)
> > -		return -ENOMEM;
> >  
> >  	type = of_get_property(np, "device_type", NULL);
> >  	if (!type || strcmp(type, "pci")) {
> > @@ -230,6 +228,11 @@ static int gen_pci_probe(struct platform_device *pdev)
> >  	of_pci_check_probe_only();
> >  
> >  	of_id = of_match_node(gen_pci_of_match, np);
> > +	set_dev_node(dev, of_node_to_nid(np));
> 
> I like the idea of this patch, but why do we need to call
> set_dev_node() here in driver code?  Shouldn't that be done by the
> OF/platform device infrastructure so that all drivers for platform devices
> get this benefit?

Sorry, I'm just a day late and a dollar short.  I see David and Lorenzo
have already responded about this.

> > +	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> > +	if (!pci)
> > +		return -ENOMEM;
> > +
> >  	pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
> >  	pci->host.dev.parent = dev;
> >  	INIT_LIST_HEAD(&pci->host.windows);
> > -- 
> > 1.8.1.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-arch" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1318367 — Re: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-01-26 22:00 +0100
SubjectRe: [PATCH v9 5/6] PCI: generic: Make pci-host-generic driver numa aware
Message-ID<qViSu-1iC-17@gated-at.bofh.it>
In reply to#1311695
On Mon, Jan 18, 2016 at 10:06:04PM +0530, Ganapatrao Kulkarni wrote:
> update numa_node of device associated with pci bus.
> moved down devm_kzalloc to allocate from node memory.
> 
> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
> ---
>  drivers/pci/host/pci-host-generic.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
> index 5434c90..0e1ce06 100644
> --- a/drivers/pci/host/pci-host-generic.c
> +++ b/drivers/pci/host/pci-host-generic.c
> @@ -215,11 +215,9 @@ static int gen_pci_probe(struct platform_device *pdev)
>  	const struct of_device_id *of_id;
>  	struct device *dev = &pdev->dev;
>  	struct device_node *np = dev->of_node;
> -	struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> +	struct gen_pci *pci;
>  	struct pci_bus *bus, *child;
>  
> -	if (!pci)
> -		return -ENOMEM;
>  
>  	type = of_get_property(np, "device_type", NULL);
>  	if (!type || strcmp(type, "pci")) {
> @@ -230,6 +228,11 @@ static int gen_pci_probe(struct platform_device *pdev)
>  	of_pci_check_probe_only();
>  
>  	of_id = of_match_node(gen_pci_of_match, np);
> +	set_dev_node(dev, of_node_to_nid(np));

I like the idea of this patch, but why do we need to call
set_dev_node() here in driver code?  Shouldn't that be done by the
OF/platform device infrastructure so that all drivers for platform devices
get this benefit?

> +	pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
> +	if (!pci)
> +		return -ENOMEM;
> +
>  	pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
>  	pci->host.dev.parent = dev;
>  	INIT_LIST_HEAD(&pci->host.windows);
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arch" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web