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 C89A343E33; Wed, 10 Apr 2024 12:44:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5041D402C7; Wed, 10 Apr 2024 12:44:00 +0200 (CEST) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by mails.dpdk.org (Postfix) with ESMTP id 1EED8402C5 for ; Wed, 10 Apr 2024 12:43:59 +0200 (CEST) Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-56e346224bdso4625253a12.1 for ; Wed, 10 Apr 2024 03:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1712745838; x=1713350638; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=AHkC3I4sF2rmWKKhDWXZC2x4tu6Psq+E5KPf34fZ2YU=; b=HBF5uohJnkI8a6j09hMMOkM6XDn+aQM4eg0kKakLwtRkT3cQnjXGYLOVuPlUZUDQLJ zag7hPyzj9Py7TFl2Qfq0ZdKMGhghDw9QdtNsIoZ6ccGqnMs+Hy8ZlGCh5JY96AkHJAe YFHmvSmdqibNTSFY6nsGJpJ6qSbSgZV/QBnfsNS4hbWWGKuwxc7Ma/yicYR5Hy8VqwwO SCQlTlu49fxdLVU+qRmWfuecqN69bEKFBM0qjOrPDctxLOnFQljMFu33rkuLsd+6KpeR Z46/k/zhSErqFBsZqzPaJcgxZGtuFgDI9P59RkXOn2kpkGUv9dv6Bt8hzuUPxyOsDYjK cnrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712745838; x=1713350638; h=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=AHkC3I4sF2rmWKKhDWXZC2x4tu6Psq+E5KPf34fZ2YU=; b=Cq6gbJa3WS2WOvHJdyUM/U9/6cHKwv2WWajOwJbZS6Oy0WlXY46SXQRPSno7EbT3dy JCScHL7l9UBtuo8LaRRiWw3IvJ7W4VSUmg5veMJg+D+7CnHr1v1WsLc+HEtBaIaDqbqH qqgHM6SV+CVuDeYW+6YMtCejz3kFmbpobwEgejXDD9q7bJoCWoQa0QVTXkdoCxkh/JJg 6jGLIKpma3Fcrf9MPx7DuozG0uhEMuBfRzaclO9UcAs3EFY25fManLEbhTD/ijX4liEf DrTAVjNuVtBp/AxFxAy/L03yyZXYQ9Fr/cWbF8XE/wju4U6VbwMsrSi84NNk5wA60bPp hvtg== X-Forwarded-Encrypted: i=1; AJvYcCXe2ne86kQ7Ft/KzfC3IcWfDXRm3oN2JRRqET8VJLnjGHiguTt4jks6Wz8k1ygJqawNhSvMg+TQUuVUX+M= X-Gm-Message-State: AOJu0YwTjq01UCU9gRfHIKsd/YZCiLQY1eYa5IMLo6hq81jwh+N9SUI4 5pfzaN4KINyMS/xXPLrHXh9bO1AdbDDUS4yTyA4VcNNx+hmrHhG0dJF7KttzyidumOZy7Sl7tvl HFfMsmNJ30Sqx1z9zFaMEXTT73PQiAP/GC6tweQ== X-Google-Smtp-Source: AGHT+IHStU9mr3RJS6eiLk5AGm2aK5DdOb47vxZRfzVxWB2Or5wCM0UpWNg2FCaguNaHM7b4dGsEA8VvElHG/Gchm4c= X-Received: by 2002:a50:cd41:0:b0:56d:b687:5a57 with SMTP id d1-20020a50cd41000000b0056db6875a57mr1206494edj.20.1712745838532; Wed, 10 Apr 2024 03:43:58 -0700 (PDT) MIME-Version: 1.0 References: <20240404153106.19047-1-npratte@iol.unh.edu> <20240409172811.27866-1-npratte@iol.unh.edu> In-Reply-To: <20240409172811.27866-1-npratte@iol.unh.edu> From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Wed, 10 Apr 2024 12:43:47 +0200 Message-ID: Subject: Re: [PATCH v2] dts: Change hugepage runtime config to 2MB Exclusively To: Nicholas Pratte Cc: paul.szczepanek@arm.com, bruce.richardson@intel.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, thomas@monjalon.net, mb@smartsharesystems.com, wathsala.vithanage@arm.com, probb@iol.unh.edu, Honnappa.Nagarahalli@arm.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" 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 > 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: bool) -> None: > """Overrides :meth:`~.os_session.OSSession.setup_hugepages`.""" > self._logger.info("Getting Hugepage information.") > - hugepage_size = self._get_hugepage_size() > + if "hugepages-2048kB" not in self.send_command("ls /sys/kernel/mm/hugepages").stdout: I have one extra point on top of Morten's suggestions (which I like). Let's create a class variable where we store the hugepage size (2048) and use that across the code. > + raise ConfigurationError("2MB hugepages not supported by operating system") > hugepages_total = self._get_hugepages_total() > self._numa_nodes = self._get_numa_nodes() > > - if force_first_numa or hugepages_total != 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 = self.send_command("awk '/Hugepagesize/ {print $2}' /proc/meminfo").stdout > - return int(hugepage_size) > - > def _get_hugepages_total(self) -> int: > hugepages_total = self.send_command( > - "awk '/HugePages_Total/ { print $2 }' /proc/meminfo" > + "cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" > ).stdout > return int(hugepages_total) > > -- > 2.44.0 >