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 F263343E36; Wed, 10 Apr 2024 15:50:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7967440633; Wed, 10 Apr 2024 15:50:56 +0200 (CEST) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by mails.dpdk.org (Postfix) with ESMTP id 5A0C7402CF for ; Wed, 10 Apr 2024 15:50:55 +0200 (CEST) Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6ea25e724bdso909228a34.1 for ; Wed, 10 Apr 2024 06:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1712757054; x=1713361854; 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=ayPYiB6PPdqpb97L/p0igsV1+9OVrdeZl2OuTW62who=; b=Hd0xLMRRtJWbr7wtYxvaTrSGZtadgmtBRNpitxl2DX3K6hDVgHVzDBwbJzo5v8SVvX rXl1FiY0RO6sxhA+vxRjC0wwdO88DEt2PvG5Dg4XJuwEBcJGJ9JUqWQPLtArH7NWr17a ImrAoWDfG5FfgLvTQaAjT2NymdPS7T02AtOto= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712757054; x=1713361854; 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=ayPYiB6PPdqpb97L/p0igsV1+9OVrdeZl2OuTW62who=; b=XGpg09vNjfJGwYikcSyQKXlJtBglZu1CWTWHnAApPT6nRxWohHn3rLxrJUqzL8que0 d3rPR3lk5KhM3FzLd27CjXGXnVWJexVui335oV5IIKd7KcIf+sfQWI7zxo1o7MOt+DBl xjDe/8HG1VY/V7JjLIhIXmX3wTE7K/pQMn+9GUl4iekERUjTSmSmBsEinQ5mKHHLDxIZ rmUlL/NnSM4Ztn97AmybVrnhNcyB/+epOmbGqXob88PFq/4gpiN+N9USUaw+wMEdgV8f UDZWTV9QLI1aMsN2NQE6ddeqeoqzCKcRWaR3KHlr27u8ZqJVh/nMxm9byf7hxWXiCIT1 A3aw== X-Forwarded-Encrypted: i=1; AJvYcCUeDP13lUalL96pjsFtzVHNRjsRaJD5AOxZfyLQPiZ8PQff5cQ8h15uo1u15ykjSVVW/YSVnZuNcSbkspE= X-Gm-Message-State: AOJu0YwEs+29OMFhUi6Mxf+Y0pTWt/j9srOdnzqlB8vXw8PIWXJGRRDV sUkMoqByh8146ZmO2nAIZ3vW3GX5XfsCChMsU/Dv+Er5klXgg03AJ8h8o+LypuLuo8MWg4nPTtM 3ikaEC+qGh+AgtFRSOxjGhBNhaNGBJ4l2IXwoBw== X-Google-Smtp-Source: AGHT+IFzaTUc3fcdiu1f8624MRXEVFXtPUR3NSIR0lt9z+/Ks9krbMXOsRY1AIkd0fcMogf/y9u6k9t2hiMWtnSmnhE= X-Received: by 2002:a05:6870:63a3:b0:22e:cd9f:4e55 with SMTP id t35-20020a05687063a300b0022ecd9f4e55mr2949151oap.50.1712757054476; Wed, 10 Apr 2024 06:50:54 -0700 (PDT) MIME-Version: 1.0 References: <20240404153106.19047-1-npratte@iol.unh.edu> <20240409172811.27866-1-npratte@iol.unh.edu> <98CBD80474FA8B44BF855DF32C47DC35E9F382@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F382@smartserver.smartshare.dk> From: Patrick Robb Date: Wed, 10 Apr 2024 09:50:43 -0400 Message-ID: Subject: Re: [PATCH v2] dts: Change hugepage runtime config to 2MB Exclusively To: =?UTF-8?Q?Morten_Br=C3=B8rup?= Cc: Nicholas Pratte , dev@dpdk.org, paul.szczepanek@arm.com, bruce.richardson@intel.com, yoan.picchi@foss.arm.com, juraj.linkes@pantheon.tech, jspewock@iol.unh.edu, thomas@monjalon.net, wathsala.vithanage@arm.com, Honnappa.Nagarahalli@arm.com 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 On Wed, Apr 10, 2024 at 3:23=E2=80=AFAM Morten Br=C3=B8rup wrote: > > > From: Nicholas Pratte [mailto:npratte@iol.unh.edu] > > Sent: Tuesday, 9 April 2024 19.28 > > > > The previous implementation configures and allocates hugepage sizes > > based on a system default. This can lead to two problems: overallocatio= n of > > hugepages (which may crash the remote host), and configuration of hugep= age > > 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 remoun= t > > hugepages to cover the difference. If the amount of hugepages requested= is > > either less than or equal to the amount already configured on the syste= m, > > then nothing is done. > > > > Bugzilla ID: 1370 > > Signed-off-by: Nicholas Pratte > > Reviewed-by: Jeremy Spewock > > --- > > dts/conf.yaml | 4 ++-- > > 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 | 15 ++++++--------- > > 5 files changed, 14 insertions(+), 17 deletions(-) > > > > diff --git a/dts/conf.yaml b/dts/conf.yaml > > index 8068345dd5..56c3ae6f4c 100644 > > --- a/dts/conf.yaml > > +++ b/dts/conf.yaml > > @@ -35,7 +35,7 @@ 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 > > configuration > > + hugepages_2mb: # optional; if removed, will use system hugepage > > configuration > > amount: 256 > > force_first_numa: false > > ports: > > @@ -71,7 +71,7 @@ nodes: > > os_driver: rdma > > peer_node: "SUT 1" > > peer_pci: "0000:00:08.1" > > - hugepages: # optional; if removed, will use system hugepage > > configuration > > + hugepages_2mb: # optional; if removed, will use system hugepage > > configuration > > amount: 256 > > force_first_numa: false > > traffic_generator: > > diff --git a/dts/framework/config/__init__.py > > b/dts/framework/config/__init__.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_confi= g_dict) > > diff --git a/dts/framework/config/conf_yaml_schema.json > > b/dts/framework/config/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 specifie= d, > > 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, > > defaults 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= .py > > 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..37f5eacb21 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, > > RemoteCommandExecutionError > > from framework.utils import expand_range > > > > from .cpu import LogicalCore > > @@ -87,25 +87,22 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) ->= str: > > def setup_hugepages(self, hugepage_count: int, force_first_numa: b= ool) -> > > None: > > You should either rename this to setup_hugepages_2mb() or preferably add = a hugepage_size parameter. > > > """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/mm/hugepages").stdout: > > + raise ConfigurationError("2MB hugepages not supported by > > operating 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 > > regardless > > # of size, so they can be moved to the first numa node > > - self._configure_huge_pages(hugepage_count, hugepage_size, > > force_first_numa) > > + self._configure_huge_pages(hugepage_count, 2048, > > 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/ {prin= t $2}' > > /proc/meminfo").stdout > > - return int(hugepage_size) > > - > > Removing _get_hugepage_size() is OK; alternatively rename it to _get_huge= page_default_size(). Agree with Morten's ideas and am okay with keeping the function if Nick likes, but want to note to Nick that _get_hugepage_size will have a different process even if we move from assuming 2mb in all cases (as Morten suggested we may have to do in the far future). In that case, we are going to make a decision based on arch, not on the current info from /proc/meminfo. One of the important ideas behind this change is that user cannot configure the hugepage size on the system that DTS will use, outside of DTS.