From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD5D3A0C41; Thu, 30 Sep 2021 16:41:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 977AD410EA; Thu, 30 Sep 2021 16:41:48 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mails.dpdk.org (Postfix) with ESMTP id 6050D410E5 for ; Thu, 30 Sep 2021 16:41:47 +0200 (CEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18UDUB7a024683 for ; Thu, 30 Sep 2021 10:41:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=S+7W9Tc96Ffi/mU0g20aJ9iD0SPvLyZbvYzrJ2WzCSY=; b=KawuS1izL7tdFBQCkl/adaogBqcQaNceZtblqsWWycki1YjjpeLkZy6XiKBzCbRKF73/ omeEBJFNXQ1rGkQWFvcbJtcKpwcGEgwXNkkMnvZt81FlKbOJ82vQia7w4JI04llJk+UT HyQpQpVffGnqRlFGHDyB7F0BGXk8sczb+nYkcxn2eRCob4LyTDUeZ2Gwr6PXAjXfPx6l i/d2KNFf12A/qcLHDG8ONIHn1/opHM39/8Wc2oTIVTQ86Xk67VqUU2vR3QGNpgGpJ8OO lgIfqsAFZsjMu32/SoIYdrRZmPg53rk1Tg65gQ8iJxZ8lhvXYTK5+SYOpvNUQMD7MIVn 6g== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bde639vss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 Sep 2021 10:41:46 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18UEREY4005030 for ; Thu, 30 Sep 2021 14:41:45 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma03wdc.us.ibm.com with ESMTP id 3b9udc0rxk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 Sep 2021 14:41:45 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18UEfi0d42009008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Sep 2021 14:41:44 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8AA05AC060; Thu, 30 Sep 2021 14:41:44 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74708AC059; Thu, 30 Sep 2021 14:41:44 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.114.219.126]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 30 Sep 2021 14:41:44 +0000 (GMT) From: Thinh Tran To: dts@dpdk.org Cc: Thinh Tran Date: Thu, 30 Sep 2021 14:41:40 +0000 Message-Id: <20210930144140.673576-1-thinhtr@linux.vnet.ibm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: x5ZLZz27rf0oTp9yTIFhj3-1YIluTHGR X-Proofpoint-GUID: x5ZLZz27rf0oTp9yTIFhj3-1YIluTHGR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-30_04,2021-09-30_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 clxscore=1011 malwarescore=0 phishscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 priorityscore=1501 mlxscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2109300091 Subject: [dts] [DTS] [PATCH] Framwork: fix the first numa node may not be '0' X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" On certain Virtual Machine system such as Power Virtual Machine, PowerVM, assigns the CPUs of its virtual machines (or Logical Partitions LPARs) to NUMA nodes, and so the VM (or LPARs) 's CPUs may be on different ID other than '0'. This patch should fix that. Signed-off-by: Thinh Tran --- framework/crb.py | 13 ++++++------- framework/dut.py | 32 +++++++++++++++++++------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/framework/crb.py b/framework/crb.py index 40fe4fd1..9b0742ba 100644 --- a/framework/crb.py +++ b/framework/crb.py @@ -204,24 +204,23 @@ class Crb(object): else: return '' - def set_huge_pages(self, huge_pages, numa=-1): + def set_huge_pages(self, huge_pages, numa=""): """ Set numbers of huge pages """ page_size = self.send_expect("awk '/Hugepagesize/ {print $2}' /proc/meminfo", "# ") - if numa == -1: + if not numa: 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 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) + # sometimes we set hugepage on kernel cmdline, so we clear it + 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) + self.send_expect('echo %d > /sys/devices/system/node/%s/hugepages/hugepages-%skB/nr_hugepages' % (huge_pages, numa, page_size), '# ', 5) except: - self.logger.warning("set %d hugepage on socket %d error" % (huge_pages, numa)) + self.logger.warning("set %d hugepage on %s error" % (huge_pages, numa)) self.send_expect('echo %d > /sys/kernel/mm/hugepages/hugepages-%skB/nr_hugepages' % (huge_pages. page_size), '# ', 5) def set_speedup_options(self, read_cache, skip_setup): diff --git a/framework/dut.py b/framework/dut.py index f5481d06..1b85cb1c 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -547,16 +547,15 @@ 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("ls /sys/devices/system/node | grep node* | wc -l", "# ") - numa_service_num = self.get_def_rte_config('CONFIG_RTE_MAX_NUMA_NODES') - try: - int(total_numa_nodes) - except ValueError: + numa_nodes = self.send_expect("ls /sys/devices/system/node | grep node*", "# ") + if not numa_nodes: total_numa_nodes = -1 - if numa_service_num is not None: - numa = min(int(total_numa_nodes), int(numa_service_num)) else: - numa = total_numa_nodes + numa_nodes = numa_nodes.splitlines() + total_numa_nodes = len(numa_nodes) + self.logger.info(numa_nodes) + + force_socket = False if int(hugepages_size) < (1024 * 1024): @@ -580,14 +579,21 @@ class Dut(Crb): 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 + # so set all huge page on first socket if force_socket: - self.set_huge_pages(arch_huge_pages, 0) + self.set_huge_pages(arch_huge_pages, numa_nodes[0]) + self.logger.info("force_socket on %s" % numa_nodes[0]) else: - for numa_id in range(0, int(numa)): - self.set_huge_pages(arch_huge_pages, numa_id) - if numa == -1: + if total_numa_nodes == -1: self.set_huge_pages(arch_huge_pages) + else: + numa_service_num = self.get_def_rte_config('CONFIG_RTE_MAX_NUMA_NODES') + if numa_service_num is not None: + total_numa_nodes = min(total_numa_nodes, int(numa_service_num)) + + # set huge pages to configured total_numa_nodes + for numa_node in numa_nodes[:total_numa_nodes]: + self.set_huge_pages(arch_huge_pages, numa_node) self.mount_huge_pages() self.hugepage_path = self.strip_hugepage_path() -- 2.25.1