test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] update hugepage config
@ 2016-08-31  5:23 xu,huilong
  0 siblings, 0 replies; only message in thread
From: xu,huilong @ 2016-08-31  5:23 UTC (permalink / raw)
  To: dts; +Cc: xu,huilong

dts only config 2M hugepage for dut. if when user want to used
another size hugepage. user must set hugepage number in kernel cmdline.
but some times we should chang hugepage number in different target or case.

Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
 framework/crb.py |  8 +++++++-
 framework/dut.py | 43 +++++++++++++++++++++----------------------
 2 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index 066bb3f..c873ffc 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -163,7 +163,13 @@ class Crb(object):
         Set numbers of huge pages
         """
         page_size = self.send_expect("awk '/Hugepagesize/ {print $2}' /proc/meminfo", "# ")
-
+        # we set huge page number default used 2M size, 
+        # so should count huge number again with systerm huge page size
+        # 100 is a estimate value, 
+        # it means, if the huge_page num bigger 100, we think the user want used 2M hugepage
+        if (huge_pages > 100):
+            huge_pages = (((huge_pages * 1024 * 2 ) / int(page_size)) or 1)
+            
         if numa == -1:
             self.send_expect('echo %d > /sys/kernel/mm/hugepages/hugepages-%skB/nr_hugepages' % (huge_pages, page_size), '# ', 5)
         else:
diff --git a/framework/dut.py b/framework/dut.py
index 2f4e53a..8525873 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -292,28 +292,27 @@ class Dut(Crb):
         hugepages_size = self.send_expect("awk '/Hugepagesize/ {print $2}' /proc/meminfo", "# ")
         total_huge_pages = self.get_total_huge_pages()
         force_socket = False
-
-        if int(hugepages_size) < (1024 * 1024):
-            if self.architecture == "x86_64":
-                arch_huge_pages = hugepages if hugepages > 0 else 4096
-            elif self.architecture == "i686":
-                arch_huge_pages = hugepages if hugepages > 0 else 512
-                force_socket = True
-            # set huge pagesize for x86_x32 abi target
-            elif self.architecture == "x86_x32":
-                arch_huge_pages = hugepages if hugepages > 0 else 256
-                force_socket = True
-            elif self.architecture == "ppc_64":
-                arch_huge_pages = hugepages if hugepages > 0 else 512
-
-            if total_huge_pages != arch_huge_pages:
-                 # before all hugepage average distribution  by all socket,
-                 # but sometimes create mbuf pool on socket 0 failed when setup testpmd,
-                 # so set all huge page on socket 0
-                if force_socket:
-                    self.set_huge_pages(arch_huge_pages, 0)
-                else:
-                    self.set_huge_pages(arch_huge_pages)
+        # support set 1G hugepage by dts
+        if self.architecture == "x86_64":
+            arch_huge_pages = hugepages if hugepages > 0 else 4096
+        elif self.architecture == "i686":
+            arch_huge_pages = hugepages if hugepages > 0 else 512
+            force_socket = True
+        # set huge pagesize for x86_x32 abi target
+        elif self.architecture == "x86_x32":
+            arch_huge_pages = hugepages if hugepages > 0 else 256
+            force_socket = True
+        elif self.architecture == "ppc_64":
+            arch_huge_pages = hugepages if hugepages > 0 else 512
+
+        if total_huge_pages != arch_huge_pages:
+             # before all hugepage average distribution  by all socket,
+             # but sometimes create mbuf pool on socket 0 failed when setup testpmd,
+             # so set all huge page on socket 0
+            if force_socket:
+                self.set_huge_pages(arch_huge_pages, 0)
+            else:
+                self.set_huge_pages(arch_huge_pages)
 
         self.mount_huge_pages()
         self.hugepage_path = self.strip_hugepage_path()
-- 
1.9.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-31  5:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31  5:23 [dts] [PATCH V1] update hugepage config xu,huilong

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