If not supplied by the user --socket-mem and --socket-limit EAL options
are set to a default value based system topology. The assumption that
numa nodes must be numbered consecutive is removed by this change.

These options can be seen in the ovs-vswitchd.log.  For example:
a system containing only numa nodes 0 and 8 will generate the following:

EAL ARGS: ovs-vswitchd --socket-mem 1024,0,0,0,0,0,0,0,1024 \
                         --socket-limit 1024,0,0,0,0,0,0,0,1024 -l 0

Changes for v2:
0-day Robot suggested changes.

Signed-off-by: David Wilder <dwil...@us.ibm.com>
---
 lib/dpdk.c     | 26 ++++++++++++++++++--------
 lib/ovs-numa.c |  1 -
 lib/ovs-numa.h |  2 ++
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/lib/dpdk.c b/lib/dpdk.c
index 37ea2973c..5af6bb49b 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -134,18 +134,28 @@ static char *
 construct_dpdk_socket_mem(void)
 {
     const char *def_value = "1024";
-    int numa, numa_nodes = ovs_numa_get_n_numas();
+    struct ovs_numa_dump *dump;
+    int last_node = 0;
+
+    /* Build a list of all numa nodes with at least one core */
+    dump = ovs_numa_dump_n_cores_per_numa(1);
     struct ds dpdk_socket_mem = DS_EMPTY_INITIALIZER;
+    ds_put_cstr(&dpdk_socket_mem, def_value);
 
-    if (numa_nodes == 0 || numa_nodes == OVS_NUMA_UNSPEC) {
-        numa_nodes = 1;
-    }
+    const struct ovs_numa_info_numa *node;
 
-    ds_put_cstr(&dpdk_socket_mem, def_value);
-    for (numa = 1; numa < numa_nodes; ++numa) {
-        ds_put_format(&dpdk_socket_mem, ",%s", def_value);
+    FOR_EACH_NUMA_ON_DUMP(node, dump) {
+        while (node->numa_id > last_node+1 &&
+               node->numa_id != OVS_NUMA_UNSPEC &&
+               node->numa_id <= MAX_NUMA_NODES){
+                ds_put_format(&dpdk_socket_mem, ",%s", "0");
+                ++last_node;
+        }
+        if (node->numa_id != 0) {
+                ds_put_format(&dpdk_socket_mem, ",%s", def_value);
+        }
     }
-
+    ovs_numa_dump_destroy(dump);
     return ds_cstr(&dpdk_socket_mem);
 }
 
diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c
index 5153ed27e..8a76e6b5e 100644
--- a/lib/ovs-numa.c
+++ b/lib/ovs-numa.c
@@ -58,7 +58,6 @@ VLOG_DEFINE_THIS_MODULE(ovs_numa);
  * TODO: Fix ovs-numa when cpu hotplug is used.
  */
 
-#define MAX_NUMA_NODES 128
 
 /* numa node. */
 struct numa_node {
diff --git a/lib/ovs-numa.h b/lib/ovs-numa.h
index 8f2ea3430..ecc251a7f 100644
--- a/lib/ovs-numa.h
+++ b/lib/ovs-numa.h
@@ -26,6 +26,8 @@
 #define OVS_CORE_UNSPEC INT_MAX
 #define OVS_NUMA_UNSPEC INT_MAX
 
+#define MAX_NUMA_NODES 128
+
 /* Dump of a list of 'struct ovs_numa_info'. */
 struct ovs_numa_dump {
     struct hmap cores;
-- 
2.23.0.162.gf1d4a28

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to