* [PATCH v1] buildtools: ensure the NUMA nodes are counted correct
@ 2022-08-02 7:54 Chaoyong He
2022-08-29 10:41 ` Thomas Monjalon
2022-09-22 8:06 ` [PATCH v2] " Niklas Söderlund
0 siblings, 2 replies; 6+ messages in thread
From: Chaoyong He @ 2022-08-02 7:54 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, niklas.soderlund, Peng Zhang, stable, Chaoyong He
From: Peng Zhang <peng.zhang@corigine.com>
Sorting a list of strings with the format "node[0-9]+" in order to find the
largest integer by looking at the last item after the sort breaks. But if
there are more then 10 items as a string sort will sort "node10" before
"node2", it will get the error NUMA nodes.
Solve this by sorting the list based on the integer part of the string.
Fixes: 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Cc: stable@dpdk.org
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
buildtools/get-numa-count.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/buildtools/get-numa-count.py b/buildtools/get-numa-count.py
index 1b7787787f..2f243886cd 100644
--- a/buildtools/get-numa-count.py
+++ b/buildtools/get-numa-count.py
@@ -6,11 +6,12 @@
import glob
import os
import subprocess
+import re
if os.name == 'posix':
if os.path.isdir('/sys/devices/system/node'):
numa_nodes = glob.glob('/sys/devices/system/node/node*')
- numa_nodes.sort()
+ numa_nodes.sort(key=lambda l: int(re.findall('\d+', l)[0]))
print(int(os.path.basename(numa_nodes[-1])[4:]) + 1)
else:
subprocess.run(['sysctl', '-n', 'vm.ndomains'], check=False)
--
2.27.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] buildtools: ensure the NUMA nodes are counted correct
2022-08-02 7:54 [PATCH v1] buildtools: ensure the NUMA nodes are counted correct Chaoyong He
@ 2022-08-29 10:41 ` Thomas Monjalon
[not found] ` <MWHPR1301MB1997EA5A5CF4A320A13493E4EF769@MWHPR1301MB1997.namprd13.prod.outlook.com>
2022-09-22 8:06 ` [PATCH v2] " Niklas Söderlund
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2022-08-29 10:41 UTC (permalink / raw)
To: Chaoyong He; +Cc: dev, oss-drivers, niklas.soderlund, Peng Zhang, stable
02/08/2022 09:54, Chaoyong He:
> From: Peng Zhang <peng.zhang@corigine.com>
>
> Sorting a list of strings with the format "node[0-9]+" in order to find the
> largest integer by looking at the last item after the sort breaks. But if
> there are more then 10 items as a string sort will sort "node10" before
> "node2", it will get the error NUMA nodes.
What is the error you are seeing?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] buildtools: ensure the NUMA nodes are counted correct
2022-08-02 7:54 [PATCH v1] buildtools: ensure the NUMA nodes are counted correct Chaoyong He
2022-08-29 10:41 ` Thomas Monjalon
@ 2022-09-22 8:06 ` Niklas Söderlund
2022-10-10 7:52 ` Niklas Söderlund
2022-10-10 23:11 ` Thomas Monjalon
1 sibling, 2 replies; 6+ messages in thread
From: Niklas Söderlund @ 2022-09-22 8:06 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Peng Zhang, stable, Niklas Söderlund
From: Peng Zhang <peng.zhang@corigine.com>
The method to fetch, sort and read the last entry of a list to figure
out the total number of NUMA nodes in the system fails with 10 or more
nodes. The reason being the usage of string compare while sorting, hence
node 'node10' will be sorted before 'node2'.
Solve this by sorting the list based on integer comparison of the
numerical part of the node name.
Before this change on a system with 16 NUMA nodes,
EAL: Detected CPU lcores: 128
EAL: Detected NUMA nodes: 10
EAL: Static memory layout is selected, amount of reserved memory can
be adjusted with -m or --socket-mem
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: VFIO support initialized
With this change on the same system,
EAL: Detected CPU lcores: 128
EAL: Detected NUMA nodes: 16
EAL: Static memory layout is selected, amount of reserved memory can
be adjusted with -m or --socket-mem
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: VFIO support initialized
Fixes: 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Cc: stable@dpdk.org
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
buildtools/get-numa-count.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/buildtools/get-numa-count.py b/buildtools/get-numa-count.py
index 1b7787787f71..2f243886cd21 100644
--- a/buildtools/get-numa-count.py
+++ b/buildtools/get-numa-count.py
@@ -6,11 +6,12 @@
import glob
import os
import subprocess
+import re
if os.name == 'posix':
if os.path.isdir('/sys/devices/system/node'):
numa_nodes = glob.glob('/sys/devices/system/node/node*')
- numa_nodes.sort()
+ numa_nodes.sort(key=lambda l: int(re.findall('\d+', l)[0]))
print(int(os.path.basename(numa_nodes[-1])[4:]) + 1)
else:
subprocess.run(['sysctl', '-n', 'vm.ndomains'], check=False)
--
2.37.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] buildtools: ensure the NUMA nodes are counted correct
2022-09-22 8:06 ` [PATCH v2] " Niklas Söderlund
@ 2022-10-10 7:52 ` Niklas Söderlund
2022-10-10 23:11 ` Thomas Monjalon
1 sibling, 0 replies; 6+ messages in thread
From: Niklas Söderlund @ 2022-10-10 7:52 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, Peng Zhang, stable
Hi,
Genteel ping on this.
On 2022-09-22 10:06:42 +0200, Niklas Söderlund wrote:
> From: Peng Zhang <peng.zhang@corigine.com>
>
> The method to fetch, sort and read the last entry of a list to figure
> out the total number of NUMA nodes in the system fails with 10 or more
> nodes. The reason being the usage of string compare while sorting, hence
> node 'node10' will be sorted before 'node2'.
>
> Solve this by sorting the list based on integer comparison of the
> numerical part of the node name.
>
> Before this change on a system with 16 NUMA nodes,
>
> EAL: Detected CPU lcores: 128
> EAL: Detected NUMA nodes: 10
> EAL: Static memory layout is selected, amount of reserved memory can
> be adjusted with -m or --socket-mem
> EAL: Detected static linkage of DPDK
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'VA'
> EAL: VFIO support initialized
>
> With this change on the same system,
>
> EAL: Detected CPU lcores: 128
> EAL: Detected NUMA nodes: 16
> EAL: Static memory layout is selected, amount of reserved memory can
> be adjusted with -m or --socket-mem
> EAL: Detected static linkage of DPDK
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'VA'
> EAL: VFIO support initialized
>
> Fixes: 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
> Cc: stable@dpdk.org
>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
> buildtools/get-numa-count.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/buildtools/get-numa-count.py b/buildtools/get-numa-count.py
> index 1b7787787f71..2f243886cd21 100644
> --- a/buildtools/get-numa-count.py
> +++ b/buildtools/get-numa-count.py
> @@ -6,11 +6,12 @@
> import glob
> import os
> import subprocess
> +import re
>
> if os.name == 'posix':
> if os.path.isdir('/sys/devices/system/node'):
> numa_nodes = glob.glob('/sys/devices/system/node/node*')
> - numa_nodes.sort()
> + numa_nodes.sort(key=lambda l: int(re.findall('\d+', l)[0]))
> print(int(os.path.basename(numa_nodes[-1])[4:]) + 1)
> else:
> subprocess.run(['sysctl', '-n', 'vm.ndomains'], check=False)
> --
> 2.37.3
>
--
Kind Regards,
Niklas Söderlund
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] buildtools: ensure the NUMA nodes are counted correct
2022-09-22 8:06 ` [PATCH v2] " Niklas Söderlund
2022-10-10 7:52 ` Niklas Söderlund
@ 2022-10-10 23:11 ` Thomas Monjalon
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2022-10-10 23:11 UTC (permalink / raw)
To: Peng Zhang; +Cc: dev, oss-drivers, Chaoyong He, stable, Niklas Söderlund
22/09/2022 10:06, Niklas Söderlund:
> From: Peng Zhang <peng.zhang@corigine.com>
>
> The method to fetch, sort and read the last entry of a list to figure
> out the total number of NUMA nodes in the system fails with 10 or more
> nodes. The reason being the usage of string compare while sorting, hence
> node 'node10' will be sorted before 'node2'.
>
> Solve this by sorting the list based on integer comparison of the
> numerical part of the node name.
>
> Before this change on a system with 16 NUMA nodes,
>
> EAL: Detected CPU lcores: 128
> EAL: Detected NUMA nodes: 10
> EAL: Static memory layout is selected, amount of reserved memory can
> be adjusted with -m or --socket-mem
> EAL: Detected static linkage of DPDK
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'VA'
> EAL: VFIO support initialized
>
> With this change on the same system,
>
> EAL: Detected CPU lcores: 128
> EAL: Detected NUMA nodes: 16
> EAL: Static memory layout is selected, amount of reserved memory can
> be adjusted with -m or --socket-mem
> EAL: Detected static linkage of DPDK
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'VA'
> EAL: VFIO support initialized
>
> Fixes: 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
> Cc: stable@dpdk.org
>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-10 23:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 7:54 [PATCH v1] buildtools: ensure the NUMA nodes are counted correct Chaoyong He
2022-08-29 10:41 ` Thomas Monjalon
[not found] ` <MWHPR1301MB1997EA5A5CF4A320A13493E4EF769@MWHPR1301MB1997.namprd13.prod.outlook.com>
[not found] ` <3155813.0WQXIW03uk@thomas>
2022-08-30 2:32 ` Nole Zhang
2022-09-22 8:06 ` [PATCH v2] " Niklas Söderlund
2022-10-10 7:52 ` Niklas Söderlund
2022-10-10 23:11 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).