arm64:numa: Add numa support for arm64 platforms.
Subsystems (2)
v3 cover arm64:numa: Add numa support for arm64 platforms.
This is v3 patch set 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 to each other.
v1:
Initial patchset to support numa on arm64 platforms.
Ganapatrao Kulkarni (4):
arm64: defconfig: increase NR_CPUS range to 2-4096.
Documentation: arm64/arm: dt bindings for numa. arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node
topology.
arm64:numa: adding numa support for arm64 platforms.
Documentation/devicetree/bindings/arm/numa.txt | 198 +++++++ arch/arm64/Kconfig | 36 +- arch/arm64/boot/dts/thunder-88xx-2n.dts | 78 +++ arch/arm64/boot/dts/thunder-88xx-2n.dtsi | 789 +++++++++++++++++++++++++ arch/arm64/include/asm/mmzone.h | 32 + arch/arm64/include/asm/numa.h | 45 ++ arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/dt_numa.c | 296 ++++++++++ arch/arm64/kernel/setup.c | 8 + arch/arm64/kernel/smp.c | 2 + arch/arm64/mm/Makefile | 1 + arch/arm64/mm/init.c | 34 +- arch/arm64/mm/numa.c | 520 ++++++++++++++++ 13 files changed, 2032 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/numa.txt create mode 100644 arch/arm64/boot/dts/thunder-88xx-2n.dts create mode 100644 arch/arm64/boot/dts/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/dt_numa.c create mode 100644 arch/arm64/mm/numa.c
Signature · 6 lines
1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1420011208-7051-1-git-send-email-ganapatrao.kulkarni-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org
RFC PATCH v3 1/4 arm64: defconfig: increase NR_CPUS range to 2-4096.
Raising the maximum limit to 4096.
This is to accomadate up-coming higher multi-core platforms.
--- arch/arm64/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/Kconfig +2 -2
@@ -302,8 +302,8 @@ config SCHED_SMT places. If unsure say N here. config NR_CPUS - int "Maximum number of CPUs (2-64)" - range 2 64 + int "Maximum number of CPUs (2-4096)" + range 2 4096 depends on SMP # These have to remain sorted largest to smallest default "64"
Signature · 6 lines
1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1420011208-7051-2-git-send-email-ganapatrao.kulkarni-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org
Arnd Bergmann
Acked-byRe: [RFC PATCH v3 1/4] arm64: defconfig: increase NR_CPUS range to 2-4096.
Quoted 4 lines · On Wednesday 31 December 2014 13:03:25 Ganapatrao Kulkarni wrote:
Raising the maximum limit to 4096.
This is to accomadate up-coming higher multi-core platforms.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC PATCH v3 1/4 arm64: defconfig: increase NR_CPUS range to 2-4096.
In reply to Ganapatrao KulkarniQuoted 4 lines · On Wednesday 31 December 2014 13:03:25 Ganapatrao Kulkarni wrote:
Raising the maximum limit to 4096.
This is to accomadate up-coming higher multi-core platforms.Signed-off-by Ganapatrao Kulkarni <[email protected]>
RFC PATCH v3 2/4 Documentation: arm64/arm: dt bindings for numa.
In reply to a message not in the archiveDT bindings for numa map for memory, cores and IOs using arm,associativity device node property.
--- Documentation/devicetree/bindings/arm/numa.txt | 198 +++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/numa.txt
Documentation/devicetree/bindings/arm/numa.txt new file +198 -0
@@ -0,0 +1,198 @@ +============================================================================== +NUMA binding description. +============================================================================== + +============================================================================== +1 - Introduction +============================================================================== + +Systems employing a Non Uniform Memory Access (NUMA) architecture contain +collections of hardware resources including processors, memory, and I/O buses, +that comprise what is commonly known as a “NUMA node”. +Processor accesses to memory within the local NUMA node is generally faster +than processor accesses to memory outside of the local NUMA node. +DT defines interfaces that allow the platform to convey NUMA node +topology information to OS. + +============================================================================== +2 - arm,associativity +============================================================================== + +The mapping is done using arm,associativity device property. +this property needs to be present in every device node which needs to to be +mapped to numa nodes. + +arm,associativity property is set of 32-bit integers. representing the +board id, socket id and core id. + +ex: + /* board 0, socket 0, core 0 */ + arm,associativity = <0 0 0x000>; + + /* board 1, socket 0, core 8 */ + arm,associativity = <1 0 0x08>; + +============================================================================== +3 - arm,associativity-reference-points +============================================================================== +This property is a set of 32-bit integers, each representing an index into +the arm,associativity nodes. The first integer is the most significant +NUMA boundary and the following are progressively less significant boundaries. +There can be more than one level of NUMA. + +Ex: + arm,associativity-reference-points = <0 1>; + The board Id(index 0) used first to calculate the associativity (node + distance), then follows the socket id(index 1). + + arm,associativity-reference-points = <1 0>; + The socket Id(index 1) used first to calculate the associativity, + then follows the board id(index 0). + + arm,associativity-reference-points = <0>; + Only the board Id(index 0) used to calculate the associativity. + + arm,associativity-reference-points = <1>; + Only socket Id(index 1) used to calculate the associativity. + +============================================================================== +4 - Example dts +============================================================================== + +Example: 2 Node system consists of 2 boards and each board having one socket +and 8 core in each socket. + + arm,associativity-reference-points = <0 1>; + + memory@00c00000 { + device_type = "memory"; + reg = <0x0 0x00c00000 0x0 0x80000000>; + /* board 0, socket 0, no specific core */ + arm,associativity = <0 0 0xffff>; + }; + + memory@10000000000 { + device_type = "memory"; + reg = <0x100 0x00000000 0x0 0x80000000>; + /* board 1, socket 0, no specific core */ + arm,associativity = <1 0 0xffff>; + }; + + cpus { + #address-cells = <2>; + #size-cells = <0>; + + cpu@000 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x000>; + enable-method = "psci"; + /* board 0, socket 0, core 0*/ + arm,associativity = <0 0 0x000>; + }; + cpu@001 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x001>; + enable-method = "psci"; + arm,associativity = <0 0 0x001>; + }; + cpu@002 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x002>; + enable-method = "psci"; + arm,associativity = <0 0 0x002>; + }; + cpu@003 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x003>; + enable-method = "psci"; + arm,associativity = <0 0 0x003>; + }; + cpu@004 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x004>; + enable-method = "psci"; + arm,associativity = <0 0 0x004>; + }; + cpu@005 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x005>; + enable-method = "psci"; + arm,associativity = <0 0 0x005>; + }; + cpu@006 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x006>; + enable-method = "psci"; + arm,associativity = <0 0 0x006>; + }; + cpu@007 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x007>; + enable-method = "psci"; + arm,associativity = <0 0 0x007>; + }; + cpu@008 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x008>; + enable-method = "psci"; + /* board 1, socket 0, core 0*/ + arm,associativity = <1 0 0x008>; + }; + cpu@009 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x009>; + enable-method = "psci"; + arm,associativity = <1 0 0x009>; + }; + cpu@00a { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x00a>; + enable-method = "psci"; + arm,associativity = <0 0 0x00a>; + }; + cpu@00b { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x00b>; + enable-method = "psci"; + arm,associativity = <1 0 0x00b>; + }; + cpu@00c { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x00c>; + enable-method = "psci"; + arm,associativity = <1 0 0x00c>; + }; + cpu@00d { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x00d>; + enable-method = "psci"; + arm,associativity = <1 0 0x00d>; + }; + cpu@00e { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x00e>; + enable-method = "psci"; + arm,associativity = <1 0 0x00e>; + }; + cpu@00f { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0x0 0x00f>; + enable-method = "psci"; + arm,associativity = <1 0 0x00f>; + };
Signature · 6 lines
1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1420011208-7051-3-git-send-email-ganapatrao.kulkarni-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org
Re: [RFC PATCH v3 2/4] Documentation: arm64/arm: dt bindings for numa.
Quoted 38 lines · On Wednesday 31 December 2014 13:03:26 Ganapatrao Kulkarni wrote:
DT bindings for numa map for memory, cores and IOs using arm,associativity device node property.
Signed-off-by Ganapatrao Kulkarni <[email protected]>--- Documentation/devicetree/bindings/arm/numa.txt | 198 +++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/numa.txtDocumentation/devicetree/bindings/arm/numa.txt new file +23
-0@@ -0,0 +1,198 @@ +============================================================================== +NUMA binding description. +============================================================================== + +============================================================================== +1 - Introduction +============================================================================== + +Systems employing a Non Uniform Memory Access (NUMA) architecture contain +collections of hardware resources including processors, memory, and I/O buses, +that comprise what is commonly known as a “NUMA node�. +Processor accesses to memory within the local NUMA node is generally faster +than processor accesses to memory outside of the local NUMA node. +DT defines interfaces that allow the platform to convey NUMA node +topology information to OS. + +============================================================================== +2 - arm,associativity +============================================================================== + +The mapping is done using arm,associativity device property. +this property needs to be present in every device node which needs to to be +mapped to numa nodes.
Documentation/devicetree/bindings/arm/numa.txt line 33
Quoted 10 lines
Documentation/devicetree/bindings/arm/numa.txt new file +10
-0+ +arm,associativity property is set of 32-bit integers. representing the +board id, socket id and core id. + +ex: + /* board 0, socket 0, core 0 */ + arm,associativity = <0 0 0x000>; + + /* board 1, socket 0, core 8 */ + arm,associativity = <1 0 0x08>;
This is way too specific to Cavium machines. Most other vendors will not (at first) have multiple boards or multiple sockets, but need to represent multiple clusters and/or SMT threads instead. Also the wording suggests that this is only relevant for NUMA, which I don't think is helpful because we will also want to describe the topology within one NUMA node for locality.
I think we should stick to the powerpc definition here and not define what the levels mean at the binding level. Something like:
"Each level of topology defines a boundary in the system at which a significant difference in performance can be measured between cross-device accesses within a single location and those spanning multiple locations. The first cell always contains the broadest subdivision within the system, while the last cell enumerates the individual devices, such as an SMT thread of a CPU, or a bus bridge within an SoC".
Quoted 19 lines
Documentation/devicetree/bindings/arm/numa.txt new file +19
-0+============================================================================== +3 - arm,associativity-reference-points +============================================================================== +This property is a set of 32-bit integers, each representing an index into +the arm,associativity nodes. The first integer is the most significant +NUMA boundary and the following are progressively less significant boundaries. +There can be more than one level of NUMA. + +Ex: + arm,associativity-reference-points = <0 1>; + The board Id(index 0) used first to calculate the associativity (node + distance), then follows the socket id(index 1). + + arm,associativity-reference-points = <1 0>; + The socket Id(index 1) used first to calculate the associativity, + then follows the board id(index 0). + + arm,associativity-reference-points = <0>; + Only the board Id(index 0) used to calculate the associativity.
Documentation/devicetree/bindings/arm/numa.txt line 63
Quoted 10 lines
Documentation/devicetree/bindings/arm/numa.txt new file +10
-0+ + arm,associativity-reference-points = <1>; + Only socket Id(index 1) used to calculate the associativity. + +============================================================================== +4 - Example dts +============================================================================== + +Example: 2 Node system consists of 2 boards and each board having one socket +and 8 core in each socket.
I think the example should also include a PCI controller.
Documentation/devicetree/bindings/arm/numa.txt line 64
Quoted 2 lines
Documentation/devicetree/bindings/arm/numa.txt new file +2
-0+ + arm,associativity-reference-points = <0 1>;
This doesn't really match the associativity properties, because the second level in the cpus nodes is completely meaningless and should not be listed as a secondary reference point.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC PATCH v3 2/4 Documentation: arm64/arm: dt bindings for numa.
In reply to Ganapatrao KulkarniQuoted 38 lines · On Wednesday 31 December 2014 13:03:26 Ganapatrao Kulkarni wrote:
DT bindings for numa map for memory, cores and IOs using arm,associativity device node property.
Signed-off-by Ganapatrao Kulkarni <[email protected]>--- Documentation/devicetree/bindings/arm/numa.txt | 198 +++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/numa.txtDocumentation/devicetree/bindings/arm/numa.txt new file +23
-0@@ -0,0 +1,198 @@ +============================================================================== +NUMA binding description. +============================================================================== + +============================================================================== +1 - Introduction +============================================================================== + +Systems employing a Non Uniform Memory Access (NUMA) architecture contain +collections of hardware resources including processors, memory, and I/O buses, +that comprise what is commonly known as a ???NUMA node???. +Processor accesses to memory within the local NUMA node is generally faster +than processor accesses to memory outside of the local NUMA node. +DT defines interfaces that allow the platform to convey NUMA node +topology information to OS. + +============================================================================== +2 - arm,associativity +============================================================================== + +The mapping is done using arm,associativity device property. +this property needs to be present in every device node which needs to to be +mapped to numa nodes.
Documentation/devicetree/bindings/arm/numa.txt line 33
Quoted 10 lines
Documentation/devicetree/bindings/arm/numa.txt new file +10
-0+ +arm,associativity property is set of 32-bit integers. representing the +board id, socket id and core id. + +ex: + /* board 0, socket 0, core 0 */ + arm,associativity = <0 0 0x000>; + + /* board 1, socket 0, core 8 */ + arm,associativity = <1 0 0x08>;
This is way too specific to Cavium machines. Most other vendors will not (at first) have multiple boards or multiple sockets, but need to represent multiple clusters and/or SMT threads instead. Also the wording suggests that this is only relevant for NUMA, which I don't think is helpful because we will also want to describe the topology within one NUMA node for locality.
I think we should stick to the powerpc definition here and not define what the levels mean at the binding level. Something like:
"Each level of topology defines a boundary in the system at which a significant difference in performance can be measured between cross-device accesses within a single location and those spanning multiple locations. The first cell always contains the broadest subdivision within the system, while the last cell enumerates the individual devices, such as an SMT thread of a CPU, or a bus bridge within an SoC".
Quoted 19 lines
Documentation/devicetree/bindings/arm/numa.txt new file +19
-0+============================================================================== +3 - arm,associativity-reference-points +============================================================================== +This property is a set of 32-bit integers, each representing an index into +the arm,associativity nodes. The first integer is the most significant +NUMA boundary and the following are progressively less significant boundaries. +There can be more than one level of NUMA. + +Ex: + arm,associativity-reference-points = <0 1>; + The board Id(index 0) used first to calculate the associativity (node + distance), then follows the socket id(index 1). + + arm,associativity-reference-points = <1 0>; + The socket Id(index 1) used first to calculate the associativity, + then follows the board id(index 0). + + arm,associativity-reference-points = <0>; + Only the board Id(index 0) used to calculate the associativity.
Documentation/devicetree/bindings/arm/numa.txt line 63
Quoted 10 lines
Documentation/devicetree/bindings/arm/numa.txt new file +10
-0+ + arm,associativity-reference-points = <1>; + Only socket Id(index 1) used to calculate the associativity. + +============================================================================== +4 - Example dts +============================================================================== + +Example: 2 Node system consists of 2 boards and each board having one socket +and 8 core in each socket.
I think the example should also include a PCI controller.
Documentation/devicetree/bindings/arm/numa.txt line 64
Quoted 2 lines
Documentation/devicetree/bindings/arm/numa.txt new file +2
-0+ + arm,associativity-reference-points = <0 1>;
This doesn't really match the associativity properties, because the second level in the cpus nodes is completely meaningless and should not be listed as a secondary reference point.
Arnd
RFC PATCH v3 2/4 Documentation: arm64/arm: dt bindings for numa.
Hi Arnd,
Quoted 59 lines · Arnd Bergmann
Quoted 38 lines · On Wednesday 31 December 2014 13:03:26 Ganapatrao Kulkarni wrote:
DT bindings for numa map for memory, cores and IOs using arm,associativity device node property.
Signed-off-by Ganapatrao Kulkarni <[email protected]>--- Documentation/devicetree/bindings/arm/numa.txt | 198 +++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/numa.txtDocumentation/devicetree/bindings/arm/numa.txt new file +23
-0@@ -0,0 +1,198 @@ +============================================================================== +NUMA binding description. +============================================================================== + +============================================================================== +1 - Introduction +============================================================================== + +Systems employing a Non Uniform Memory Access (NUMA) architecture contain +collections of hardware resources including processors, memory, and I/O buses, +that comprise what is commonly known as a ???NUMA node?? . +Processor accesses to memory within the local NUMA node is generally faster +than processor accesses to memory outside of the local NUMA node. +DT defines interfaces that allow the platform to convey NUMA node +topology information to OS. + +============================================================================== +2 - arm,associativity +============================================================================== + +The mapping is done using arm,associativity device property. +this property needs to be present in every device node which needs to to be +mapped to numa nodes.Documentation/devicetree/bindings/arm/numa.txt line 33
Quoted 10 lines
Documentation/devicetree/bindings/arm/numa.txt new file +10
-0+ +arm,associativity property is set of 32-bit integers. representing the +board id, socket id and core id. + +ex: + /* board 0, socket 0, core 0 */ + arm,associativity = <0 0 0x000>; + + /* board 1, socket 0, core 8 */ + arm,associativity = <1 0 0x08>;This is way too specific to Cavium machines. Most other vendors will not (at first) have multiple boards or multiple sockets, but need to represent multiple clusters and/or SMT threads instead. Also the wording suggests that this is only relevant for NUMA, which I don't think is helpful because we will also want to describe the topology within one NUMA node for locality.
I think we should stick to the powerpc definition here and not define what the levels mean at the binding level. Something like:
Quoted 6 lines
"Each level of topology defines a boundary in the system at which a significant difference in performance can be measured between cross-device accesses within a single location and those spanning multiple locations. The first cell always contains the broadest subdivision within the system, while the last cell enumerates the individual devices, such as an SMT thread of a CPU, or a bus bridge within an SoC".
Ok,, i will change as suggested.
Quoted 24 lines
Quoted 24 lines
Documentation/devicetree/bindings/arm/numa.txt new file +23
-0+============================================================================== +3 - arm,associativity-reference-points +============================================================================== +This property is a set of 32-bit integers, each representing an index into +the arm,associativity nodes. The first integer is the most significant +NUMA boundary and the following are progressively less significant boundaries. +There can be more than one level of NUMA. + +Ex: + arm,associativity-reference-points = <0 1>; + The board Id(index 0) used first to calculate the associativity (node + distance), then follows the socket id(index 1). + + arm,associativity-reference-points = <1 0>; + The socket Id(index 1) used first to calculate the associativity, + then follows the board id(index 0). + + arm,associativity-reference-points = <0>; + Only the board Id(index 0) used to calculate the associativity. + + arm,associativity-reference-points = <1>; + Only socket Id(index 1) used to calculate the associativity. +
Quoted 8 lines
Documentation/devicetree/bindings/arm/numa.txt line 63
Quoted 6 lines
Documentation/devicetree/bindings/arm/numa.txt new file +6
-0+============================================================================== +4 - Example dts +============================================================================== + +Example: 2 Node system consists of 2 boards and each board having one socket +and 8 core in each socket.I think the example should also include a PCI controller.
Yes, i will add pci.
Quoted 7 lines
Documentation/devicetree/bindings/arm/numa.txt line 64
Quoted 3 lines
Documentation/devicetree/bindings/arm/numa.txt new file +2
-0+ + arm,associativity-reference-points = <0 1>;This doesn't really match the associativity properties, because the second level in the cpus nodes is completely meaningless and should not be listed as a secondary reference point.
agreed, will remove second entry.
Quoted 2 lines
Arnd
thanks
ganapat
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
In reply to a message not in the archiveadding dt file for Cavium's Thunder SoC in 2 Node topology using arm,associativity device node property.
--- arch/arm64/boot/dts/thunder-88xx-2n.dts | 78 +++ arch/arm64/boot/dts/thunder-88xx-2n.dtsi | 789 +++++++++++++++++++++++++++++++ 2 files changed, 867 insertions(+) create mode 100644 arch/arm64/boot/dts/thunder-88xx-2n.dts create mode 100644 arch/arm64/boot/dts/thunder-88xx-2n.dtsi
arch/arm64/boot/dts/thunder-88xx-2n.dts new file +78 -0
@@ -0,0 +1,78 @@ +/* + * Cavium Thunder DTS file - Thunder board description + * + * Copyright (C) 2014, Cavium Inc. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; + +/include/ "thunder-88xx-2n.dtsi" + +/ { + model = "Cavium ThunderX CN88XX board"; + compatible = "cavium,thunder-88xx"; + arm,associativity-reference-points = <0 1>; + + aliases { + serial0 = &uaa0; + serial1 = &uaa1; + }; + + memory@00000000 { + device_type = "memory"; + reg = <0x0 0x00000000 0x0 0x80000000>; + /* board 0, socket 0, no specific core */ + arm,associativity = <0 0 0xffff>; + }; + + memory@10000000000 { + device_type = "memory"; + reg = <0x100 0x00000000 0x0 0x80000000>; + /* board 1, socket 0, no specific core */ + arm,associativity = <1 0 0xffff>; + }; + +};
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +789 -0
789 lines not on this page · raw message
Signature · 6 lines
1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1420011208-7051-4-git-send-email-ganapatrao.kulkarni-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org
Re: [RFC PATCH v3 3/4] arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Quoted 5 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
arch/arm64/boot/dts/thunder-88xx-2n.dts new file +5
-0+ + memory@00000000 { + device_type = "memory"; + reg = <0x0 0x00000000 0x0 0x80000000>; + /* board 0, socket 0, no specific core */
arch/arm64/boot/dts/thunder-88xx-2n.dts line 78
Quoted 10 lines
arch/arm64/boot/dts/thunder-88xx-2n.dts new file +10
-0+ arm,associativity = <0 0 0xffff>; + }; + + memory@10000000000 { + device_type = "memory"; + reg = <0x100 0x00000000 0x0 0x80000000>; + /* board 1, socket 0, no specific core */ + arm,associativity = <1 0 0xffff>; + }; +};
So no memory in any other socket?
Quoted 4 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +4
-0+ cpu@00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>;
arch/arm64/boot/dts/thunder-88xx-2n.dtsi line 184
Quoted 10 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +10
-0+ enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu@100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };
What is the 0x100 offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.
In contrast, the level-two topology information seems to always be zero for all CPUs, so you could probably leave that one out.
arch/arm64/boot/dts/thunder-88xx-2n.dtsi line 753
Quoted 5 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +5
-0+ soc { + compatible = "simple-bus"; + #address-cells = <2>; + #size-cells = <2>; + ranges;
The soc node is missing a topology information, please add one.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
In reply to Ganapatrao KulkarniQuoted 5 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
arch/arm64/boot/dts/thunder-88xx-2n.dts new file +5
-0+ + memory at 00000000 { + device_type = "memory"; + reg = <0x0 0x00000000 0x0 0x80000000>; + /* board 0, socket 0, no specific core */
arch/arm64/boot/dts/thunder-88xx-2n.dts line 78
Quoted 10 lines
arch/arm64/boot/dts/thunder-88xx-2n.dts new file +10
-0+ arm,associativity = <0 0 0xffff>; + }; + + memory at 10000000000 { + device_type = "memory"; + reg = <0x100 0x00000000 0x0 0x80000000>; + /* board 1, socket 0, no specific core */ + arm,associativity = <1 0 0xffff>; + }; +};
So no memory in any other socket?
Quoted 4 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +4
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>;
arch/arm64/boot/dts/thunder-88xx-2n.dtsi line 184
Quoted 10 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +10
-0+ enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };
What is the 0x100 offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.
In contrast, the level-two topology information seems to always be zero for all CPUs, so you could probably leave that one out.
arch/arm64/boot/dts/thunder-88xx-2n.dtsi line 753
Quoted 5 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +5
-0+ soc { + compatible = "simple-bus"; + #address-cells = <2>; + #size-cells = <2>; + ranges;
The soc node is missing a topology information, please add one.
Arnd
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Quoted 34 lines · Arnd Bergmann
Quoted 5 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
arch/arm64/boot/dts/thunder-88xx-2n.dts new file +5
-0+ + memory at 00000000 { + device_type = "memory"; + reg = <0x0 0x00000000 0x0 0x80000000>; + /* board 0, socket 0, no specific core */arch/arm64/boot/dts/thunder-88xx-2n.dts line 78
Quoted 10 lines
arch/arm64/boot/dts/thunder-88xx-2n.dts new file +10
-0+ arm,associativity = <0 0 0xffff>; + }; + + memory at 10000000000 { + device_type = "memory"; + reg = <0x100 0x00000000 0x0 0x80000000>; + /* board 1, socket 0, no specific core */ + arm,associativity = <1 0 0xffff>; + }; +};So no memory in any other socket?
Quoted 4 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +4
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>;arch/arm64/boot/dts/thunder-88xx-2n.dtsi line 184
Quoted 10 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +10
-0+ enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };
Quoted 4 lines
What is the
0x100offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.
i did not understand, can you please explain little more about " should be represented as a separate level."
at present, i have put the hwid of a cpu.
Quoted 11 lines
In contrast, the level-two topology information seems to always be zero for all CPUs, so you could probably leave that one out.
arch/arm64/boot/dts/thunder-88xx-2n.dtsi line 753
Quoted 5 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +5
-0+ soc { + compatible = "simple-bus"; + #address-cells = <2>; + #size-cells = <2>; + ranges;The soc node is missing a topology information, please add one.
ok, will be added.
Quoted 2 lines
Arnd
thanks
ganapat
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Quoted 22 lines · On Tuesday 06 January 2015 15:04:26 Ganapatrao Kulkarni wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 4 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +4
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>;arch/arm64/boot/dts/thunder-88xx-2n.dtsi line 184
Quoted 10 lines
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +10
-0+ enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };Quoted 4 lines
What is the
0x100offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.
Quoted 5 lines
i did not understand, can you please explain little more about " should be represented as a separate level."
at present, i have put the hwid of a cpu.From what I undertand, the hwid of the CPU contains the "cluster" number in
this bit position, so you typically have a shared L2 or L3 cache between all cores within a cluster, but separate caches in other clusters.
If this is the case, there will be a measurable difference in performance between two processes sharing memory when running on the same cluster, or when running on different clusters on the same socket. If the performance difference is relevant, it should be described as a separate level in the associativity property.
Arnd
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Hi Arnd,
Quoted 31 lines · Arnd Bergmann
Quoted 17 lines · On Tuesday 06 January 2015 15:04:26 Ganapatrao Kulkarni wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +14
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>; + enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };Quoted 8 lines
Quoted 4 lines
What is the
0x100offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.i did not understand, can you please explain little more about " should be represented as a separate level."
at present, i have put the hwid of a cpu.From what I undertand, the hwid of the CPU contains the "cluster" number in this bit position, so you typically have a shared L2 or L3 cache between all cores within a cluster, but separate caches in other clusters.
Quoted 5 lines
If this is the case, there will be a measurable difference in performance between two processes sharing memory when running on the same cluster, or when running on different clusters on the same socket. If the performance difference is relevant, it should be described as a separate level in the associativity property.
you mean, the associativity as array of <board> <socket> <cluster>
Quoted 2 lines
Arnd
thanks
ganapat
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Quoted 34 lines · On Wednesday 07 January 2015 12:37:51 Ganapatrao Kulkarni wrote:
Hi Arnd,
Quoted 31 lines · Arnd Bergmann
Quoted 17 lines · On Tuesday 06 January 2015 15:04:26 Ganapatrao Kulkarni wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +14
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>; + enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };Quoted 8 lines
Quoted 4 lines
What is the
0x100offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.i did not understand, can you please explain little more about " should be represented as a separate level."
at present, i have put the hwid of a cpu.From what I undertand, the hwid of the CPU contains the "cluster" number in this bit position, so you typically have a shared L2 or L3 cache between all cores within a cluster, but separate caches in other clusters.
Quoted 6 lines
Quoted 5 lines
If this is the case, there will be a measurable difference in performance between two processes sharing memory when running on the same cluster, or when running on different clusters on the same socket. If the performance difference is relevant, it should be described as a separate level in the associativity property.
you mean, the associativity as array of <board> <socket> <cluster>
No, that would leave out the core number, which is required to identify the individual thread. I meant adding an extra level such as
<board> <socket> <cluster> <core>
A lot of machines will leave out the <board> number because they are built with SoCs that don't have a long-distance coherency protocol.
Arnd
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Quoted 42 lines · Arnd Bergmann
Quoted 34 lines · On Wednesday 07 January 2015 12:37:51 Ganapatrao Kulkarni wrote:
Hi Arnd,
Quoted 31 lines · Arnd Bergmann
Quoted 17 lines · On Tuesday 06 January 2015 15:04:26 Ganapatrao Kulkarni wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
arch/arm64/boot/dts/thunder-88xx-2n.dtsi new file +14
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>; + enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };Quoted 8 lines
Quoted 4 lines
What is the
0x100offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.i did not understand, can you please explain little more about " should be represented as a separate level."
at present, i have put the hwid of a cpu.From what I undertand, the hwid of the CPU contains the "cluster" number in this bit position, so you typically have a shared L2 or L3 cache between all cores within a cluster, but separate caches in other clusters.
Quoted 6 lines
Quoted 5 lines
If this is the case, there will be a measurable difference in performance between two processes sharing memory when running on the same cluster, or when running on different clusters on the same socket. If the performance difference is relevant, it should be described as a separate level in the associativity property.
you mean, the associativity as array of <board> <socket> <cluster>
Quoted 7 lines
No, that would leave out the core number, which is required to identify the individual thread. I meant adding an extra level such as
<board> <socket> <cluster> <core>
A lot of machines will leave out the <board> number because they are built with SoCs that don't have a long-distance coherency protocol.
Can't we use phandles to cpu-map nodes instead of a list of numbers (and yet another topology binding description) ?
Is arm,associativity used solely to map "devices" (inclusive of caches) to a set of cpus ?
cpu-map misses a notion of distance between hierarchy layers, but we can add to that.
Lorenzo
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Hi Lorenzo,
Quoted 46 lines · Lorenzo Pieralisi
Quoted 45 lines · Arnd Bergmann
Quoted 34 lines · On Wednesday 07 January 2015 12:37:51 Ganapatrao Kulkarni wrote:
Hi Arnd,
Quoted 31 lines · Arnd Bergmann
Quoted 17 lines · On Tuesday 06 January 2015 15:04:26 Ganapatrao Kulkarni wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
(quoted diff) +14
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>; + enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };Quoted 8 lines
Quoted 4 lines
What is the
0x100offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.i did not understand, can you please explain little more about " should be represented as a separate level."
at present, i have put the hwid of a cpu.From what I undertand, the hwid of the CPU contains the "cluster" number in this bit position, so you typically have a shared L2 or L3 cache between all cores within a cluster, but separate caches in other clusters.
Quoted 6 lines
Quoted 5 lines
If this is the case, there will be a measurable difference in performance between two processes sharing memory when running on the same cluster, or when running on different clusters on the same socket. If the performance difference is relevant, it should be described as a separate level in the associativity property.
you mean, the associativity as array of <board> <socket> <cluster>
No, that would leave out the core number, which is required to identify the individual thread. I meant adding an extra level such as
Quoted 7 lines
Quoted 4 lines
<board> <socket> <cluster> <core>
A lot of machines will leave out the <board> number because they are built with SoCs that don't have a long-distance coherency protocol.
Can't we use phandles to cpu-map nodes instead of a list of numbers (and yet another topology binding description) ?
cpu-map describes only a cpu topology.
infact, i have tried initially(in v1 patch set) to use topology for the numa mapping.
However, for numa, we need to define association of cpu, memory and IOs. arm,associativity is a generic node property and can be used in any dt nodes.
Quoted 8 lines
Is arm,associativity used solely to map "devices" (inclusive of caches) to a set of cpus ?
cpu-map misses a notion of distance between hierarchy layers, but we can add to that.
Lorenzo
thanks
ganapat
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Quoted 55 lines · Ganapatrao Kulkarni
Hi Lorenzo,
Quoted 51 lines · Lorenzo Pieralisi
Quoted 49 lines · Arnd Bergmann
Quoted 34 lines · On Wednesday 07 January 2015 12:37:51 Ganapatrao Kulkarni wrote:
Hi Arnd,
Quoted 31 lines · Arnd Bergmann
Quoted 17 lines · On Tuesday 06 January 2015 15:04:26 Ganapatrao Kulkarni wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · On Wednesday 31 December 2014 13:03:27 Ganapatrao Kulkarni wrote:
(quoted diff) +14
-0+ cpu at 00f { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x00f>; + enable-method = "psci"; + arm,associativity = <0 0 0x00f>; + }; + cpu at 100 { + device_type = "cpu"; + compatible = "cavium,thunder", "arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + arm,associativity = <0 0 0x100>; + };Quoted 8 lines
Quoted 4 lines
What is the
0x100offset in the last-level topology field? Does this have no significance to topology at all? I would expect that to be something like cluster number that is relevant to caching and should be represented as a separate level.i did not understand, can you please explain little more about " should be represented as a separate level."
at present, i have put the hwid of a cpu.From what I undertand, the hwid of the CPU contains the "cluster" number in this bit position, so you typically have a shared L2 or L3 cache between all cores within a cluster, but separate caches in other clusters.
Quoted 6 lines
Quoted 5 lines
If this is the case, there will be a measurable difference in performance between two processes sharing memory when running on the same cluster, or when running on different clusters on the same socket. If the performance difference is relevant, it should be described as a separate level in the associativity property.
you mean, the associativity as array of <board> <socket> <cluster>
No, that would leave out the core number, which is required to identify the individual thread. I meant adding an extra level such as
<board> <socket> <cluster> <core>
A lot of machines will leave out the <board> number because they are built with SoCs that don't have a long-distance coherency protocol.
Quoted 7 lines
Quoted 2 lines
Can't we use phandles to cpu-map nodes instead of a list of numbers (and yet another topology binding description) ?
cpu-map describes only a cpu topology.
infact, i have tried initially(in v1 patch set) to use topology for the numa mapping.
However, for numa, we need to define association of cpu, memory and IOs. arm,associativity is a generic node property and can be used in any dt nodes.
I understand that, I was advising to define "arm,associativity" as a phandle in cpu nodes AND all devices.
Why can't you make it point at a phandle in the cpu-map instead of adding a t-uple doing the same thing. Am I missing something here ? cpu-map allows you to describe the system hierarchy and can expand beyond clusters (several layers of clusterings, above core it is just a way to define the system hierarchy, leaves node will always be cores or threads).
On a side note, one of the reasons cpu-map was devised for was exactly that, to allow mappings of resources (ie IRQs but it is valid for caches and other devices too) to groups of CPUs.
Is there anything that you can't do by using cpu-map phandles to describe devices associativity ?
We have to add bindings that allow to compute the distance as you do by using the reference points (I am reading the code to figure out how it is used), but that's feasible as a binding update.
Lorenzo
RFC PATCH v3 3/4 arm64:thunder: Add initial dts for Cavium's Thunder SoC in 2 Node topology.
Quoted 20 lines · On Wednesday 14 January 2015 23:49:05 Lorenzo Pieralisi wrote:
Quoted 11 lines · Ganapatrao Kulkarni
Quoted 9 lines · Lorenzo Pieralisi
Quoted 7 lines · Arnd Bergmann
No, that would leave out the core number, which is required to identify the individual thread. I meant adding an extra level such as
<board> <socket> <cluster> <core>
A lot of machines will leave out the <board> number because they are built with SoCs that don't have a long-distance coherency protocol.
Quoted 7 lines
Quoted 2 lines
Can't we use phandles to cpu-map nodes instead of a list of numbers (and yet another topology binding description) ?
cpu-map describes only a cpu topology.
infact, i have tried initially(in v1 patch set) to use topology for the numa mapping.
However, for numa, we need to define association of cpu, memory and IOs. arm,associativity is a generic node property and can be used in any dt nodes.
Quoted 5 lines
I understand that, I was advising to define "arm,associativity" as a phandle in cpu nodes AND all devices.
Why can't you make it point at a phandle in the cpu-map instead of adding a t-uple doing the same thing. Am I missing something here ?
Most importantly, it's following an existing spec for ibm,associativity, which defines topology in terms of associativity, not a hierarchical tree.
Quoted 10 lines
cpu-map allows you to describe the system hierarchy and can expand beyond clusters (several layers of clusterings, above core it is just a way to define the system hierarchy, leaves node will always be cores or threads).
On a side note, one of the reasons cpu-map was devised for was exactly that, to allow mappings of resources (ie IRQs but it is valid for caches and other devices too) to groups of CPUs.
Is there anything that you can't do by using cpu-map phandles to describe devices associativity ?
- It doesn't work for cpu-less nodes.
- It fails if you have multiple paths between two devices, rather than a strict tree.
- It doesn't (yet) have a way to define which levels are relevant to NUMA topology.
- the phandle references are done in the wrong way if you want to represent a lot of devices.
Quoted 3 lines
We have to add bindings that allow to compute the distance as you do by using the reference points (I am reading the code to figure out how it is used), but that's feasible as a binding update.
It's very unfortunate that we have two conflicting bindings that are established. I still think that the associativity binding is more flexible, but we could try to extend the arm topology binding if necessary, but I'm not sure the end result of that would be better.
Arnd
RFC PATCH v3 4/4 arm64:numa: adding numa support for arm64 platforms.
In reply to a message not in the archiveAdding numa support for arm64 based platforms.
Adding dt node pasring for numa topology using property arm,associativity.
--- arch/arm64/Kconfig | 32 +++ arch/arm64/include/asm/mmzone.h | 32 +++ arch/arm64/include/asm/numa.h | 45 ++++ arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/dt_numa.c | 296 +++++++++++++++++++++++ arch/arm64/kernel/setup.c | 8 + arch/arm64/kernel/smp.c | 2 + arch/arm64/mm/Makefile | 1 + arch/arm64/mm/init.c | 34 ++- arch/arm64/mm/numa.c | 520 ++++++++++++++++++++++++++++++++++++++++ 10 files changed, 965 insertions(+), 6 deletions(-) create mode 100644 arch/arm64/include/asm/mmzone.h create mode 100644 arch/arm64/include/asm/numa.h create mode 100644 arch/arm64/kernel/dt_numa.c create mode 100644 arch/arm64/mm/numa.c
arch/arm64/Kconfig +32 -0
@@ -59,6 +59,7 @@ config ARM64 select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE select HAVE_SYSCALL_TRACEPOINTS + select HAVE_MEMBLOCK_NODE_MAP if NUMA select IRQ_DOMAIN select MODULES_USE_ELF_RELA select NO_BOOTMEM
@@ -315,6 +316,37 @@ config HOTPLUG_CPU Say Y here to experiment with turning CPUs off and on. CPUs can be controlled through /sys/devices/system/cpu. +# Common NUMA Features +config NUMA + bool "Numa Memory Allocation and Scheduler Support" + depends on SMP + ---help--- + Enable NUMA (Non Uniform Memory Access) support. + + The kernel will try to allocate memory used by a CPU on the + local memory controller of the CPU and add some more + NUMA awareness to the kernel. + +config ARM64_DT_NUMA + def_bool n + prompt "DT NUMA detection" + ---help--- + Enable DT based numa. + +config NODES_SHIFT + int "Maximum NUMA Nodes (as a power of 2)" + range 1 10 + default "2" + depends on NEED_MULTIPLE_NODES + ---help--- + Specify the maximum number of NUMA Nodes available on the target + system. Increases memory reserved to accommodate various tables. + +config USE_PERCPU_NUMA_NODE_ID + def_bool y + depends on NUMA + + source kernel/Kconfig.preempt config HZ
arch/arm64/include/asm/mmzone.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef __ASM_ARM64_MMZONE_H_ +#define __ASM_ARM64_MMZONE_H_ + +#ifdef CONFIG_NUMA + +#include <linux/mmdebug.h> +#include <asm/smp.h> +#include <linux/types.h> +#include <asm/numa.h> + +extern struct pglist_data *node_data[]; + +#define NODE_DATA (nid) (node_data[nid]) + + +struct numa_memblk { +u64 start; +u64 end; +int nid; +}; + +struct numa_meminfo { +int nr_blks; +struct numa_memblk blk[NR_NODE_MEMBLKS ]; +}; + +void __init numa_remove_memblk_from (int idx,struct numa_meminfo *mi); +int __init numa_cleanup_meminfo (struct numa_meminfo *mi); +void __init numa_reset_distance (void ); + +#endif /* CONFIG_NUMA */ +#endif /* __ASM_ARM64_MMZONE_H_ */
arch/arm64/include/asm/numa.h new file +45 -0
45 lines not on this page · raw message
arch/arm64/kernel/Makefile +1 -0
@@ -31,6 +31,7 @@ arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o arm64-obj-$(CONFIG_KGDB) += kgdb.o arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o arm64-obj-$(CONFIG_PCI) += pci.o +arm64-obj-$(CONFIG_ARM64_DT_NUMA) += dt_numa.o obj-y += $(arm64-obj-y) vdso/ obj-m += $(arm64-obj-m)
arch/arm64/kernel/dt_numa.c new file +296 -0
296 lines not on this page · raw message
arch/arm64/kernel/setup.c +8 -0
@@ -425,6 +425,9 @@ static int __init topology_init(void) {int i; +for_each_online_node (i) +register_one_node (i); +for_each_possible_cpu (i) {struct cpu *cpu = &per_cpu (cpu_data.cpu, i); cpu->hotpluggable =1 ;
@@ -461,7 +464,12 @@ static int c_show(struct seq_file *m, void *v)* "processor". Give glibc what it expects. */ #ifdef CONFIG_SMP +if (IS_ENABLED (CONFIG_NUMA )) { +seq_printf (m,"processor\t: %d" , i); +seq_printf (m," [nid: %d]\n" ,cpu_to_node (i)); + }else {seq_printf (m,"processor\t: %d\n" , i); + }#endif }
arch/arm64/kernel/smp.c +2 -0
@@ -50,6 +50,7 @@#include <asm/sections.h> #include <asm/tlbflush.h> #include <asm/ptrace.h> +#include <asm/numa.h> #define CREATE_TRACE_POINTS #include <trace/events/ipi.h>
@@ -123,6 +124,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)static void smp_store_cpu_info (unsigned int cpuid) {store_cpu_topology (cpuid); +numa_store_cpu_info (cpuid); }/*
arch/arm64/mm/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-y := dma-mapping.o extable.o fault.o init.o \ ioremap.o mmap.o pgd.o mmu.o \ context.o proc.o pageattr.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o +obj-$(CONFIG_NUMA) += numa.o
arch/arm64/mm/init.c +28 -6
@@ -39,6 +39,7 @@#include <asm/setup.h> #include <asm/sizes.h> #include <asm/tlb.h> +#include <asm/numa.h> #include "mm.h"
@@ -73,6 +74,20 @@ static phys_addr_t max_zone_dma_phys(void)return min (offset + (1ULL <<32 ),memblock_end_of_DRAM ()); } +#ifdef CONFIG_NUMA +static void __init zone_sizes_init (unsigned long min,unsigned long max) +{ +unsigned long max_zone_pfns[MAX_NR_ZONES ]; + +memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); +if (IS_ENABLED (CONFIG_ZONE_DMA )) + max_zone_pfns[ZONE_DMA ] =PFN_DOWN (max_zone_dma_phys ()); + max_zone_pfns[ZONE_NORMAL ] = max; + +free_area_init_nodes (max_zone_pfns); +} + +#else static void __init zone_sizes_init (unsigned long min,unsigned long max) {struct memblock_region *reg;
@@ -111,6 +126,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) free_area_init_node(0, zone_size, min, zhole_size); } +#endif /* CONFIG_NUMA */ #ifdef CONFIG_HAVE_ARCH_PFN_VALID int pfn_valid (unsigned long pfn)
@@ -128,10 +144,15 @@ static void arm64_memory_present(void)static void arm64_memory_present (void ) {struct memblock_region *reg; +int nid =0 ; -for_each_memblock (memory, reg) -memory_present (0 ,memblock_region_memory_base_pfn (reg), -memblock_region_memory_end_pfn (reg)); +for_each_memblock (memory, reg) { +#ifdef CONFIG_NUMA + nid = reg->nid; +#endif +memory_present (nid,memblock_region_memory_base_pfn (reg), +memblock_region_memory_end_pfn (reg)); + } }#endif
@@ -167,6 +188,10 @@ void __init bootmem_init(void) min =PFN_UP (memblock_start_of_DRAM ()); max =PFN_DOWN (memblock_end_of_DRAM ()); + high_memory =__va ((max <<PAGE_SHIFT ) -1 ) +1 ; + max_pfn = max_low_pfn = max; + +arm64_numa_init ();/* * Sparsemem tries to allocate bootmem in memory_present(), so must be * done after the fixed reservations.
@@ -175,9 +200,6 @@ void __init bootmem_init(void)sparse_init ();zone_sizes_init (min, max); - - high_memory =__va ((max <<PAGE_SHIFT ) -1 ) +1 ; - max_pfn = max_low_pfn = max; }#ifndef CONFIG_SPARSEMEM_VMEMMAP
arch/arm64/mm/numa.c new file +520 -0
520 lines not on this page · raw message
Signature · 6 lines
1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1420011208-7051-5-git-send-email-ganapatrao.kulkarni-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org
Re: [RFC PATCH v3 4/4] arm64:numa: adding numa support for arm64 platforms.
Quoted 4 lines · On Wednesday 31 December 2014 13:03:28 Ganapatrao Kulkarni wrote:
Adding numa support for arm64 based platforms.
Adding dt node pasring for numa topology using property arm,associativity.
Maybe the parts that are common with powerpc can be moved to drivers/of/numa.c? We can always look for both arm,associativity and ibm,associativity, I don't think we should be worried about any conflicts that way.
Quoted 1 line
+#define
MAX_DISTANCE_REF_POINTS4
I think we should use 8 here like powerpc, four levels might get exceeded on complex SoCs.
Quoted 16 lines
arch/arm64/kernel/dt_numa.c new file +16
-0+int dt_get_cpu_node_id (int cpu) +{ +struct device_node *dn =NULL ; + +while ((dn =of_find_node_by_type (dn,"cpu" ))) { +const u32 *cell; +u64 hwid; + +/* +* A cpu node with missing "reg" property is +* considered invalid to build a cpu_logical_map +* entry. +*/ + cell =of_get_property (dn,"reg" ,NULL ); +if (!cell) { +pr_err ("%s: missing reg property\n" , dn->full_name);
arch/arm64/kernel/dt_numa.c line 201
Quoted 10 lines
arch/arm64/kernel/dt_numa.c new file +10
-0+return default_nid; + } + hwid =of_read_number (cell,of_n_addr_cells (dn)); + +if (cpu_logical_map (cpu) == hwid) +return of_node_to_nid_single (dn); + } +return NUMA_NO_NODE ; +} +EXPORT_SYMBOL (dt_get_cpu_node_id);
Maybe just expose a function to the device node for a CPU ID here, and expect callers to use of_node_to_nid?
arch/arm64/kernel/dt_numa.c line 245
Quoted 10 lines
arch/arm64/kernel/dt_numa.c new file +10
-0+ +/** +* early_init_dt_scan_numa_map - parse memory node and map nid to memory range. +*/ +int __init early_init_dt_scan_numa_map (unsigned long node,const char *uname, +int depth,void *data) +{ +const char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); + +/* We are scanning "numa-map" nodes only */
a stale comment?
Quoted 11 lines
arch/arm64/kernel/dt_numa.c new file +11
-0+/* DT node mapping is done already early_init_dt_scan_memory */ +int __init arm64_dt_numa_init (void ) +{ +int i; +u32 nodea, nodeb, distance, node_count =0 ; + +of_scan_flat_dt (early_init_dt_scan_numa_map,NULL ); + +for_each_node_mask (i, numa_nodes_parsed) + node_count = i; + node_count++;
arch/arm64/kernel/dt_numa.c line 296
Quoted 10 lines
arch/arm64/kernel/dt_numa.c new file +10
-0+ +for (nodea =0 ; nodea < node_count; nodea++) { +for (nodeb =0 ; nodeb < node_count; nodeb++) { + distance =dt_get_node_distance (nodea, nodeb); +numa_set_distance (nodea, nodeb, distance); + } + } +return 0 ; +} +EXPORT_SYMBOL (arm64_dt_numa_init);
No need to export functions that are called only be architecture code. Since this works on the flattened device tree format, you can never have loadable modules calling it.
arch/arm64/kernel/setup.c static int c_show(struct seq_file *m, void *v) · line 474
Quoted 12 lines
arch/arm64/kernel/setup.c +5
-0@@ -461,7 +464,12 @@ static int c_show(struct seq_file *m, void *v)* "processor". Give glibc what it expects. */ #ifdef CONFIG_SMP +if (IS_ENABLED (CONFIG_NUMA )) { +seq_printf (m,"processor\t: %d" , i); +seq_printf (m," [nid: %d]\n" ,cpu_to_node (i)); + }else {seq_printf (m,"processor\t: %d\n" , i); + }#endif }
Do we need to make this conditional? I think we can just always print the node number, even if it's going to be zero for systems without the associativity properties.
arch/arm64/mm/numa.c line 83
Quoted 3 lines
arch/arm64/mm/numa.c new file +3
-0+ +int cpu_to_node_map[NR_CPUS ]; +EXPORT_SYMBOL (cpu_to_node_map);
This seems to be x86 specific, do we need it?
arch/arm64/mm/numa.c line 120
Quoted 8 lines
arch/arm64/mm/numa.c new file +8
-0+/* +* Set the cpu to node and mem mapping +*/ +void numa_store_cpu_info (int cpu) +{ +#ifdef CONFIG_ARM64_DT_NUMA + node_cpu_hwid[cpu].node_id =dt_get_cpu_node_id (cpu); +#endif
I would try to avoid the #ifdef here, by providing a stub function of dt_get_cpu_node_id or whichever function we end up calling here when NUMA is disabled.
Quoted 9 lines
arch/arm64/mm/numa.c new file +9
-0+ +/** +* arm64_numa_init - Initialize NUMA +* +* Try each configured NUMA initialization method until one succeeds. The +* last fallback is dummy single node config encomapssing whole memory and +* never fails. +*/ +void __init arm64_numa_init (void )
arch/arm64/mm/numa.c line 520
Quoted 10 lines
arch/arm64/mm/numa.c new file +10
-0+{ +if (!numa_off) { +#ifdef CONFIG_ARM64_DT_NUMA +if (!numa_init (arm64_dt_numa_init)) +return ; +#endif + } + +numa_init (dummy_numa_init); +}
I don't think we need the CONFIG_ARM64_DT_NUMA=n case here, it should just not be conditional, and the arm64_dt_numa_init should fall back to doing something reasonable when numa is turned off or there are no associativity properties.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC PATCH v3 4/4 arm64:numa: adding numa support for arm64 platforms.
In reply to Ganapatrao Kulkarni[re-sent with correct mailing list address]
Quoted 4 lines · On Wednesday 31 December 2014 13:03:28 Ganapatrao Kulkarni wrote:
Adding numa support for arm64 based platforms.
Adding dt node pasring for numa topology using property arm,associativity.Signed-off-by Ganapatrao Kulkarni <[email protected]>
Maybe the parts that are common with powerpc can be moved to drivers/of/numa.c? We can always look for both arm,associativity and ibm,associativity, I don't think we should be worried about any conflicts that way.
Quoted 1 line
+#define
MAX_DISTANCE_REF_POINTS4
I think we should use 8 here like powerpc, four levels might get exceeded on complex SoCs.
Quoted 16 lines
arch/arm64/kernel/dt_numa.c new file +16
-0+int dt_get_cpu_node_id (int cpu) +{ +struct device_node *dn =NULL ; + +while ((dn =of_find_node_by_type (dn,"cpu" ))) { +const u32 *cell; +u64 hwid; + +/* +* A cpu node with missing "reg" property is +* considered invalid to build a cpu_logical_map +* entry. +*/ + cell =of_get_property (dn,"reg" ,NULL ); +if (!cell) { +pr_err ("%s: missing reg property\n" , dn->full_name);
arch/arm64/kernel/dt_numa.c line 201
Quoted 10 lines
arch/arm64/kernel/dt_numa.c new file +10
-0+return default_nid; + } + hwid =of_read_number (cell,of_n_addr_cells (dn)); + +if (cpu_logical_map (cpu) == hwid) +return of_node_to_nid_single (dn); + } +return NUMA_NO_NODE ; +} +EXPORT_SYMBOL (dt_get_cpu_node_id);
Maybe just expose a function to the device node for a CPU ID here, and expect callers to use of_node_to_nid?
arch/arm64/kernel/dt_numa.c line 245
Quoted 10 lines
arch/arm64/kernel/dt_numa.c new file +10
-0+ +/** +* early_init_dt_scan_numa_map - parse memory node and map nid to memory range. +*/ +int __init early_init_dt_scan_numa_map (unsigned long node,const char *uname, +int depth,void *data) +{ +const char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); + +/* We are scanning "numa-map" nodes only */
a stale comment?
Quoted 11 lines
arch/arm64/kernel/dt_numa.c new file +11
-0+/* DT node mapping is done already early_init_dt_scan_memory */ +int __init arm64_dt_numa_init (void ) +{ +int i; +u32 nodea, nodeb, distance, node_count =0 ; + +of_scan_flat_dt (early_init_dt_scan_numa_map,NULL ); + +for_each_node_mask (i, numa_nodes_parsed) + node_count = i; + node_count++;
arch/arm64/kernel/dt_numa.c line 296
Quoted 10 lines
arch/arm64/kernel/dt_numa.c new file +10
-0+ +for (nodea =0 ; nodea < node_count; nodea++) { +for (nodeb =0 ; nodeb < node_count; nodeb++) { + distance =dt_get_node_distance (nodea, nodeb); +numa_set_distance (nodea, nodeb, distance); + } + } +return 0 ; +} +EXPORT_SYMBOL (arm64_dt_numa_init);
No need to export functions that are called only be architecture code. Since this works on the flattened device tree format, you can never have loadable modules calling it.
arch/arm64/kernel/setup.c static int c_show(struct seq_file *m, void *v) · line 474
Quoted 12 lines
arch/arm64/kernel/setup.c +5
-0@@ -461,7 +464,12 @@ static int c_show(struct seq_file *m, void *v)* "processor". Give glibc what it expects. */ #ifdef CONFIG_SMP +if (IS_ENABLED (CONFIG_NUMA )) { +seq_printf (m,"processor\t: %d" , i); +seq_printf (m," [nid: %d]\n" ,cpu_to_node (i)); + }else {seq_printf (m,"processor\t: %d\n" , i); + }#endif }
Do we need to make this conditional? I think we can just always print the node number, even if it's going to be zero for systems without the associativity properties.
arch/arm64/mm/numa.c line 83
Quoted 3 lines
arch/arm64/mm/numa.c new file +3
-0+ +int cpu_to_node_map[NR_CPUS ]; +EXPORT_SYMBOL (cpu_to_node_map);
This seems to be x86 specific, do we need it?
arch/arm64/mm/numa.c line 120
Quoted 8 lines
arch/arm64/mm/numa.c new file +8
-0+/* +* Set the cpu to node and mem mapping +*/ +void numa_store_cpu_info (int cpu) +{ +#ifdef CONFIG_ARM64_DT_NUMA + node_cpu_hwid[cpu].node_id =dt_get_cpu_node_id (cpu); +#endif
I would try to avoid the #ifdef here, by providing a stub function of dt_get_cpu_node_id or whichever function we end up calling here when NUMA is disabled.
Quoted 9 lines
arch/arm64/mm/numa.c new file +9
-0+ +/** +* arm64_numa_init - Initialize NUMA +* +* Try each configured NUMA initialization method until one succeeds. The +* last fallback is dummy single node config encomapssing whole memory and +* never fails. +*/ +void __init arm64_numa_init (void )
arch/arm64/mm/numa.c line 520
Quoted 10 lines
arch/arm64/mm/numa.c new file +10
-0+{ +if (!numa_off) { +#ifdef CONFIG_ARM64_DT_NUMA +if (!numa_init (arm64_dt_numa_init)) +return ; +#endif + } + +numa_init (dummy_numa_init); +}
I don't think we need the CONFIG_ARM64_DT_NUMA=n case here, it should just not be conditional, and the arm64_dt_numa_init should fall back to doing something reasonable when numa is turned off or there are no associativity properties.
Arnd
RFC PATCH v3 4/4 arm64:numa: adding numa support for arm64 platforms.
Hi Arnd,
Quoted 11 lines · Arnd Bergmann
[re-sent with correct mailing list address]
Quoted 4 lines · On Wednesday 31 December 2014 13:03:28 Ganapatrao Kulkarni wrote:
Adding numa support for arm64 based platforms.
Adding dt node pasring for numa topology using property arm,associativity.Signed-off-by Ganapatrao Kulkarni <[email protected]>Maybe the parts that are common with powerpc can be moved to
drivers/of/numa.c? We can always look for both arm,associativity and ibm,associativity, I don't think we should be worried about any conflicts that way.
ok, i will move common functions from powerpc and arm64 to driver/of/numa.c
Quoted 5 lines
Quoted 2 lines
+#define
MAX_DISTANCE_REF_POINTS4I think we should use 8 here like powerpc, four levels might get exceeded on complex SoCs.
sure.
Quoted 22 lines
Quoted 22 lines
arch/arm64/kernel/dt_numa.c new file +21
-0+int dt_get_cpu_node_id (int cpu) +{ +struct device_node *dn =NULL ; + +while ((dn =of_find_node_by_type (dn,"cpu" ))) { +const u32 *cell; +u64 hwid; + +/* +* A cpu node with missing "reg" property is +* considered invalid to build a cpu_logical_map +* entry. +*/ + cell =of_get_property (dn,"reg" ,NULL ); +if (!cell) { +pr_err ("%s: missing reg property\n" , dn->full_name); +return default_nid; + } + hwid =of_read_number (cell,of_n_addr_cells (dn)); + +if (cpu_logical_map (cpu) == hwid)
Quoted 8 lines
arch/arm64/kernel/dt_numa.c line 201
Quoted 5 lines
arch/arm64/kernel/dt_numa.c new file +5
-0+return of_node_to_nid_single (dn); + } +return NUMA_NO_NODE ; +} +EXPORT_SYMBOL (dt_get_cpu_node_id);Maybe just expose a function to the device node for a CPU ID here, and expect callers to use
of_node_to_nid?
shall i make this wrapper function in dt_numa.c, which will use functions _of_node_to_nid and _of_cpu_to_node(cpu)
And, this function can be a weak function in numa.c which returns 0.
Quoted 13 lines
arch/arm64/kernel/dt_numa.c line 245
Quoted 11 lines
arch/arm64/kernel/dt_numa.c new file +10
-0+ +/** +* early_init_dt_scan_numa_map - parse memory node and map nid to memory range. +*/ +int __init early_init_dt_scan_numa_map (unsigned long node,const char *uname, +int depth,void *data) +{ +const char *type =of_get_flat_dt_prop (node,"device_type" ,NULL ); + +/* We are scanning "numa-map" nodes only */ a stale comment?
oops, will remove.
Quoted 18 lines
Quoted 18 lines
arch/arm64/kernel/dt_numa.c new file +17
-0+/* DT node mapping is done already early_init_dt_scan_memory */ +int __init arm64_dt_numa_init (void ) +{ +int i; +u32 nodea, nodeb, distance, node_count =0 ; + +of_scan_flat_dt (early_init_dt_scan_numa_map,NULL ); + +for_each_node_mask (i, numa_nodes_parsed) + node_count = i; + node_count++; + +for (nodea =0 ; nodea < node_count; nodea++) { +for (nodeb =0 ; nodeb < node_count; nodeb++) { + distance =dt_get_node_distance (nodea, nodeb); +numa_set_distance (nodea, nodeb, distance); + }
Quoted 8 lines
arch/arm64/kernel/dt_numa.c line 296
Quoted 4 lines
arch/arm64/kernel/dt_numa.c new file +4
-0+ } +return 0 ; +} +EXPORT_SYMBOL (arm64_dt_numa_init);No need to export functions that are called only be architecture code. Since this works on the flattened device tree format, you can never have loadable modules calling it.
yes, will do.
Quoted 17 lines
arch/arm64/kernel/setup.c static int c_show(struct seq_file *m, void *v) · line 474
Quoted 13 lines
arch/arm64/kernel/setup.c +5
-0@@ -461,7 +464,12 @@ static int c_show(struct seq_file *m, void *v)* "processor". Give glibc what it expects. */ #ifdef CONFIG_SMP +if (IS_ENABLED (CONFIG_NUMA )) { +seq_printf (m,"processor\t: %d" , i); +seq_printf (m," [nid: %d]\n" ,cpu_to_node (i)); + }else {seq_printf (m,"processor\t: %d\n" , i); + }#endif }Do we need to make this conditional? I think we can just always print the node number, even if it's going to be zero for systems without the associativity properties.
yes, we can.
Quoted 7 lines
arch/arm64/mm/numa.c line 83
Quoted 4 lines
arch/arm64/mm/numa.c new file +3
-0+ +int cpu_to_node_map[NR_CPUS ]; +EXPORT_SYMBOL (cpu_to_node_map);This seems to be x86 specific, do we need it?
Quoted 12 lines
arch/arm64/mm/numa.c line 120
Quoted 8 lines
arch/arm64/mm/numa.c new file +8
-0+/* +* Set the cpu to node and mem mapping +*/ +void numa_store_cpu_info (int cpu) +{ +#ifdef CONFIG_ARM64_DT_NUMA + node_cpu_hwid[cpu].node_id =dt_get_cpu_node_id (cpu); +#endif I would try to avoid the #ifdef here, by providing a stub function of
dt_get_cpu_node_idor whichever function we end up calling here when NUMA is disabled.
as commented above.
.>
Quoted 16 lines
Quoted 16 lines
arch/arm64/mm/numa.c new file +16
-0+ +/** +* arm64_numa_init - Initialize NUMA +* +* Try each configured NUMA initialization method until one succeeds. The +* last fallback is dummy single node config encomapssing whole memory and +* never fails. +*/ +void __init arm64_numa_init (void ) +{ +if (!numa_off) { +#ifdef CONFIG_ARM64_DT_NUMA +if (!numa_init (arm64_dt_numa_init)) +return ; +#endif + }
Quoted 8 lines
arch/arm64/mm/numa.c line 520
Quoted 3 lines
arch/arm64/mm/numa.c new file +3
-0+ +numa_init (dummy_numa_init); +}I don't think we need the
CONFIG_ARM64_DT_NUMA=ncase here, it should just not be conditional, and thearm64_dt_numa_initshould fall back to doing something reasonable when numa is turned off or there are no associativity properties.
i think we can remove ifdef, will do it.
Quoted 2 lines
Arnd
thanks
ganapat
RFC PATCH v3 4/4 arm64:numa: adding numa support for arm64 platforms.
Quoted 30 lines · On Tuesday 06 January 2015 14:55:53 Ganapatrao Kulkarni wrote:
Quoted 21 lines · Arnd Bergmann
Quoted 21 lines
arch/arm64/kernel/dt_numa.c new file +21
-0+int dt_get_cpu_node_id (int cpu) +{ +struct device_node *dn =NULL ; + +while ((dn =of_find_node_by_type (dn,"cpu" ))) { +const u32 *cell; +u64 hwid; + +/* +* A cpu node with missing "reg" property is +* considered invalid to build a cpu_logical_map +* entry. +*/ + cell =of_get_property (dn,"reg" ,NULL ); +if (!cell) { +pr_err ("%s: missing reg property\n" , dn->full_name); +return default_nid; + } + hwid =of_read_number (cell,of_n_addr_cells (dn)); + +if (cpu_logical_map (cpu) == hwid)Quoted 8 lines
arch/arm64/kernel/dt_numa.c line 201
Quoted 5 lines
arch/arm64/kernel/dt_numa.c new file +5
-0+return of_node_to_nid_single (dn); + } +return NUMA_NO_NODE ; +} +EXPORT_SYMBOL (dt_get_cpu_node_id);Maybe just expose a function to the device node for a CPU ID here, and expect callers to use
of_node_to_nid?
Quoted 2 lines
shall i make this wrapper function in
dt_numa.c, which will use functions_of_node_to_nidand_of_cpu_to_node(cpu)
Yes, I guess that would work.
Quoted 1 line
And, this function can be a weak function in
numa.cwhich returns 0.
No, please don't use weak functions. You can either use IS_ENABLED() tricks to remove function calls at compile-time, or in the header file provide an inline function as an alternative to the extern declaration, based on a configuration symbol.
Arnd
RFC PATCH v3 4/4 arm64:numa: adding numa support for arm64 platforms.
Quoted 34 lines · Arnd Bergmann
Quoted 30 lines · On Tuesday 06 January 2015 14:55:53 Ganapatrao Kulkarni wrote:
Quoted 21 lines · Arnd Bergmann
Quoted 21 lines
arch/arm64/kernel/dt_numa.c new file +21
-0+int dt_get_cpu_node_id (int cpu) +{ +struct device_node *dn =NULL ; + +while ((dn =of_find_node_by_type (dn,"cpu" ))) { +const u32 *cell; +u64 hwid; + +/* +* A cpu node with missing "reg" property is +* considered invalid to build a cpu_logical_map +* entry. +*/ + cell =of_get_property (dn,"reg" ,NULL ); +if (!cell) { +pr_err ("%s: missing reg property\n" , dn->full_name); +return default_nid; + } + hwid =of_read_number (cell,of_n_addr_cells (dn)); + +if (cpu_logical_map (cpu) == hwid)Quoted 8 lines
arch/arm64/kernel/dt_numa.c line 201
Quoted 5 lines
arch/arm64/kernel/dt_numa.c new file +5
-0+return of_node_to_nid_single (dn); + } +return NUMA_NO_NODE ; +} +EXPORT_SYMBOL (dt_get_cpu_node_id);Maybe just expose a function to the device node for a CPU ID here, and expect callers to use
of_node_to_nid?Quoted 2 lines
shall i make this wrapper function in
dt_numa.c, which will use functions_of_node_to_nidand_of_cpu_to_node(cpu)
Quoted 8 lines
Yes, I guess that would work.
Quoted 1 line
And, this function can be a weak function in
numa.cwhich returns 0.No, please don't use weak functions. You can either use
IS_ENABLED()tricks to remove function calls at compile-time, or in the header file provide an inline function as an alternative to the extern declaration, based on a configuration symbol.
ok
Quoted 2 lines
Arnd
thanks
ganaapat