From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 761F51DB1 for ; Wed, 31 Aug 2016 07:28:29 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 30 Aug 2016 22:28:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,260,1470726000"; d="scan'208";a="1049506705" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.239.254.239]) by fmsmga002.fm.intel.com with ESMTP; 30 Aug 2016 22:28:27 -0700 From: "xu,huilong" To: dts@dpdk.org Cc: "xu,huilong" Date: Wed, 31 Aug 2016 13:23:54 +0800 Message-Id: <1472621034-10935-1-git-send-email-huilongx.xu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V1] update hugepage config X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 05:28:30 -0000 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 --- 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