[dpdk-dev] eal: disable NUMA related warnings on non-NUMA systems

Message ID 1499941699-19478-1-git-send-email-hemant.agrawal@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Hemant Agrawal July 13, 2017, 10:28 a.m. UTC
  Disabling NUMA warnings on non-NUMA systems.

"EAL: eal_parse_sysfs_value(): cannot open sysfs value
	/sys/bus/pci/devices/0000:00:00.0/numa_node
EAL: numa_node is invalid or not present. Set it 0 as default
EAL: cannot open /proc/self/numa_maps, consider that all memory is
	in socket_id 0"

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 8 ++++----
 lib/librte_eal/linuxapp/eal/eal_pci.c    | 4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)
  

Comments

Thomas Monjalon July 21, 2017, 6:01 a.m. UTC | #1
13/07/2017 13:28, Hemant Agrawal:
> Disabling NUMA warnings on non-NUMA systems.
> 
> "EAL: eal_parse_sysfs_value(): cannot open sysfs value
> 	/sys/bus/pci/devices/0000:00:00.0/numa_node
> EAL: numa_node is invalid or not present. Set it 0 as default
> EAL: cannot open /proc/self/numa_maps, consider that all memory is
> 	in socket_id 0"
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

If I understand well, you are disabling every warnings when DPDK
is compiled without libnuma.
I think we should keep one warning in case libnuma is not available
but it is running on a NUMA system.

What about adding this kind of sysfs check?

#ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES
if (sysfs/numa_node is present)
	RTE_LOG(WARN, "Only the first NUMA node will be used\n");
#endif
  
Hemant Agrawal July 21, 2017, 12:14 p.m. UTC | #2
On 7/21/2017 11:31 AM, Thomas Monjalon wrote:
> 13/07/2017 13:28, Hemant Agrawal:
>> Disabling NUMA warnings on non-NUMA systems.
>>
>> "EAL: eal_parse_sysfs_value(): cannot open sysfs value
>> 	/sys/bus/pci/devices/0000:00:00.0/numa_node
>> EAL: numa_node is invalid or not present. Set it 0 as default
>> EAL: cannot open /proc/self/numa_maps, consider that all memory is
>> 	in socket_id 0"
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>
> If I understand well, you are disabling every warnings when DPDK
> is compiled without libnuma.
> I think we should keep one warning in case libnuma is not available
> but it is running on a NUMA system.
>
> What about adding this kind of sysfs check?
>
> #ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES
> if (sysfs/numa_node is present)
> 	RTE_LOG(WARN, "Only the first NUMA node will be used\n");
> #endif
>
Good suggestion. I will rework the patch.
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 040f24a..44e7e4e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -595,6 +595,7 @@  unmap_all_hugepages_orig(struct hugepage_file *hugepg_tbl, struct hugepage_info
         return 0;
 }
 
+#ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
 /*
  * Parse /proc/self/numa_maps to get the NUMA socket ID for each huge
  * page.
@@ -662,11 +663,9 @@  find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
 			if (hugepg_tbl[i].orig_va == va) {
 				hugepg_tbl[i].socket_id = socket_id;
 				hp_count++;
-#ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
 				RTE_LOG(DEBUG, EAL,
 					"Hugepage %s is on socket %d\n",
 					hugepg_tbl[i].filepath, socket_id);
-#endif
 			}
 		}
 	}
@@ -681,6 +680,7 @@  find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
 	fclose(f);
 	return -1;
 }
+#endif
 
 static int
 cmp_physaddr(const void *a, const void *b)
@@ -1160,13 +1160,13 @@  rte_eal_hugepage_init(void)
 				goto fail;
 			}
 		}
-
+#ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
 		if (find_numasocket(&tmp_hp[hp_offset], hpi) < 0){
 			RTE_LOG(DEBUG, EAL, "Failed to find NUMA socket for %u MB pages\n",
 					(unsigned)(hpi->hugepage_sz / 0x100000));
 			goto fail;
 		}
-
+#endif
 		qsort(&tmp_hp[hp_offset], hpi->num_pages[0],
 		      sizeof(struct hugepage_file), cmp_physaddr);
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 7d9e1a9..688b052 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -310,6 +310,7 @@  pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 			dev->max_vfs = (uint16_t)tmp;
 	}
 
+#ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
 	/* get numa node, default to 0 if not present */
 	snprintf(filename, sizeof(filename), "%s/numa_node",
 		 dirname);
@@ -323,6 +324,9 @@  pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 			"Set it 0 as default\n");
 		dev->device.numa_node = 0;
 	}
+#else
+	dev->device.numa_node = 0;
+#endif
 
 	rte_pci_device_name(addr, dev->name, sizeof(dev->name));
 	dev->device.name = dev->name;