get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/139495/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 139495,
    "url": "http://patches.dpdk.org/api/patches/139495/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240418161026.2839-1-npratte@iol.unh.edu/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240418161026.2839-1-npratte@iol.unh.edu>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240418161026.2839-1-npratte@iol.unh.edu",
    "date": "2024-04-18T16:10:26",
    "name": "[v4] dts: Change hugepage runtime config to 2MB Exclusively",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e1134d7c868039c0bc0b46b79564c09272c46678",
    "submitter": {
        "id": 3281,
        "url": "http://patches.dpdk.org/api/people/3281/?format=api",
        "name": "Nicholas Pratte",
        "email": "npratte@iol.unh.edu"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240418161026.2839-1-npratte@iol.unh.edu/mbox/",
    "series": [
        {
            "id": 31783,
            "url": "http://patches.dpdk.org/api/series/31783/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31783",
            "date": "2024-04-18T16:10:26",
            "name": "[v4] dts: Change hugepage runtime config to 2MB Exclusively",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/31783/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139495/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/139495/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B3D0A43EA6;\n\tThu, 18 Apr 2024 18:10:42 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5150340272;\n\tThu, 18 Apr 2024 18:10:42 +0200 (CEST)",
            "from mail-qt1-f180.google.com (mail-qt1-f180.google.com\n [209.85.160.180])\n by mails.dpdk.org (Postfix) with ESMTP id 016B640042\n for <dev@dpdk.org>; Thu, 18 Apr 2024 18:10:40 +0200 (CEST)",
            "by mail-qt1-f180.google.com with SMTP id\n d75a77b69052e-437618fb928so2253261cf.3\n for <dev@dpdk.org>; Thu, 18 Apr 2024 09:10:40 -0700 (PDT)",
            "from d121028.iol.unh.edu ([2606:4100:3880:1210:6b7c:4d95:9fb1:d9d6])\n by smtp.gmail.com with ESMTPSA id\n d17-20020a0cf0d1000000b006a04769b5a7sm742095qvl.110.2024.04.18.09.10.38\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 18 Apr 2024 09:10:39 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=iol.unh.edu; s=unh-iol; t=1713456640; x=1714061440; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=iC30U2UqvOdA3kOrUO5oFXqG0aLRGTr0R4UWFMtGm3Q=;\n b=RkFMvFfb7RaMbCujV/isWCn6Q1J3hXbw5vxbysjwxkpGg1N5idRbmlrz9vI0AZdHI1\n YMKxeUJ/gG984DrdglIS8sCC1T0DIuWbZJoyCTgghlS39HeN2MGn5Neas2PH9LG1/LUB\n O6+p8jkfh9s3fETcg/oth9AaqUCII21T1/HJo=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1713456640; x=1714061440;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=iC30U2UqvOdA3kOrUO5oFXqG0aLRGTr0R4UWFMtGm3Q=;\n b=fCmOv0uQYVTsYfxYvwZCxrdbET1rALjld9J06Dtn/W03M130ov3EpjuYnPNolW6NHn\n baELqsB358mVLT3BNrSxUYaBQDCCMzTvkGtvGfYAt2P5XbqfPqElrRiWmAHuwLKX/SMA\n oXbkC+rM2tQqZdBI0rPomdD4vtW3TnPuXSfU2Vw+eoI06TG5usWyRseFvx0PckAepqv2\n bsqjZ4QV2vesjb26qdca5+ZksP9OKT3699mY5UgyCo5BwMWQ0Xp195WOu1y/jia4AtsM\n KN+bSb/fRoHd+GjjPB0b3705x7NbkcPowOdJ6qmwekRzhKx8WsD6MNTkg+4+XTAU85g9\n vF9g==",
        "X-Gm-Message-State": "AOJu0YzEJohT2v6EJj3tkWxbpQ/Dbc4Bu6y0LQ/MhW7X/Z3Vh9TNm0TV\n 2mgOJj9+0bIzstDefkdVgIevhDAMw/Bj1gLovNsrHf27F3PX3+8hX4apTer4yHE=",
        "X-Google-Smtp-Source": "\n AGHT+IGlkabH3f0yZhGQ0bOCVsmH41oMIzyIEbMzmfUlEH3hIuIWePrHYPCiZNvFcvzWHsaN4+EQOg==",
        "X-Received": "by 2002:ad4:5c8f:0:b0:69b:ce6:271b with SMTP id\n o15-20020ad45c8f000000b0069b0ce6271bmr3641548qvh.2.1713456640189;\n Thu, 18 Apr 2024 09:10:40 -0700 (PDT)",
        "From": "Nicholas Pratte <npratte@iol.unh.edu>",
        "To": "jspewock@iol.unh.edu, wathsala.vithanage@arm.com,\n Honnappa.Nagarahalli@arm.com, probb@iol.unh.edu, thomas@monjalon.net,\n mb@smartsharesystems.com, bruce.richardson@intel.com,\n juraj.linkes@pantheon.tech, yoan.picchi@foss.arm.com,\n paul.szczepanek@arm.com",
        "Cc": "dev@dpdk.org,\n\tNicholas Pratte <npratte@iol.unh.edu>",
        "Subject": "[PATCH v4] dts: Change hugepage runtime config to 2MB Exclusively",
        "Date": "Thu, 18 Apr 2024 12:10:26 -0400",
        "Message-ID": "<20240418161026.2839-1-npratte@iol.unh.edu>",
        "X-Mailer": "git-send-email 2.44.0",
        "In-Reply-To": "<20240404153106.19047-1-npratte@iol.unh.edu>",
        "References": "<20240404153106.19047-1-npratte@iol.unh.edu>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "The previous implementation configures and allocates hugepage sizes\nbased on a system default. This can lead to two problems: overallocation of\nhugepages (which may crash the remote host), and configuration of hugepage\nsizes that are not recommended during runtime. This new implementation\nallows only 2MB hugepage allocation during runtime; any other unique\nhugepage size must be configured by the end-user for initializing DTS.\n\nIf the amount of 2MB hugepages requested exceeds the amount of 2MB\nhugepages already configured on the system, then the system will remount\nhugepages to cover the difference. If the amount of hugepages requested is\neither less than or equal to the amount already configured on the system,\nthen nothing is done.\n\nBugzilla ID: 1370\nSigned-off-by: Nicholas Pratte <npratte@iol.unh.edu>\nReviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>\n---\n\nv4:\n * dts.rst punctuation/grammar corrections and 2mb exclusivity\n   justifications included in documentation\n---\n doc/guides/tools/dts.rst                     |  6 ++++-\n dts/conf.yaml                                |  4 ++--\n dts/framework/config/__init__.py             |  4 ++--\n dts/framework/config/conf_yaml_schema.json   |  6 ++---\n dts/framework/config/types.py                |  2 +-\n dts/framework/testbed_model/linux_session.py | 24 +++++++++++---------\n dts/framework/testbed_model/node.py          |  8 ++++++-\n dts/framework/testbed_model/os_session.py    |  5 +++-\n 8 files changed, 37 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst\nindex 47b218b2c6..71473dbb3d 100644\n--- a/doc/guides/tools/dts.rst\n+++ b/doc/guides/tools/dts.rst\n@@ -131,7 +131,11 @@ There are two areas that need to be set up on a System Under Test:\n \n      You may specify the optional hugepage configuration in the DTS config file.\n      If you do, DTS will take care of configuring hugepages,\n-     overwriting your current SUT hugepage configuration.\n+     overwriting your current SUT hugepage configuration. Configuration of hugepages via DTS\n+     allows only for allocation of 2MB hugepages, as doing so prevents accidental/over\n+     allocation of hugepages and hugepages sizes not recommended during runtime due to\n+     contiguous memory space requirements. Thus, if you require hugepage\n+     sizes not equal to 2MB, then this configuration must be done outside of the DTS framework.\n \n    * System under test configuration\n \ndiff --git a/dts/conf.yaml b/dts/conf.yaml\nindex 8068345dd5..56c3ae6f4c 100644\n--- a/dts/conf.yaml\n+++ b/dts/conf.yaml\n@@ -35,7 +35,7 @@ nodes:\n     lcores: \"\" # use all the available logical cores\n     use_first_core: false # tells DPDK to use any physical core\n     memory_channels: 4 # tells DPDK to use 4 memory channels\n-    hugepages:  # optional; if removed, will use system hugepage configuration\n+    hugepages_2mb: # optional; if removed, will use system hugepage configuration\n         amount: 256\n         force_first_numa: false\n     ports:\n@@ -71,7 +71,7 @@ nodes:\n         os_driver: rdma\n         peer_node: \"SUT 1\"\n         peer_pci: \"0000:00:08.1\"\n-    hugepages:  # optional; if removed, will use system hugepage configuration\n+    hugepages_2mb: # optional; if removed, will use system hugepage configuration\n         amount: 256\n         force_first_numa: false\n     traffic_generator:\ndiff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py\nindex 4cb5c74059..b6f820e39e 100644\n--- a/dts/framework/config/__init__.py\n+++ b/dts/framework/config/__init__.py\n@@ -255,8 +255,8 @@ def from_dict(\n             Either an SUT or TG configuration instance.\n         \"\"\"\n         hugepage_config = None\n-        if \"hugepages\" in d:\n-            hugepage_config_dict = d[\"hugepages\"]\n+        if \"hugepages_2mb\" in d:\n+            hugepage_config_dict = d[\"hugepages_2mb\"]\n             if \"force_first_numa\" not in hugepage_config_dict:\n                 hugepage_config_dict[\"force_first_numa\"] = False\n             hugepage_config = HugepageConfiguration(**hugepage_config_dict)\ndiff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json\nindex 4731f4511d..f4d7199523 100644\n--- a/dts/framework/config/conf_yaml_schema.json\n+++ b/dts/framework/config/conf_yaml_schema.json\n@@ -146,7 +146,7 @@\n         \"compiler\"\n       ]\n     },\n-    \"hugepages\": {\n+    \"hugepages_2mb\": {\n       \"type\": \"object\",\n       \"description\": \"Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.\",\n       \"properties\": {\n@@ -253,8 +253,8 @@\n             \"type\": \"integer\",\n             \"description\": \"How many memory channels to use. Optional, defaults to 1.\"\n           },\n-          \"hugepages\": {\n-            \"$ref\": \"#/definitions/hugepages\"\n+          \"hugepages_2mb\": {\n+            \"$ref\": \"#/definitions/hugepages_2mb\"\n           },\n           \"ports\": {\n             \"type\": \"array\",\ndiff --git a/dts/framework/config/types.py b/dts/framework/config/types.py\nindex 1927910d88..016e0c3dbd 100644\n--- a/dts/framework/config/types.py\n+++ b/dts/framework/config/types.py\n@@ -46,7 +46,7 @@ class NodeConfigDict(TypedDict):\n     \"\"\"Allowed keys and values.\"\"\"\n \n     #:\n-    hugepages: HugepageConfigurationDict\n+    hugepages_2mb: HugepageConfigurationDict\n     #:\n     name: str\n     #:\ndiff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py\nindex 5d24030c3d..d0f7cfa77c 100644\n--- a/dts/framework/testbed_model/linux_session.py\n+++ b/dts/framework/testbed_model/linux_session.py\n@@ -15,7 +15,7 @@\n \n from typing_extensions import NotRequired\n \n-from framework.exception import RemoteCommandExecutionError\n+from framework.exception import ConfigurationError, RemoteCommandExecutionError\n from framework.utils import expand_range\n \n from .cpu import LogicalCore\n@@ -84,14 +84,20 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:\n         \"\"\"Overrides :meth:`~.os_session.OSSession.get_dpdk_file_prefix`.\"\"\"\n         return dpdk_prefix\n \n-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:\n+    def setup_hugepages(\n+        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool\n+    ) -> None:\n         \"\"\"Overrides :meth:`~.os_session.OSSession.setup_hugepages`.\"\"\"\n         self._logger.info(\"Getting Hugepage information.\")\n-        hugepage_size = self._get_hugepage_size()\n-        hugepages_total = self._get_hugepages_total()\n+        hugepages_total = self._get_hugepages_total(hugepage_size)\n+        if (\n+            f\"hugepages-{hugepage_size}kB\"\n+            not in self.send_command(\"ls /sys/kernel/mm/hugepages\").stdout\n+        ):\n+            raise ConfigurationError(\"hugepage size not supported by operating system\")\n         self._numa_nodes = self._get_numa_nodes()\n \n-        if force_first_numa or hugepages_total != hugepage_count:\n+        if force_first_numa or hugepages_total < hugepage_count:\n             # when forcing numa, we need to clear existing hugepages regardless\n             # of size, so they can be moved to the first numa node\n             self._configure_huge_pages(hugepage_count, hugepage_size, force_first_numa)\n@@ -99,13 +105,9 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:\n             self._logger.info(\"Hugepages already configured.\")\n         self._mount_huge_pages()\n \n-    def _get_hugepage_size(self) -> int:\n-        hugepage_size = self.send_command(\"awk '/Hugepagesize/ {print $2}' /proc/meminfo\").stdout\n-        return int(hugepage_size)\n-\n-    def _get_hugepages_total(self) -> int:\n+    def _get_hugepages_total(self, hugepage_size: int) -> int:\n         hugepages_total = self.send_command(\n-            \"awk '/HugePages_Total/ { print $2 }' /proc/meminfo\"\n+            f\"cat /sys/kernel/mm/hugepages/hugepages-{hugepage_size}kB/nr_hugepages\"\n         ).stdout\n         return int(hugepages_total)\n \ndiff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py\nindex 74061f6262..056a031ca0 100644\n--- a/dts/framework/testbed_model/node.py\n+++ b/dts/framework/testbed_model/node.py\n@@ -97,6 +97,10 @@ def __init__(self, node_config: NodeConfiguration):\n         self.virtual_devices = []\n         self._init_ports()\n \n+    @property\n+    def _hugepage_default_size(self) -> int:\n+        return 2048\n+\n     def _init_ports(self) -> None:\n         self.ports = [Port(self.name, port_config) for port_config in self.config.ports]\n         self.main_session.update_ports(self.ports)\n@@ -266,7 +270,9 @@ def _setup_hugepages(self) -> None:\n         \"\"\"\n         if self.config.hugepages:\n             self.main_session.setup_hugepages(\n-                self.config.hugepages.amount, self.config.hugepages.force_first_numa\n+                self.config.hugepages.amount,\n+                self._hugepage_default_size,\n+                self.config.hugepages.force_first_numa,\n             )\n \n     def configure_port_state(self, port: Port, enable: bool = True) -> None:\ndiff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py\nindex d5bf7e0401..5d58400cbe 100644\n--- a/dts/framework/testbed_model/os_session.py\n+++ b/dts/framework/testbed_model/os_session.py\n@@ -345,7 +345,9 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:\n         \"\"\"\n \n     @abstractmethod\n-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:\n+    def setup_hugepages(\n+        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool\n+    ) -> None:\n         \"\"\"Configure hugepages on the node.\n \n         Get the node's Hugepage Size, configure the specified count of hugepages\n@@ -353,6 +355,7 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:\n \n         Args:\n             hugepage_count: Configure this many hugepages.\n+            hugepage_size: Configure hugepages of this size (currently not used in the config)\n             force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.\n         \"\"\"\n \n",
    "prefixes": [
        "v4"
    ]
}