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 7B98D43E06; Fri, 5 Apr 2024 16:28:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 195AB402CE; Fri, 5 Apr 2024 16:28:09 +0200 (CEST) Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) by mails.dpdk.org (Postfix) with ESMTP id 2E30D4028B for ; Fri, 5 Apr 2024 16:28:08 +0200 (CEST) Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5a4f9f94e77so1222436eaf.3 for ; Fri, 05 Apr 2024 07:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1712327287; x=1712932087; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ebQPs5MOlJ5VtbUxWoit1ezN+FUzMqtMe8dY8ZKoHho=; b=TJxnCm0scy6yducFE0q2uVJGBt3/pDrgyrEyk2/5ead0mC1e2c+PvnorkC8wnaPkL3 1/calCE5e9YDJ8Co0Ja27j1BJ3m0q7lC7GRZxm87a5rBx7qQNVSNQCDdr7fZMoOSaeF+ YOThyfY7QGJPiSgXVsNB2iXqMWarSbYckXWI8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712327287; x=1712932087; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ebQPs5MOlJ5VtbUxWoit1ezN+FUzMqtMe8dY8ZKoHho=; b=PDaMOh2X21SyaQONIYaFUJ7hnLs8wF+tkMA2EOxM4YsDZE+K1/gDrjkCCXPeAwKiWX jBKjnniiR8+o5EnCWUp9IqD5veyCld7Zi/BtDFS2pw/130CmA3ZGdBaim8R/7YAcoNWc CK+65BjBun46ekqW3GPlEPmfsH6jeR4Qfx0w6dDqPmOLTS9JCOHyKEKPBo43wc4b8qDD GCix5THQpkyIB3eWFBjuNVL1ZXN0MTMJFNzxAEAM/3Hn8nEARjlcfmmPAGPuML52PppL uT4b0T6ryh1MlnNKOmrJqeilpZfdIJ1Xl2m0o9yjo6TVfE/US8Kfv2o9jk+z8fDwM3bx T4lQ== X-Forwarded-Encrypted: i=1; AJvYcCXqaGTl70KowXGgp5WK1RqgX2F8WDOMj4NLZBxweWpBuROWFpoAiV0RkS+LHIyUsp4z2b+wF5oQA63ZgTs= X-Gm-Message-State: AOJu0YziC7Exaz3HV3WsfByy+JMAsDHHgeD6NGmpPwzbK5fU8IyI3Wib M5o7XQzYPSxE8f3smFAsKK0lTRj69iJh0JYqASIWajkBYOUWcfQQmkcotpY/xk3OVbBvMX2N+MU 86amdOpWZNuVAS34mnQEdzcEYrKIwoiGE4yM7KA== X-Google-Smtp-Source: AGHT+IGj+2YyLRSKCJ7kLlJVwH6xBSxl1nxp/ImW169KK+MbN14t6aksSAMuFtc3gcaTkUkkNj1pTVtlOz2wuAr9GTk= X-Received: by 2002:a05:6820:2715:b0:5a5:639a:2fa4 with SMTP id db21-20020a056820271500b005a5639a2fa4mr1860842oob.0.1712327287300; Fri, 05 Apr 2024 07:28:07 -0700 (PDT) MIME-Version: 1.0 References: <20240404153106.19047-1-npratte@iol.unh.edu> In-Reply-To: <20240404153106.19047-1-npratte@iol.unh.edu> From: Patrick Robb Date: Fri, 5 Apr 2024 10:27:56 -0400 Message-ID: Subject: Re: [PATCH] dts: Change hugepage runtime config to 2MB Exclusively To: Nicholas Pratte Cc: paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, yoan.picchi@foss.arm.com, thomas@monjalon.net, wathsala.vithanage@arm.com, Honnappa.Nagarahalli@arm.com, dev@dpdk.org, Jeremy Spewock Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Recheck-request: iol-intel-Functional checking for lab infra failure On Thu, Apr 4, 2024 at 11:31=E2=80=AFAM Nicholas Pratte wrote: > > The previous implementation configures and allocates hugepage sizes > based on a system default. This can lead to two problems: overallocation = of > hugepages (which may crash the remote host), and configuration of hugepag= e > sizes that are not recommended during runtime. This new implementation > allows only 2MB hugepage allocation during runtime; any other unique > hugepage size must be configured by the end-user for initializing DTS. > > If the amount of 2MB hugepages requested exceeds the amount of 2MB > hugepages already configured on the system, then the system will remount > hugepages to cover the difference. If the amount of hugepages requested i= s > either less than or equal to the amount already configured on the system, > then nothing is done. > > Bugzilla ID: 1370 > Signed-off-by: Nicholas Pratte > Reviewed-by: Jeremy Spewock > --- > dts/conf.yaml | 8 ++++---- > dts/framework/config/__init__.py | 4 ++-- > dts/framework/config/conf_yaml_schema.json | 6 +++--- > dts/framework/config/types.py | 2 +- > dts/framework/testbed_model/linux_session.py | 21 +++++++++----------- > 5 files changed, 19 insertions(+), 22 deletions(-) > > diff --git a/dts/conf.yaml b/dts/conf.yaml > index 8068345dd5..3690e77ee5 100644 > --- a/dts/conf.yaml > +++ b/dts/conf.yaml > @@ -35,8 +35,8 @@ nodes: > lcores: "" # use all the available logical cores > use_first_core: false # tells DPDK to use any physical core > memory_channels: 4 # tells DPDK to use 4 memory channels > - hugepages: # optional; if removed, will use system hugepage configu= ration > - amount: 256 > + hugepages_2mb: # optional; if removed, will use system hugepage conf= iguration > + amount: 2560 > force_first_numa: false > ports: > # sets up the physical link between "SUT 1"@000:00:08.0 and "TG 1"= @0000:00:08.0 > @@ -71,8 +71,8 @@ nodes: > os_driver: rdma > peer_node: "SUT 1" > peer_pci: "0000:00:08.1" > - hugepages: # optional; if removed, will use system hugepage configu= ration > - amount: 256 > + hugepages_2mb: # optional; if removed, will use system hugepage conf= iguration > + amount: 2560 > force_first_numa: false > traffic_generator: > type: SCAPY > diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__in= it__.py > index 4cb5c74059..b6f820e39e 100644 > --- a/dts/framework/config/__init__.py > +++ b/dts/framework/config/__init__.py > @@ -255,8 +255,8 @@ def from_dict( > Either an SUT or TG configuration instance. > """ > hugepage_config =3D None > - if "hugepages" in d: > - hugepage_config_dict =3D d["hugepages"] > + if "hugepages_2mb" in d: > + hugepage_config_dict =3D d["hugepages_2mb"] > if "force_first_numa" not in hugepage_config_dict: > hugepage_config_dict["force_first_numa"] =3D False > hugepage_config =3D HugepageConfiguration(**hugepage_config_= dict) > diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/c= onfig/conf_yaml_schema.json > index 4731f4511d..f4d7199523 100644 > --- a/dts/framework/config/conf_yaml_schema.json > +++ b/dts/framework/config/conf_yaml_schema.json > @@ -146,7 +146,7 @@ > "compiler" > ] > }, > - "hugepages": { > + "hugepages_2mb": { > "type": "object", > "description": "Optional hugepage configuration. If not specified,= hugepages won't be configured and DTS will use system configuration.", > "properties": { > @@ -253,8 +253,8 @@ > "type": "integer", > "description": "How many memory channels to use. Optional, d= efaults to 1." > }, > - "hugepages": { > - "$ref": "#/definitions/hugepages" > + "hugepages_2mb": { > + "$ref": "#/definitions/hugepages_2mb" > }, > "ports": { > "type": "array", > diff --git a/dts/framework/config/types.py b/dts/framework/config/types.p= y > index 1927910d88..016e0c3dbd 100644 > --- a/dts/framework/config/types.py > +++ b/dts/framework/config/types.py > @@ -46,7 +46,7 @@ class NodeConfigDict(TypedDict): > """Allowed keys and values.""" > > #: > - hugepages: HugepageConfigurationDict > + hugepages_2mb: HugepageConfigurationDict > #: > name: str > #: > diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework= /testbed_model/linux_session.py > index 5d24030c3d..ad3c811301 100644 > --- a/dts/framework/testbed_model/linux_session.py > +++ b/dts/framework/testbed_model/linux_session.py > @@ -15,7 +15,7 @@ > > from typing_extensions import NotRequired > > -from framework.exception import RemoteCommandExecutionError > +from framework.exception import ConfigurationError, RemoteCommandExecuti= onError > from framework.utils import expand_range > > from .cpu import LogicalCore > @@ -87,25 +87,22 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> s= tr: > def setup_hugepages(self, hugepage_count: int, force_first_numa: boo= l) -> None: > """Overrides :meth:`~.os_session.OSSession.setup_hugepages`.""" > self._logger.info("Getting Hugepage information.") > - hugepage_size =3D self._get_hugepage_size() > + if "hugepages-2048kB" not in self.send_command("ls /sys/kernel/m= m/hugepages").stdout: > + raise ConfigurationError("2MB hugepages not supported by ope= rating system") > hugepages_total =3D self._get_hugepages_total() > self._numa_nodes =3D self._get_numa_nodes() > > - if force_first_numa or hugepages_total !=3D hugepage_count: > + if force_first_numa or hugepages_total < hugepage_count: > # when forcing numa, we need to clear existing hugepages reg= ardless > # of size, so they can be moved to the first numa node > - self._configure_huge_pages(hugepage_count, hugepage_size, fo= rce_first_numa) > + self._configure_huge_pages(hugepage_count, force_first_numa) > else: > self._logger.info("Hugepages already configured.") > self._mount_huge_pages() > > - def _get_hugepage_size(self) -> int: > - hugepage_size =3D self.send_command("awk '/Hugepagesize/ {print = $2}' /proc/meminfo").stdout > - return int(hugepage_size) > - > def _get_hugepages_total(self) -> int: > hugepages_total =3D self.send_command( > - "awk '/HugePages_Total/ { print $2 }' /proc/meminfo" > + "cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" > ).stdout > return int(hugepages_total) > > @@ -136,15 +133,15 @@ def _supports_numa(self) -> bool: > # there's no reason to do any numa specific configuration) > return len(self._numa_nodes) > 1 > > - def _configure_huge_pages(self, amount: int, size: int, force_first_= numa: bool) -> None: > + def _configure_huge_pages(self, amount: int, force_first_numa: bool)= -> None: > self._logger.info("Configuring Hugepages.") > - hugepage_config_path =3D f"/sys/kernel/mm/hugepages/hugepages-{s= ize}kB/nr_hugepages" > + hugepage_config_path =3D "/sys/kernel/mm/hugepages/hugepages-204= 8kB/nr_hugepages" > if force_first_numa and self._supports_numa(): > # clear non-numa hugepages > self.send_command(f"echo 0 | tee {hugepage_config_path}", pr= ivileged=3DTrue) > hugepage_config_path =3D ( > f"/sys/devices/system/node/node{self._numa_nodes[0]}/hug= epages" > - f"/hugepages-{size}kB/nr_hugepages" > + f"/hugepages-2048kB/nr_hugepages" > ) > > self.send_command(f"echo {amount} | tee {hugepage_config_path}",= privileged=3DTrue) > -- > 2.44.0 >