DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] dts: fix hugepage configuration bug
@ 2025-01-14 20:00 Nicholas Pratte
  2025-01-15 10:10 ` Luca Vizzarro
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Pratte @ 2025-01-14 20:00 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, luca.vizzarro, probb, yoan.picchi,
	thomas.wilks, paul.szczepanek, dmarx
  Cc: dev, Nicholas Pratte

The dts framework checks for total hugepages of a specific size on a
system without first checking if such hugepages are supported. This
results in unhelpful error messages, since attempting to grab
information from a file/directory that does not exist creates undefined
behavior. This quick reorientation of the code prevents this, and
allows for easier error assessment.

Signed-off-by: Nicholas Pratte <npratte@iol.unh.edu>
---
 dts/framework/testbed_model/linux_session.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index bda2d448f7..e3732f0827 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -90,12 +90,12 @@ def setup_hugepages(self, number_of: int, hugepage_size: int, force_first_numa:
             ConfigurationError: If the given `hugepage_size` is not supported by the OS.
         """
         self._logger.info("Getting Hugepage information.")
-        hugepages_total = self._get_hugepages_total(hugepage_size)
         if (
             f"hugepages-{hugepage_size}kB"
             not in self.send_command("ls /sys/kernel/mm/hugepages").stdout
         ):
             raise ConfigurationError("hugepage size not supported by operating system")
+        hugepages_total = self._get_hugepages_total(hugepage_size)
         self._numa_nodes = self._get_numa_nodes()
 
         if force_first_numa or hugepages_total < number_of:
-- 
2.47.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-15 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-14 20:00 [PATCH] dts: fix hugepage configuration bug Nicholas Pratte
2025-01-15 10:10 ` Luca Vizzarro

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).