test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Liu, Yong" <yong.liu@intel.com>
To: dts <dts-bounces@dpdk.org>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "nd@arm.com" <nd@arm.com>
Subject: Re: [dts] [PATCH] framework/dut: setup hugepage for all available NUMA	nodes
Date: Mon, 27 Aug 2018 05:27:38 +0000	[thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E6312D154@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1535332589-8090-1-git-send-email-phil.yang@arm.com>

Hi Phil,
One comment is inline.

Thanks,
Marvin

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org]
> Sent: Monday, August 27, 2018 9:16 AM
> To: dts@dpdk.org
> Cc: nd@arm.com
> Subject: [dts] [PATCH] framework/dut: setup hugepage for all available NUMA
> nodes
> 
> On a NUMA machine, we need to setup hugepage for all NUMA nodes.
> 
> The default approach is by setting /sys/kernel/mm/hugepages, but it
> only works on a single-node system.
> 
> This fix needs numactl tool support on Linux.
> 
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> ---
>  framework/crb.py | 6 ++++--
>  framework/dut.py | 9 ++++++++-
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/framework/crb.py b/framework/crb.py
> index 5c555db..97bebfe 100644
> --- a/framework/crb.py
> +++ b/framework/crb.py
> @@ -204,8 +204,10 @@ class Crb(object):
>          if numa == -1:
>              self.send_expect('echo %d > /sys/kernel/mm/hugepages/hugepages-
> %skB/nr_hugepages' % (huge_pages, page_size), '# ', 5)
>          else:
> -            # sometimes we set hugepage on kernel cmdline, so we need clear
> default hugepage
> -            self.send_expect('echo 0 > /sys/kernel/mm/hugepages/hugepages-
> %skB/nr_hugepages' % (page_size), '# ', 5)
> +            # sometimes we set hugepage on kernel cmdline, so we clear all
> nodes' default hugepages at the first time.
> +            if numa == 0:
> +                self.send_expect('echo 0 >
> /sys/kernel/mm/hugepages/hugepages-%skB/nr_hugepages' % (page_size), '# ', 5)
> +
>              # some platform not support numa, example vm dut
>              try:
>                  self.send_expect('echo %d >
> /sys/devices/system/node/node%d/hugepages/hugepages-%skB/nr_hugepages' %
> (huge_pages, numa, page_size), '# ', 5)
> diff --git a/framework/dut.py b/framework/dut.py
> index 18f0b39..b358578 100644
> --- a/framework/dut.py
> +++ b/framework/dut.py
> @@ -305,6 +305,12 @@ class Dut(Crb):
>              return
>          hugepages_size = self.send_expect("awk '/Hugepagesize/ {print $2}'
> /proc/meminfo", "# ")
>          total_huge_pages = self.get_total_huge_pages()
> +        total_numa_nodes = self.send_expect("numactl -H | awk '/available/
> {print $2}'", "# ")

We may not expect that numactl is installed on the DUT. It will be more portable by checking sysfs like "ls /sys/devices/system/node | grep node* | wc -l".

> +        numa_service_num =
> self.get_def_rte_config('CONFIG_RTE_MAX_NUMA_NODES')
> +        if numa_service_num:
> +            numa = min(total_numa_nodes, numa_service_num)
> +        else:
> +            numa = total_numa_nodes
>          force_socket = False
> 
>          if int(hugepages_size) < (1024 * 1024):
> @@ -332,7 +338,8 @@ class Dut(Crb):
>                  if force_socket:
>                      self.set_huge_pages(arch_huge_pages, 0)
>                  else:
> -                    self.set_huge_pages(arch_huge_pages)
> +                    for numa_id in range(0, int(numa)):
> +                        self.set_huge_pages(arch_huge_pages, numa_id)
> 
>          self.mount_huge_pages()
>          self.hugepage_path = self.strip_hugepage_path()
> --
> 2.7.4

  reply	other threads:[~2018-08-27  5:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27  1:16 Phil Yang
2018-08-27  5:27 ` Liu, Yong [this message]
2018-08-28  2:00   ` Phil Yang
2018-08-28  2:57     ` Liu, Yong
2018-08-28  3:10       ` Phil Yang
2018-08-28  1:59 ` [dts] [PATCH v2] framework/dut: setup hugepage for all available numa nodes Phil Yang
2018-08-28  3:08   ` [dts] [PATCH v3] " Phil Yang
2018-09-03  8:32     ` Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86228AFD5BCD8E4EBFD2B90117B5E81E6312D154@SHSMSX103.ccr.corp.intel.com \
    --to=yong.liu@intel.com \
    --cc=dts-bounces@dpdk.org \
    --cc=dts@dpdk.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).