DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively
@ 2024-04-30 18:45 Nicholas Pratte
  2024-04-30 18:45 ` [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-04-30 18:45 UTC (permalink / raw)
  To: jspewock@iol.unh.edumb@smartsharesystems.combruce.richardson,
	yoan.picchi, juraj.linkes, paul.szczepanek, wathsala.vithanage,
	thomas, Honnappa.Nagarahalli, probb
  Cc: dev, Nicholas Pratte, Jeremy Spewock

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 hugepage
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 is
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 <npratte@iol.unh.edu>
Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
---

v4:
 * dts.rst punctuation/grammar corrections and 2mb exclusivity
   justifications included in documentation
---
 doc/guides/tools/dts.rst                     |  6 ++++-
 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 | 24 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 +++-
 dts/framework/testbed_model/os_session.py    |  7 +++++-
 8 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst
index 47b218b2c6..40c3ddafb6 100644
--- a/doc/guides/tools/dts.rst
+++ b/doc/guides/tools/dts.rst
@@ -131,7 +131,11 @@ There are two areas that need to be set up on a System Under Test:
 
      You may specify the optional hugepage configuration in the DTS config file.
      If you do, DTS will take care of configuring hugepages,
-     overwriting your current SUT hugepage configuration.
+     overwriting your current SUT hugepage configuration. Configuration of hugepages via DTS
+     allows only for allocation of 2MB hugepages, as doing so prevents accidental/over
+     allocation of hugepage sizes not recommended during runtime due to
+     contiguous memory space requirements. Thus, if you require hugepage
+     sizes not equal to 2MB, then this configuration must be done outside of the DTS framework.
 
    * System under test configuration
 
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 = None
-        if "hugepages" in d:
-            hugepage_config_dict = d["hugepages"]
+        if "hugepages_2mb" in d:
+            hugepage_config_dict = d["hugepages_2mb"]
             if "force_first_numa" not in hugepage_config_dict:
                 hugepage_config_dict["force_first_numa"] = False
             hugepage_config = HugepageConfiguration(**hugepage_config_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 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, 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..d0f7cfa77c 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
@@ -84,14 +84,20 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """Overrides :meth:`~.os_session.OSSession.get_dpdk_file_prefix`."""
         return dpdk_prefix
 
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: 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()
-        hugepages_total = self._get_hugepages_total()
+        hugepages_total = self._get_hugepages_total(hugepage_size)
+        if (
+            f"hugepages-{hugepage_size}kB"
+            not in self.send_command("ls /sys/kernel/mm/hugepages").stdout
+        ):
+            raise ConfigurationError("hugepage size not supported by operating system")
         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)
@@ -99,13 +105,9 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
             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:
+    def _get_hugepages_total(self, hugepage_size: int) -> int:
         hugepages_total = self.send_command(
-            "awk '/HugePages_Total/ { print $2 }' /proc/meminfo"
+            f"cat /sys/kernel/mm/hugepages/hugepages-{hugepage_size}kB/nr_hugepages"
         ).stdout
         return int(hugepages_total)
 
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 74061f6262..3f2a727c3b 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,9 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount, self.config.hugepages.force_first_numa
+                self.config.hugepages.amount,
+                self.main_session.hugepage_size,
+                self.config.hugepages.force_first_numa,
             )
 
     def configure_port_state(self, port: Port, enable: bool = True) -> None:
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index d5bf7e0401..19dcf5f963 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -64,6 +64,7 @@ class OSSession(ABC):
     _logger: DTSLogger
     remote_session: RemoteSession
     interactive_session: InteractiveRemoteSession
+    hugepage_size: int
 
     def __init__(
         self,
@@ -80,6 +81,7 @@ def __init__(
             name: The name of the session.
             logger: The logger instance this session will use.
         """
+        self.hugepage_size = 2048
         self._config = node_config
         self.name = name
         self._logger = logger
@@ -345,7 +347,9 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """
 
     @abstractmethod
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+    ) -> None:
         """Configure hugepages on the node.
 
         Get the node's Hugepage Size, configure the specified count of hugepages
@@ -353,6 +357,7 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
 
         Args:
             hugepage_count: Configure this many hugepages.
+            hugepage_size: Configure hugepages of this size.
             force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.
         """
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-04-30 18:45 [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
@ 2024-04-30 18:45 ` Nicholas Pratte
  2024-05-02 11:55   ` Juraj Linkeš
                     ` (2 more replies)
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
  2024-05-02 11:55 ` [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively Juraj Linkeš
  2 siblings, 3 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-04-30 18:45 UTC (permalink / raw)
  To: jspewock@iol.unh.edumb@smartsharesystems.combruce.richardson,
	yoan.picchi, juraj.linkes, paul.szczepanek, wathsala.vithanage,
	thomas, Honnappa.Nagarahalli, probb
  Cc: dev, Nicholas Pratte

The term 'amount' is used for uncountable nouns. Since total hugepages
is a discrete value (i.e. countable), the declaration of the 'amount'
key value pair should be changes to a different term in both the config
and the rest of the code.

Signed-off-by: Nicholas Pratte  <npratte@iol.unh.edu>
---
 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 | 4 ++--
 dts/framework/testbed_model/node.py          | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dts/conf.yaml b/dts/conf.yaml
index 56c3ae6f4c..44b5e4ec84 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -36,7 +36,7 @@ nodes:
     use_first_core: false # tells DPDK to use any physical core
     memory_channels: 4 # tells DPDK to use 4 memory channels
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        quantity: 256
         force_first_numa: false
     ports:
       # sets up the physical link between "SUT 1"@000:00:08.0 and "TG 1"@0000:00:08.0
@@ -72,7 +72,7 @@ nodes:
         peer_node: "SUT 1"
         peer_pci: "0000:00:08.1"
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        quantity: 256
         force_first_numa: false
     traffic_generator:
         type: SCAPY
diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py
index b6f820e39e..3a617ef599 100644
--- a/dts/framework/config/__init__.py
+++ b/dts/framework/config/__init__.py
@@ -127,11 +127,11 @@ class HugepageConfiguration:
     r"""The hugepage configuration of :class:`~framework.testbed_model.node.Node`\s.
 
     Attributes:
-        amount: The number of hugepages.
+        quantity: The quantity of hugepages.
         force_first_numa: If :data:`True`, the hugepages will be configured on the first NUMA node.
     """
 
-    amount: int
+    quantity: int
     force_first_numa: bool
 
 
diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index f4d7199523..10a8025084 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -150,9 +150,9 @@
       "type": "object",
       "description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
       "properties": {
-        "amount": {
+        "quantity": {
           "type": "integer",
-          "description": "The amount of hugepages to configure. Hugepage size will be the system default."
+          "description": "The quantity of hugepages to configure. Hugepage size will be the system default."
         },
         "force_first_numa": {
           "type": "boolean",
@@ -161,7 +161,7 @@
       },
       "additionalProperties": false,
       "required": [
-        "amount"
+        "quantity"
       ]
     },
     "mac_address": {
diff --git a/dts/framework/config/types.py b/dts/framework/config/types.py
index 016e0c3dbd..57807b0a73 100644
--- a/dts/framework/config/types.py
+++ b/dts/framework/config/types.py
@@ -37,7 +37,7 @@ class HugepageConfigurationDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    amount: int
+    quantity: int
     #:
     force_first_numa: bool
 
diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index d0f7cfa77c..ae7d0ba7d2 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -138,7 +138,7 @@ 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, quantity: int, size: int, force_first_numa: bool) -> None:
         self._logger.info("Configuring Hugepages.")
         hugepage_config_path = f"/sys/kernel/mm/hugepages/hugepages-{size}kB/nr_hugepages"
         if force_first_numa and self._supports_numa():
@@ -149,7 +149,7 @@ def _configure_huge_pages(self, amount: int, size: int, force_first_numa: bool)
                 f"/hugepages-{size}kB/nr_hugepages"
             )
 
-        self.send_command(f"echo {amount} | tee {hugepage_config_path}", privileged=True)
+        self.send_command(f"echo {quantity} | tee {hugepage_config_path}", privileged=True)
 
     def update_ports(self, ports: list[Port]) -> None:
         """Overrides :meth:`~.os_session.OSSession.update_ports`."""
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 3f2a727c3b..512fd01db1 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,7 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount,
+                self.config.hugepages.quantity,
                 self.main_session.hugepage_size,
                 self.config.hugepages.force_first_numa,
             )
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v5 0/2] Methodology change for hugepage configuration
  2024-04-30 18:45 [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
  2024-04-30 18:45 ` [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
@ 2024-04-30 18:45 ` Nicholas Pratte
  2024-05-07 11:16   ` Luca Vizzarro
                     ` (5 more replies)
  2024-05-02 11:55 ` [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively Juraj Linkeš
  2 siblings, 6 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-04-30 18:45 UTC (permalink / raw)
  To: jspewock@iol.unh.edumb@smartsharesystems.combruce.richardson,
	yoan.picchi, juraj.linkes, paul.szczepanek, wathsala.vithanage,
	thomas, Honnappa.Nagarahalli, probb
  Cc: dev, Nicholas Pratte

In order to prevent accidental misconfiguration of hugepages at runtime,
the following changes are made to only allow for configuration of 2MB
hugepages within the DTS config.yaml. In the previous implementation, a
default hugepage size was selected via the size listed in /proc/meminfo.
The problem with this implementation is that, assuming the end-user has
made prior modifications to the system, /proc/meminfo may default to
hugepage sizes that are not recommended to be configured at runtime
(i.e. 1GB hugepages). This can lead to two problems: overallocation of
hugepages (which may crash the remote host) configuration of hugepages
sizes that are not recommended during runtime. In this new implementation,
we stipulate that any runtime hugepage configuration size that is not 2MB
is considered an outlier. If the end-user would like to configure either 
1GB hugepages or any unique hugepage size outside of 2MB, then they should 
make these configurations either at startup (in the case of 1GB hugepages) 
or runtime outside of DTS configuration (if a user would like hugepages
that are not 2MB). In either case, the expectation is that, if wish to
use hugepage sizes that are not 2MB, you will make these changes outside
and prior to the initialization of DTS.
    
The end-user has two options: remove the option for hugepage
configuration in the conf.yaml, or keep the option and specify the
amount of 2MB hugepages desired. In the case of the former, then we assume
that hugepages are already configured prior to DTS initialization. In
the latter case, the user must define the amount of 2MB hugepages to be
configured at runtime. 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 is either greater than or equal to the amount
already configured on the system, then nothing is done.

Nicholas Pratte (2):
  dts: Change hugepage runtime config to 2MB Exclusively
  dts: Change hugepage 'amount' to a different term

 doc/guides/tools/dts.rst                     |  6 ++++-
 dts/conf.yaml                                |  8 +++---
 dts/framework/config/__init__.py             |  8 +++---
 dts/framework/config/conf_yaml_schema.json   | 12 ++++-----
 dts/framework/config/types.py                |  4 +--
 dts/framework/testbed_model/linux_session.py | 28 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 ++-
 dts/framework/testbed_model/os_session.py    |  7 ++++-
 8 files changed, 45 insertions(+), 32 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively
  2024-04-30 18:45 [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
  2024-04-30 18:45 ` [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
@ 2024-05-02 11:55 ` Juraj Linkeš
  2 siblings, 0 replies; 33+ messages in thread
From: Juraj Linkeš @ 2024-05-02 11:55 UTC (permalink / raw)
  To: Nicholas Pratte
  Cc: yoan.picchi, paul.szczepanek, wathsala.vithanage, thomas,
	Honnappa.Nagarahalli, probb, dev, Jeremy Spewock

On Tue, Apr 30, 2024 at 8:47 PM Nicholas Pratte <npratte@iol.unh.edu> 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 hugepage
> 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 is
> 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 <npratte@iol.unh.edu>
> Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>

Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-04-30 18:45 ` [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
@ 2024-05-02 11:55   ` Juraj Linkeš
  2024-05-07 11:15   ` Luca Vizzarro
  2024-05-07 12:05   ` Bruce Richardson
  2 siblings, 0 replies; 33+ messages in thread
From: Juraj Linkeš @ 2024-05-02 11:55 UTC (permalink / raw)
  To: Nicholas Pratte
  Cc: yoan.picchi, paul.szczepanek, wathsala.vithanage, thomas,
	Honnappa.Nagarahalli, probb, dev

On Tue, Apr 30, 2024 at 8:47 PM Nicholas Pratte <npratte@iol.unh.edu> wrote:
>
> The term 'amount' is used for uncountable nouns. Since total hugepages
> is a discrete value (i.e. countable), the declaration of the 'amount'
> key value pair should be changes to a different term in both the config
> and the rest of the code.
>
> Signed-off-by: Nicholas Pratte  <npratte@iol.unh.edu>

Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-04-30 18:45 ` [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  2024-05-02 11:55   ` Juraj Linkeš
@ 2024-05-07 11:15   ` Luca Vizzarro
  2024-05-07 12:05   ` Bruce Richardson
  2 siblings, 0 replies; 33+ messages in thread
From: Luca Vizzarro @ 2024-05-07 11:15 UTC (permalink / raw)
  To: Nicholas Pratte, jspewock, yoan.picchi, juraj.linkes,
	paul.szczepanek, wathsala.vithanage, thomas,
	Honnappa.Nagarahalli, probb
  Cc: dev

Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 0/2] Methodology change for hugepage configuration
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
@ 2024-05-07 11:16   ` Luca Vizzarro
  2024-05-07 16:37   ` [PATCH v6 " Nicholas Pratte
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Luca Vizzarro @ 2024-05-07 11:16 UTC (permalink / raw)
  To: Nicholas Pratte, jspewock, yoan.picchi, juraj.linkes,
	paul.szczepanek, wathsala.vithanage, thomas,
	Honnappa.Nagarahalli, probb
  Cc: dev

Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-04-30 18:45 ` [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  2024-05-02 11:55   ` Juraj Linkeš
  2024-05-07 11:15   ` Luca Vizzarro
@ 2024-05-07 12:05   ` Bruce Richardson
  2024-05-07 12:43     ` Luca Vizzarro
  2 siblings, 1 reply; 33+ messages in thread
From: Bruce Richardson @ 2024-05-07 12:05 UTC (permalink / raw)
  To: Nicholas Pratte
  Cc: yoan.picchi, juraj.linkes, paul.szczepanek, wathsala.vithanage,
	thomas, Honnappa.Nagarahalli, probb, dev

On Tue, Apr 30, 2024 at 02:45:33PM -0400, Nicholas Pratte wrote:
> The term 'amount' is used for uncountable nouns. Since total hugepages
> is a discrete value (i.e. countable), the declaration of the 'amount'
> key value pair should be changes to a different term in both the config
> and the rest of the code.
> 
> Signed-off-by: Nicholas Pratte  <npratte@iol.unh.edu>
> ---
>  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 | 4 ++--
>  dts/framework/testbed_model/node.py          | 2 +-
>  6 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/dts/conf.yaml b/dts/conf.yaml
> index 56c3ae6f4c..44b5e4ec84 100644
> --- a/dts/conf.yaml
> +++ b/dts/conf.yaml
> @@ -36,7 +36,7 @@ nodes:
>      use_first_core: false # tells DPDK to use any physical core
>      memory_channels: 4 # tells DPDK to use 4 memory channels
>      hugepages_2mb: # optional; if removed, will use system hugepage configuration
> -        amount: 256
> +        quantity: 256
>          force_first_numa: false

Sorry to be late to the reviews here, but since this is a countable value -
as you state in the cover letter- would "number" or "count" not be better
terms. To me, "quantity" is just a synonym of "amount", and can be used for
uncountable values too, e.g. "a quantity of water".

/Bruce

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-07 12:05   ` Bruce Richardson
@ 2024-05-07 12:43     ` Luca Vizzarro
  2024-05-07 13:00       ` Bruce Richardson
  0 siblings, 1 reply; 33+ messages in thread
From: Luca Vizzarro @ 2024-05-07 12:43 UTC (permalink / raw)
  To: Bruce Richardson, Nicholas Pratte
  Cc: yoan.picchi, juraj.linkes, paul.szczepanek, wathsala.vithanage,
	thomas, Honnappa.Nagarahalli, probb, dev

On 07/05/2024 13:05, Bruce Richardson wrote:
> Sorry to be late to the reviews here, but since this is a countable value -
> as you state in the cover letter- would "number" or "count" not be better
> terms. To me, "quantity" is just a synonym of "amount", and can be used for
> uncountable values too, e.g. "a quantity of water".


Hi Bruce,

The change is based on the readability and intuitiveness of the 
configuration file. In which case "number" could be ambiguous:

   hugepages_2mb:
     number: 100

And here I could see "count" working:

   hugepages_2mb:
     count: 100

But since the change is propagated for consistency. "count" would no 
longer be well fitting in the rest:

      "description": "The count of hugepages to configure. Hugepage
                      size will be the system default."

It seems that "quantity" may be the best fitting here while retaining 
naming consistency.


Best,
Luca

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-07 12:43     ` Luca Vizzarro
@ 2024-05-07 13:00       ` Bruce Richardson
  2024-05-13 10:06         ` Juraj Linkeš
  0 siblings, 1 reply; 33+ messages in thread
From: Bruce Richardson @ 2024-05-07 13:00 UTC (permalink / raw)
  To: Luca Vizzarro
  Cc: Nicholas Pratte, yoan.picchi, juraj.linkes, paul.szczepanek,
	wathsala.vithanage, thomas, Honnappa.Nagarahalli, probb, dev

On Tue, May 07, 2024 at 01:43:30PM +0100, Luca Vizzarro wrote:
> On 07/05/2024 13:05, Bruce Richardson wrote:
> > Sorry to be late to the reviews here, but since this is a countable value -
> > as you state in the cover letter- would "number" or "count" not be better
> > terms. To me, "quantity" is just a synonym of "amount", and can be used for
> > uncountable values too, e.g. "a quantity of water".
> 
> 
> Hi Bruce,
> 
> The change is based on the readability and intuitiveness of the
> configuration file. In which case "number" could be ambiguous:
> 
>   hugepages_2mb:
>     number: 100
> 
> And here I could see "count" working:
> 
>   hugepages_2mb:
>     count: 100
> 
> But since the change is propagated for consistency. "count" would no longer
> be well fitting in the rest:
> 
>      "description": "The count of hugepages to configure. Hugepage
>                      size will be the system default."
> 
Whatever term is actually used, the description should definitely refer to
"The number of hugepages to configure".

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v6 0/2] Methodology change for hugepage configuration
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
  2024-05-07 11:16   ` Luca Vizzarro
@ 2024-05-07 16:37   ` Nicholas Pratte
  2024-05-07 16:37     ` [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
  2024-05-07 16:37     ` [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  2024-05-07 17:44   ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
                     ` (3 subsequent siblings)
  5 siblings, 2 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-07 16:37 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, paul.szczepanek,
	bruce.richardson, probb, wathsala.vithanage, yoan.picchi, thomas,
	jspewock, mb
  Cc: dev, Nicholas Pratte

In order to prevent accidental misconfiguration of hugepages at runtime,
the following changes are made to only allow for configuration of 2MB
hugepages within the DTS config.yaml. In the previous implementation, a
default hugepage size was selected via the size listed in /proc/meminfo.
The problem with this implementation is that, assuming the end-user has
made prior modifications to the system, /proc/meminfo may default to
hugepage sizes that are not recommended to be configured at runtime
(i.e. 1GB hugepages). This can lead to two problems: overallocation of
hugepages (which may crash the remote host) configuration of hugepages
sizes that are not recommended during runtime. In this new implementation,
we stipulate that any runtime hugepage configuration size that is not 2MB
is considered an outlier. If the end-user would like to configure either
1GB hugepages or any unique hugepage size outside of 2MB, then they should
make these configurations either at startup (in the case of 1GB hugepages)
or runtime outside of DTS configuration (if a user would like hugepages
that are not 2MB). In either case, the expectation is that, if wish to
use hugepage sizes that are not 2MB, you will make these changes outside
and prior to the initialization of DTS.

The end-user has two options: remove the option for hugepage
configuration in the conf.yaml, or keep the option and specify the
amount of 2MB hugepages desired. In the case of the former, then we assume
that hugepages are already configured prior to DTS initialization. In
the latter case, the user must define the amount of 2MB hugepages to be
configured at runtime. 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 is either greater than or equal to the amount
already configured on the system, then nothing is done.

Nicholas Pratte (2):
  dts: Change hugepage runtime config to 2MB Exclusively
  dts: Change hugepage 'amount' to a different term

 doc/guides/tools/dts.rst                     |  6 ++++-
 dts/conf.yaml                                |  8 +++---
 dts/framework/config/__init__.py             |  8 +++---
 dts/framework/config/conf_yaml_schema.json   | 12 ++++-----
 dts/framework/config/types.py                |  4 +--
 dts/framework/testbed_model/linux_session.py | 28 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 ++-
 dts/framework/testbed_model/os_session.py    |  7 ++++-
 8 files changed, 45 insertions(+), 32 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively
  2024-05-07 16:37   ` [PATCH v6 " Nicholas Pratte
@ 2024-05-07 16:37     ` Nicholas Pratte
  2024-05-07 16:37     ` [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  1 sibling, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-07 16:37 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, paul.szczepanek,
	bruce.richardson, probb, wathsala.vithanage, yoan.picchi, thomas,
	jspewock, mb
  Cc: dev, Nicholas Pratte

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 hugepage
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 is
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 <npratte@iol.unh.edu>
Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
---

v4:
 * dts.rst punctuation/grammar corrections and 2mb exclusivity
   justifications included in documentation
---
 doc/guides/tools/dts.rst                     |  6 ++++-
 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 | 24 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 +++-
 dts/framework/testbed_model/os_session.py    |  7 +++++-
 8 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst
index 47b218b2c6..40c3ddafb6 100644
--- a/doc/guides/tools/dts.rst
+++ b/doc/guides/tools/dts.rst
@@ -131,7 +131,11 @@ There are two areas that need to be set up on a System Under Test:
 
      You may specify the optional hugepage configuration in the DTS config file.
      If you do, DTS will take care of configuring hugepages,
-     overwriting your current SUT hugepage configuration.
+     overwriting your current SUT hugepage configuration. Configuration of hugepages via DTS
+     allows only for allocation of 2MB hugepages, as doing so prevents accidental/over
+     allocation of hugepage sizes not recommended during runtime due to
+     contiguous memory space requirements. Thus, if you require hugepage
+     sizes not equal to 2MB, then this configuration must be done outside of the DTS framework.
 
    * System under test configuration
 
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 = None
-        if "hugepages" in d:
-            hugepage_config_dict = d["hugepages"]
+        if "hugepages_2mb" in d:
+            hugepage_config_dict = d["hugepages_2mb"]
             if "force_first_numa" not in hugepage_config_dict:
                 hugepage_config_dict["force_first_numa"] = False
             hugepage_config = HugepageConfiguration(**hugepage_config_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 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, 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..d0f7cfa77c 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
@@ -84,14 +84,20 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """Overrides :meth:`~.os_session.OSSession.get_dpdk_file_prefix`."""
         return dpdk_prefix
 
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: 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()
-        hugepages_total = self._get_hugepages_total()
+        hugepages_total = self._get_hugepages_total(hugepage_size)
+        if (
+            f"hugepages-{hugepage_size}kB"
+            not in self.send_command("ls /sys/kernel/mm/hugepages").stdout
+        ):
+            raise ConfigurationError("hugepage size not supported by operating system")
         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)
@@ -99,13 +105,9 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
             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:
+    def _get_hugepages_total(self, hugepage_size: int) -> int:
         hugepages_total = self.send_command(
-            "awk '/HugePages_Total/ { print $2 }' /proc/meminfo"
+            f"cat /sys/kernel/mm/hugepages/hugepages-{hugepage_size}kB/nr_hugepages"
         ).stdout
         return int(hugepages_total)
 
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 74061f6262..3f2a727c3b 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,9 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount, self.config.hugepages.force_first_numa
+                self.config.hugepages.amount,
+                self.main_session.hugepage_size,
+                self.config.hugepages.force_first_numa,
             )
 
     def configure_port_state(self, port: Port, enable: bool = True) -> None:
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index d5bf7e0401..19dcf5f963 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -64,6 +64,7 @@ class OSSession(ABC):
     _logger: DTSLogger
     remote_session: RemoteSession
     interactive_session: InteractiveRemoteSession
+    hugepage_size: int
 
     def __init__(
         self,
@@ -80,6 +81,7 @@ def __init__(
             name: The name of the session.
             logger: The logger instance this session will use.
         """
+        self.hugepage_size = 2048
         self._config = node_config
         self.name = name
         self._logger = logger
@@ -345,7 +347,9 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """
 
     @abstractmethod
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+    ) -> None:
         """Configure hugepages on the node.
 
         Get the node's Hugepage Size, configure the specified count of hugepages
@@ -353,6 +357,7 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
 
         Args:
             hugepage_count: Configure this many hugepages.
+            hugepage_size: Configure hugepages of this size.
             force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.
         """
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-07 16:37   ` [PATCH v6 " Nicholas Pratte
  2024-05-07 16:37     ` [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
@ 2024-05-07 16:37     ` Nicholas Pratte
  1 sibling, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-07 16:37 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, juraj.linkes, paul.szczepanek,
	bruce.richardson, probb, wathsala.vithanage, yoan.picchi, thomas,
	jspewock, mb
  Cc: dev, Nicholas Pratte

The term 'amount' is used for uncountable nouns. Since total hugepages
is a discrete value (i.e. countable), the declaration of the 'amount'
key value pair should be changes to a different term in both the config
and the rest of the code.

Signed-off-by: Nicholas Pratte  <npratte@iol.unh.edu>
---
 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 | 4 ++--
 dts/framework/testbed_model/node.py          | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dts/conf.yaml b/dts/conf.yaml
index 56c3ae6f4c..44b5e4ec84 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -36,7 +36,7 @@ nodes:
     use_first_core: false # tells DPDK to use any physical core
     memory_channels: 4 # tells DPDK to use 4 memory channels
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        quantity: 256
         force_first_numa: false
     ports:
       # sets up the physical link between "SUT 1"@000:00:08.0 and "TG 1"@0000:00:08.0
@@ -72,7 +72,7 @@ nodes:
         peer_node: "SUT 1"
         peer_pci: "0000:00:08.1"
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        quantity: 256
         force_first_numa: false
     traffic_generator:
         type: SCAPY
diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py
index b6f820e39e..3a617ef599 100644
--- a/dts/framework/config/__init__.py
+++ b/dts/framework/config/__init__.py
@@ -127,11 +127,11 @@ class HugepageConfiguration:
     r"""The hugepage configuration of :class:`~framework.testbed_model.node.Node`\s.
 
     Attributes:
-        amount: The number of hugepages.
+        quantity: The quantity of hugepages.
         force_first_numa: If :data:`True`, the hugepages will be configured on the first NUMA node.
     """
 
-    amount: int
+    quantity: int
     force_first_numa: bool
 
 
diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index f4d7199523..980f7d18a0 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -150,9 +150,9 @@
       "type": "object",
       "description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
       "properties": {
-        "amount": {
+        "quantity": {
           "type": "integer",
-          "description": "The amount of hugepages to configure. Hugepage size will be the system default."
+          "description": "The number of hugepages to configure. Hugepage size will be the system default."
         },
         "force_first_numa": {
           "type": "boolean",
@@ -161,7 +161,7 @@
       },
       "additionalProperties": false,
       "required": [
-        "amount"
+        "quantity"
       ]
     },
     "mac_address": {
diff --git a/dts/framework/config/types.py b/dts/framework/config/types.py
index 016e0c3dbd..57807b0a73 100644
--- a/dts/framework/config/types.py
+++ b/dts/framework/config/types.py
@@ -37,7 +37,7 @@ class HugepageConfigurationDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    amount: int
+    quantity: int
     #:
     force_first_numa: bool
 
diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index d0f7cfa77c..ae7d0ba7d2 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -138,7 +138,7 @@ 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, quantity: int, size: int, force_first_numa: bool) -> None:
         self._logger.info("Configuring Hugepages.")
         hugepage_config_path = f"/sys/kernel/mm/hugepages/hugepages-{size}kB/nr_hugepages"
         if force_first_numa and self._supports_numa():
@@ -149,7 +149,7 @@ def _configure_huge_pages(self, amount: int, size: int, force_first_numa: bool)
                 f"/hugepages-{size}kB/nr_hugepages"
             )
 
-        self.send_command(f"echo {amount} | tee {hugepage_config_path}", privileged=True)
+        self.send_command(f"echo {quantity} | tee {hugepage_config_path}", privileged=True)
 
     def update_ports(self, ports: list[Port]) -> None:
         """Overrides :meth:`~.os_session.OSSession.update_ports`."""
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 3f2a727c3b..512fd01db1 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,7 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount,
+                self.config.hugepages.quantity,
                 self.main_session.hugepage_size,
                 self.config.hugepages.force_first_numa,
             )
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v6 0/2] Methodology change for hugepage configuration
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
  2024-05-07 11:16   ` Luca Vizzarro
  2024-05-07 16:37   ` [PATCH v6 " Nicholas Pratte
@ 2024-05-07 17:44   ` Nicholas Pratte
  2024-05-07 17:44     ` [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
                       ` (3 more replies)
  2024-05-30 17:58   ` [PATCH v7 " Nicholas Pratte
                     ` (2 subsequent siblings)
  5 siblings, 4 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-07 17:44 UTC (permalink / raw)
  To: probb, bruce.richardson, Honnappa.Nagarahalli, juraj.linkes,
	thomas, jspewock, yoan.picchi, mb, wathsala.vithanage,
	paul.szczepanek
  Cc: dev, Nicholas Pratte

In order to prevent accidental misconfiguration of hugepages at runtime,
the following changes are made to only allow for configuration of 2MB
hugepages within the DTS config.yaml. In the previous implementation, a
default hugepage size was selected via the size listed in /proc/meminfo.
The problem with this implementation is that, assuming the end-user has
made prior modifications to the system, /proc/meminfo may default to
hugepage sizes that are not recommended to be configured at runtime
(i.e. 1GB hugepages). This can lead to two problems: overallocation of
hugepages (which may crash the remote host) configuration of hugepages
sizes that are not recommended during runtime. In this new implementation,
we stipulate that any runtime hugepage configuration size that is not 2MB
is considered an outlier. If the end-user would like to configure either
1GB hugepages or any unique hugepage size outside of 2MB, then they should
make these configurations either at startup (in the case of 1GB hugepages)
or runtime outside of DTS configuration (if a user would like hugepages
that are not 2MB). In either case, the expectation is that, if wish to
use hugepage sizes that are not 2MB, you will make these changes outside
and prior to the initialization of DTS.

The end-user has two options: remove the option for hugepage
configuration in the conf.yaml, or keep the option and specify the
amount of 2MB hugepages desired. In the case of the former, then we assume
that hugepages are already configured prior to DTS initialization. In
the latter case, the user must define the amount of 2MB hugepages to be
configured at runtime. 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 is either greater than or equal to the amount
already configured on the system, then nothing is done.

Nicholas Pratte (2):
  dts: Change hugepage runtime config to 2MB Exclusively
  dts: Change hugepage 'amount' to a different term

 doc/guides/tools/dts.rst                     |  6 ++++-
 dts/conf.yaml                                |  8 +++---
 dts/framework/config/__init__.py             |  8 +++---
 dts/framework/config/conf_yaml_schema.json   | 12 ++++-----
 dts/framework/config/types.py                |  4 +--
 dts/framework/testbed_model/linux_session.py | 28 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 ++-
 dts/framework/testbed_model/os_session.py    |  7 ++++-
 8 files changed, 45 insertions(+), 32 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively
  2024-05-07 17:44   ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
@ 2024-05-07 17:44     ` Nicholas Pratte
  2024-05-07 17:44     ` [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-07 17:44 UTC (permalink / raw)
  To: probb, bruce.richardson, Honnappa.Nagarahalli, juraj.linkes,
	thomas, jspewock, yoan.picchi, mb, wathsala.vithanage,
	paul.szczepanek
  Cc: dev, Nicholas Pratte

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 hugepage
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 is
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 <npratte@iol.unh.edu>
Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
---

v4:
 * dts.rst punctuation/grammar corrections and 2mb exclusivity
   justifications included in documentation
---
 doc/guides/tools/dts.rst                     |  6 ++++-
 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 | 24 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 +++-
 dts/framework/testbed_model/os_session.py    |  7 +++++-
 8 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst
index 47b218b2c6..40c3ddafb6 100644
--- a/doc/guides/tools/dts.rst
+++ b/doc/guides/tools/dts.rst
@@ -131,7 +131,11 @@ There are two areas that need to be set up on a System Under Test:
 
      You may specify the optional hugepage configuration in the DTS config file.
      If you do, DTS will take care of configuring hugepages,
-     overwriting your current SUT hugepage configuration.
+     overwriting your current SUT hugepage configuration. Configuration of hugepages via DTS
+     allows only for allocation of 2MB hugepages, as doing so prevents accidental/over
+     allocation of hugepage sizes not recommended during runtime due to
+     contiguous memory space requirements. Thus, if you require hugepage
+     sizes not equal to 2MB, then this configuration must be done outside of the DTS framework.
 
    * System under test configuration
 
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 = None
-        if "hugepages" in d:
-            hugepage_config_dict = d["hugepages"]
+        if "hugepages_2mb" in d:
+            hugepage_config_dict = d["hugepages_2mb"]
             if "force_first_numa" not in hugepage_config_dict:
                 hugepage_config_dict["force_first_numa"] = False
             hugepage_config = HugepageConfiguration(**hugepage_config_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 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, 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..d0f7cfa77c 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
@@ -84,14 +84,20 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """Overrides :meth:`~.os_session.OSSession.get_dpdk_file_prefix`."""
         return dpdk_prefix
 
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: 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()
-        hugepages_total = self._get_hugepages_total()
+        hugepages_total = self._get_hugepages_total(hugepage_size)
+        if (
+            f"hugepages-{hugepage_size}kB"
+            not in self.send_command("ls /sys/kernel/mm/hugepages").stdout
+        ):
+            raise ConfigurationError("hugepage size not supported by operating system")
         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)
@@ -99,13 +105,9 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
             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:
+    def _get_hugepages_total(self, hugepage_size: int) -> int:
         hugepages_total = self.send_command(
-            "awk '/HugePages_Total/ { print $2 }' /proc/meminfo"
+            f"cat /sys/kernel/mm/hugepages/hugepages-{hugepage_size}kB/nr_hugepages"
         ).stdout
         return int(hugepages_total)
 
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 74061f6262..3f2a727c3b 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,9 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount, self.config.hugepages.force_first_numa
+                self.config.hugepages.amount,
+                self.main_session.hugepage_size,
+                self.config.hugepages.force_first_numa,
             )
 
     def configure_port_state(self, port: Port, enable: bool = True) -> None:
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index d5bf7e0401..19dcf5f963 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -64,6 +64,7 @@ class OSSession(ABC):
     _logger: DTSLogger
     remote_session: RemoteSession
     interactive_session: InteractiveRemoteSession
+    hugepage_size: int
 
     def __init__(
         self,
@@ -80,6 +81,7 @@ def __init__(
             name: The name of the session.
             logger: The logger instance this session will use.
         """
+        self.hugepage_size = 2048
         self._config = node_config
         self.name = name
         self._logger = logger
@@ -345,7 +347,9 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """
 
     @abstractmethod
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+    ) -> None:
         """Configure hugepages on the node.
 
         Get the node's Hugepage Size, configure the specified count of hugepages
@@ -353,6 +357,7 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
 
         Args:
             hugepage_count: Configure this many hugepages.
+            hugepage_size: Configure hugepages of this size.
             force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.
         """
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-07 17:44   ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
  2024-05-07 17:44     ` [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
@ 2024-05-07 17:44     ` Nicholas Pratte
  2024-05-07 17:46     ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
  2024-05-13  9:53     ` Juraj Linkeš
  3 siblings, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-07 17:44 UTC (permalink / raw)
  To: probb, bruce.richardson, Honnappa.Nagarahalli, juraj.linkes,
	thomas, jspewock, yoan.picchi, mb, wathsala.vithanage,
	paul.szczepanek
  Cc: dev, Nicholas Pratte

The term 'amount' is used for uncountable nouns. Since total hugepages
is a discrete value (i.e. countable), the declaration of the 'amount'
key value pair should be changes to a different term in both the config
and the rest of the code.

Signed-off-by: Nicholas Pratte  <npratte@iol.unh.edu>
---
 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 | 4 ++--
 dts/framework/testbed_model/node.py          | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dts/conf.yaml b/dts/conf.yaml
index 56c3ae6f4c..44b5e4ec84 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -36,7 +36,7 @@ nodes:
     use_first_core: false # tells DPDK to use any physical core
     memory_channels: 4 # tells DPDK to use 4 memory channels
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        quantity: 256
         force_first_numa: false
     ports:
       # sets up the physical link between "SUT 1"@000:00:08.0 and "TG 1"@0000:00:08.0
@@ -72,7 +72,7 @@ nodes:
         peer_node: "SUT 1"
         peer_pci: "0000:00:08.1"
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        quantity: 256
         force_first_numa: false
     traffic_generator:
         type: SCAPY
diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py
index b6f820e39e..3a617ef599 100644
--- a/dts/framework/config/__init__.py
+++ b/dts/framework/config/__init__.py
@@ -127,11 +127,11 @@ class HugepageConfiguration:
     r"""The hugepage configuration of :class:`~framework.testbed_model.node.Node`\s.
 
     Attributes:
-        amount: The number of hugepages.
+        quantity: The quantity of hugepages.
         force_first_numa: If :data:`True`, the hugepages will be configured on the first NUMA node.
     """
 
-    amount: int
+    quantity: int
     force_first_numa: bool
 
 
diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index f4d7199523..980f7d18a0 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -150,9 +150,9 @@
       "type": "object",
       "description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
       "properties": {
-        "amount": {
+        "quantity": {
           "type": "integer",
-          "description": "The amount of hugepages to configure. Hugepage size will be the system default."
+          "description": "The number of hugepages to configure. Hugepage size will be the system default."
         },
         "force_first_numa": {
           "type": "boolean",
@@ -161,7 +161,7 @@
       },
       "additionalProperties": false,
       "required": [
-        "amount"
+        "quantity"
       ]
     },
     "mac_address": {
diff --git a/dts/framework/config/types.py b/dts/framework/config/types.py
index 016e0c3dbd..57807b0a73 100644
--- a/dts/framework/config/types.py
+++ b/dts/framework/config/types.py
@@ -37,7 +37,7 @@ class HugepageConfigurationDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    amount: int
+    quantity: int
     #:
     force_first_numa: bool
 
diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index d0f7cfa77c..ae7d0ba7d2 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -138,7 +138,7 @@ 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, quantity: int, size: int, force_first_numa: bool) -> None:
         self._logger.info("Configuring Hugepages.")
         hugepage_config_path = f"/sys/kernel/mm/hugepages/hugepages-{size}kB/nr_hugepages"
         if force_first_numa and self._supports_numa():
@@ -149,7 +149,7 @@ def _configure_huge_pages(self, amount: int, size: int, force_first_numa: bool)
                 f"/hugepages-{size}kB/nr_hugepages"
             )
 
-        self.send_command(f"echo {amount} | tee {hugepage_config_path}", privileged=True)
+        self.send_command(f"echo {quantity} | tee {hugepage_config_path}", privileged=True)
 
     def update_ports(self, ports: list[Port]) -> None:
         """Overrides :meth:`~.os_session.OSSession.update_ports`."""
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 3f2a727c3b..512fd01db1 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,7 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount,
+                self.config.hugepages.quantity,
                 self.main_session.hugepage_size,
                 self.config.hugepages.force_first_numa,
             )
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v6 0/2] Methodology change for hugepage configuration
  2024-05-07 17:44   ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
  2024-05-07 17:44     ` [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
  2024-05-07 17:44     ` [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
@ 2024-05-07 17:46     ` Nicholas Pratte
  2024-05-13  9:53     ` Juraj Linkeš
  3 siblings, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-07 17:46 UTC (permalink / raw)
  To: probb, bruce.richardson, Honnappa.Nagarahalli, juraj.linkes,
	thomas, jspewock, yoan.picchi, mb, wathsala.vithanage,
	paul.szczepanek
  Cc: dev

Resending the patch and superseding the old one on patchwork. I
accidentally sent this patch series through some kind of container
instance.

On Tue, May 7, 2024 at 1:44 PM Nicholas Pratte <npratte@iol.unh.edu> wrote:
>
> In order to prevent accidental misconfiguration of hugepages at runtime,
> the following changes are made to only allow for configuration of 2MB
> hugepages within the DTS config.yaml. In the previous implementation, a
> default hugepage size was selected via the size listed in /proc/meminfo.
> The problem with this implementation is that, assuming the end-user has
> made prior modifications to the system, /proc/meminfo may default to
> hugepage sizes that are not recommended to be configured at runtime
> (i.e. 1GB hugepages). This can lead to two problems: overallocation of
> hugepages (which may crash the remote host) configuration of hugepages
> sizes that are not recommended during runtime. In this new implementation,
> we stipulate that any runtime hugepage configuration size that is not 2MB
> is considered an outlier. If the end-user would like to configure either
> 1GB hugepages or any unique hugepage size outside of 2MB, then they should
> make these configurations either at startup (in the case of 1GB hugepages)
> or runtime outside of DTS configuration (if a user would like hugepages
> that are not 2MB). In either case, the expectation is that, if wish to
> use hugepage sizes that are not 2MB, you will make these changes outside
> and prior to the initialization of DTS.
>
> The end-user has two options: remove the option for hugepage
> configuration in the conf.yaml, or keep the option and specify the
> amount of 2MB hugepages desired. In the case of the former, then we assume
> that hugepages are already configured prior to DTS initialization. In
> the latter case, the user must define the amount of 2MB hugepages to be
> configured at runtime. 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 is either greater than or equal to the amount
> already configured on the system, then nothing is done.
>
> Nicholas Pratte (2):
>   dts: Change hugepage runtime config to 2MB Exclusively
>   dts: Change hugepage 'amount' to a different term
>
>  doc/guides/tools/dts.rst                     |  6 ++++-
>  dts/conf.yaml                                |  8 +++---
>  dts/framework/config/__init__.py             |  8 +++---
>  dts/framework/config/conf_yaml_schema.json   | 12 ++++-----
>  dts/framework/config/types.py                |  4 +--
>  dts/framework/testbed_model/linux_session.py | 28 +++++++++++---------
>  dts/framework/testbed_model/node.py          |  4 ++-
>  dts/framework/testbed_model/os_session.py    |  7 ++++-
>  8 files changed, 45 insertions(+), 32 deletions(-)
>
> --
> 2.44.0
>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v6 0/2] Methodology change for hugepage configuration
  2024-05-07 17:44   ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
                       ` (2 preceding siblings ...)
  2024-05-07 17:46     ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
@ 2024-05-13  9:53     ` Juraj Linkeš
  2024-05-15 14:50       ` Nicholas Pratte
  3 siblings, 1 reply; 33+ messages in thread
From: Juraj Linkeš @ 2024-05-13  9:53 UTC (permalink / raw)
  To: Nicholas Pratte
  Cc: probb, bruce.richardson, Honnappa.Nagarahalli, thomas, jspewock,
	yoan.picchi, mb, wathsala.vithanage, paul.szczepanek, dev

What's the difference between this version and v4?

On Tue, May 7, 2024 at 7:44 PM Nicholas Pratte <npratte@iol.unh.edu> wrote:
>
> In order to prevent accidental misconfiguration of hugepages at runtime,
> the following changes are made to only allow for configuration of 2MB
> hugepages within the DTS config.yaml. In the previous implementation, a
> default hugepage size was selected via the size listed in /proc/meminfo.
> The problem with this implementation is that, assuming the end-user has
> made prior modifications to the system, /proc/meminfo may default to
> hugepage sizes that are not recommended to be configured at runtime
> (i.e. 1GB hugepages). This can lead to two problems: overallocation of
> hugepages (which may crash the remote host) configuration of hugepages
> sizes that are not recommended during runtime. In this new implementation,
> we stipulate that any runtime hugepage configuration size that is not 2MB
> is considered an outlier. If the end-user would like to configure either
> 1GB hugepages or any unique hugepage size outside of 2MB, then they should
> make these configurations either at startup (in the case of 1GB hugepages)
> or runtime outside of DTS configuration (if a user would like hugepages
> that are not 2MB). In either case, the expectation is that, if wish to
> use hugepage sizes that are not 2MB, you will make these changes outside
> and prior to the initialization of DTS.
>
> The end-user has two options: remove the option for hugepage
> configuration in the conf.yaml, or keep the option and specify the
> amount of 2MB hugepages desired. In the case of the former, then we assume
> that hugepages are already configured prior to DTS initialization. In
> the latter case, the user must define the amount of 2MB hugepages to be
> configured at runtime. 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 is either greater than or equal to the amount
> already configured on the system, then nothing is done.
>
> Nicholas Pratte (2):
>   dts: Change hugepage runtime config to 2MB Exclusively
>   dts: Change hugepage 'amount' to a different term
>
>  doc/guides/tools/dts.rst                     |  6 ++++-
>  dts/conf.yaml                                |  8 +++---
>  dts/framework/config/__init__.py             |  8 +++---
>  dts/framework/config/conf_yaml_schema.json   | 12 ++++-----
>  dts/framework/config/types.py                |  4 +--
>  dts/framework/testbed_model/linux_session.py | 28 +++++++++++---------
>  dts/framework/testbed_model/node.py          |  4 ++-
>  dts/framework/testbed_model/os_session.py    |  7 ++++-
>  8 files changed, 45 insertions(+), 32 deletions(-)
>
> --
> 2.44.0
>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-07 13:00       ` Bruce Richardson
@ 2024-05-13 10:06         ` Juraj Linkeš
  2024-05-15 15:12           ` Nicholas Pratte
  0 siblings, 1 reply; 33+ messages in thread
From: Juraj Linkeš @ 2024-05-13 10:06 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Luca Vizzarro, Nicholas Pratte, yoan.picchi, paul.szczepanek,
	wathsala.vithanage, thomas, Honnappa.Nagarahalli, probb, dev

On Tue, May 7, 2024 at 3:00 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Tue, May 07, 2024 at 01:43:30PM +0100, Luca Vizzarro wrote:
> > On 07/05/2024 13:05, Bruce Richardson wrote:
> > > Sorry to be late to the reviews here, but since this is a countable value -
> > > as you state in the cover letter- would "number" or "count" not be better
> > > terms. To me, "quantity" is just a synonym of "amount", and can be used for
> > > uncountable values too, e.g. "a quantity of water".
> >
> >
> > Hi Bruce,
> >
> > The change is based on the readability and intuitiveness of the
> > configuration file. In which case "number" could be ambiguous:
> >
> >   hugepages_2mb:
> >     number: 100
> >
> > And here I could see "count" working:
> >
> >   hugepages_2mb:
> >     count: 100
> >

We could use number_of: but that doesn't look great. Count looks fine.

> > But since the change is propagated for consistency. "count" would no longer
> > be well fitting in the rest:
> >
> >      "description": "The count of hugepages to configure. Hugepage
> >                      size will be the system default."
> >
> Whatever term is actually used, the description should definitely refer to
> "The number of hugepages to configure".

This makes sense, let's use "number of" in descriptions.

Ideally we'd also use number in code, but it's a bit ambiguous, such as here:
def _configure_huge_pages(self, number: int, size: int,
force_first_numa: bool) -> None:

At a first glance it's not quite clear what "number" is here.
"number_of" would be pretty clear, but so would be "count". But using
count would mean we're using different words with the same meaning in
the same context, which I'd also like to avoid - this is the reason
why I was originally ok with quantity. Now I'm not sure what the best
option is :-)

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v6 0/2] Methodology change for hugepage configuration
  2024-05-13  9:53     ` Juraj Linkeš
@ 2024-05-15 14:50       ` Nicholas Pratte
  2024-05-29 10:30         ` Juraj Linkeš
  0 siblings, 1 reply; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-15 14:50 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: probb, bruce.richardson, Honnappa.Nagarahalli, thomas, jspewock,
	yoan.picchi, mb, wathsala.vithanage, paul.szczepanek, dev

>What's the difference between this version and v4?

Version 5 was a response to your suggestions regarding the semantics
of the hugepage variable names as it relates to countable or
uncountable nouns. This patch, which was originally just a single
patch, was expanded into a patch series since the variable changes
suggested are sort of logically independent of the original patch;
there were talks about potentially making this a separate patch
entirely, but we agreed that a patch series for this change is
appropriate.

But, to answer a question that I think you are indirectly asking, I
ran into some issues when sending out the latest version of this
patch. While the latest version of this patch, version 6, was sent
last week and does show up on patchwork, it seems like the emails
never reached the mailing list for some (I just asked Patrick in the
office and he cannot seem to find them).

>      "type": "object",
>       "description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
>       "properties": {
>-        "amount": {
>+        "quantity": {
>           "type": "integer",
>-          "description": "The amount of hugepages to configure. Hugepage size will be the system default."
>+          "description": "The number of hugepages to configure. Hugepage size will be the system default."
>         },
>         "force_first_numa": {
>           "type": "boolean",

The only change that version 6 made is in reference to the suggestion
that Bruce made in a separate thread; I changed the description text
from "amount of" to "number of."

Hopefully this answers your question. Again, I ran into some issues
sending the latest version out for this patch

On Mon, May 13, 2024 at 5:53 AM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
>
> What's the difference between this version and v4?
>
> On Tue, May 7, 2024 at 7:44 PM Nicholas Pratte <npratte@iol.unh.edu> wrote:
> >
> > In order to prevent accidental misconfiguration of hugepages at runtime,
> > the following changes are made to only allow for configuration of 2MB
> > hugepages within the DTS config.yaml. In the previous implementation, a
> > default hugepage size was selected via the size listed in /proc/meminfo.
> > The problem with this implementation is that, assuming the end-user has
> > made prior modifications to the system, /proc/meminfo may default to
> > hugepage sizes that are not recommended to be configured at runtime
> > (i.e. 1GB hugepages). This can lead to two problems: overallocation of
> > hugepages (which may crash the remote host) configuration of hugepages
> > sizes that are not recommended during runtime. In this new implementation,
> > we stipulate that any runtime hugepage configuration size that is not 2MB
> > is considered an outlier. If the end-user would like to configure either
> > 1GB hugepages or any unique hugepage size outside of 2MB, then they should
> > make these configurations either at startup (in the case of 1GB hugepages)
> > or runtime outside of DTS configuration (if a user would like hugepages
> > that are not 2MB). In either case, the expectation is that, if wish to
> > use hugepage sizes that are not 2MB, you will make these changes outside
> > and prior to the initialization of DTS.
> >
> > The end-user has two options: remove the option for hugepage
> > configuration in the conf.yaml, or keep the option and specify the
> > amount of 2MB hugepages desired. In the case of the former, then we assume
> > that hugepages are already configured prior to DTS initialization. In
> > the latter case, the user must define the amount of 2MB hugepages to be
> > configured at runtime. 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 is either greater than or equal to the amount
> > already configured on the system, then nothing is done.
> >
> > Nicholas Pratte (2):
> >   dts: Change hugepage runtime config to 2MB Exclusively
> >   dts: Change hugepage 'amount' to a different term
> >
> >  doc/guides/tools/dts.rst                     |  6 ++++-
> >  dts/conf.yaml                                |  8 +++---
> >  dts/framework/config/__init__.py             |  8 +++---
> >  dts/framework/config/conf_yaml_schema.json   | 12 ++++-----
> >  dts/framework/config/types.py                |  4 +--
> >  dts/framework/testbed_model/linux_session.py | 28 +++++++++++---------
> >  dts/framework/testbed_model/node.py          |  4 ++-
> >  dts/framework/testbed_model/os_session.py    |  7 ++++-
> >  8 files changed, 45 insertions(+), 32 deletions(-)
> >
> > --
> > 2.44.0
> >

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-13 10:06         ` Juraj Linkeš
@ 2024-05-15 15:12           ` Nicholas Pratte
  0 siblings, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-15 15:12 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: Bruce Richardson, Luca Vizzarro, yoan.picchi, paul.szczepanek,
	wathsala.vithanage, thomas, Honnappa.Nagarahalli, probb, dev

On Mon, May 13, 2024 at 6:06 AM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
>
> On Tue, May 7, 2024 at 3:00 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > On Tue, May 07, 2024 at 01:43:30PM +0100, Luca Vizzarro wrote:
> > > On 07/05/2024 13:05, Bruce Richardson wrote:
> > > > Sorry to be late to the reviews here, but since this is a countable value -
> > > > as you state in the cover letter- would "number" or "count" not be better
> > > > terms. To me, "quantity" is just a synonym of "amount", and can be used for
> > > > uncountable values too, e.g. "a quantity of water".
> > >
> > >
> > > Hi Bruce,
> > >
> > > The change is based on the readability and intuitiveness of the
> > > configuration file. In which case "number" could be ambiguous:
> > >
> > >   hugepages_2mb:
> > >     number: 100
> > >
> > > And here I could see "count" working:
> > >
> > >   hugepages_2mb:
> > >     count: 100
> > >
>
> We could use number_of: but that doesn't look great. Count looks fine.

I personally think that number_of is the better option of the two.
Count does work, but to me, it's not as immediately clear as
number_of; syntactically, it makes more sense.

>
> > > But since the change is propagated for consistency. "count" would no longer
> > > be well fitting in the rest:
> > >
> > >      "description": "The count of hugepages to configure. Hugepage
> > >                      size will be the system default."
> > >
> > Whatever term is actually used, the description should definitely refer to
> > "The number of hugepages to configure".
>
> This makes sense, let's use "number of" in descriptions.

I will make the change as requested.

>
> Ideally we'd also use number in code, but it's a bit ambiguous, such as here:
> def _configure_huge_pages(self, number: int, size: int,
> force_first_numa: bool) -> None:
>
> At a first glance it's not quite clear what "number" is here.
> "number_of" would be pretty clear, but so would be "count". But using
> count would mean we're using different words with the same meaning in
> the same context, which I'd also like to avoid - this is the reason
> why I was originally ok with quantity. Now I'm not sure what the best
> option is :-)

Now that you mention it, and given Bruce's comments regarding the use
of quantity, I really like the use of number_of throughout the
framework and even the conf.yaml. Doing so will create consistency in
both the framework's internal documentation (like the 'number of'
suggestion above) and the code, removing the ambiguity that you
mentioned in some of the definitions.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v6 0/2] Methodology change for hugepage configuration
  2024-05-15 14:50       ` Nicholas Pratte
@ 2024-05-29 10:30         ` Juraj Linkeš
  0 siblings, 0 replies; 33+ messages in thread
From: Juraj Linkeš @ 2024-05-29 10:30 UTC (permalink / raw)
  To: Nicholas Pratte
  Cc: probb, bruce.richardson, Honnappa.Nagarahalli, thomas, jspewock,
	yoan.picchi, mb, wathsala.vithanage, paul.szczepanek, dev

On Wed, May 15, 2024 at 4:50 PM Nicholas Pratte <npratte@iol.unh.edu> wrote:
>
> >What's the difference between this version and v4?
>
> Version 5 was a response to your suggestions regarding the semantics
> of the hugepage variable names as it relates to countable or
> uncountable nouns. This patch, which was originally just a single
> patch, was expanded into a patch series since the variable changes
> suggested are sort of logically independent of the original patch;
> there were talks about potentially making this a separate patch
> entirely, but we agreed that a patch series for this change is
> appropriate.
>

Ah, ok. There were a lot of patches so that confused me.

> But, to answer a question that I think you are indirectly asking, I
> ran into some issues when sending out the latest version of this
> patch. While the latest version of this patch, version 6, was sent
> last week and does show up on patchwork, it seems like the emails
> never reached the mailing list for some (I just asked Patrick in the
> office and he cannot seem to find them).
>
> >      "type": "object",
> >       "description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
> >       "properties": {
> >-        "amount": {
> >+        "quantity": {
> >           "type": "integer",
> >-          "description": "The amount of hugepages to configure. Hugepage size will be the system default."
> >+          "description": "The number of hugepages to configure. Hugepage size will be the system default."
> >         },
> >         "force_first_numa": {
> >           "type": "boolean",
>
> The only change that version 6 made is in reference to the suggestion
> that Bruce made in a separate thread; I changed the description text
> from "amount of" to "number of."
>

As you mentioned in the other thread, I also like changing it in all
instances (in code and conf.yaml).

> Hopefully this answers your question. Again, I ran into some issues
> sending the latest version out for this patch
>
> On Mon, May 13, 2024 at 5:53 AM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
> >
> > What's the difference between this version and v4?
> >
> > On Tue, May 7, 2024 at 7:44 PM Nicholas Pratte <npratte@iol.unh.edu> wrote:
> > >
> > > In order to prevent accidental misconfiguration of hugepages at runtime,
> > > the following changes are made to only allow for configuration of 2MB
> > > hugepages within the DTS config.yaml. In the previous implementation, a
> > > default hugepage size was selected via the size listed in /proc/meminfo.
> > > The problem with this implementation is that, assuming the end-user has
> > > made prior modifications to the system, /proc/meminfo may default to
> > > hugepage sizes that are not recommended to be configured at runtime
> > > (i.e. 1GB hugepages). This can lead to two problems: overallocation of
> > > hugepages (which may crash the remote host) configuration of hugepages
> > > sizes that are not recommended during runtime. In this new implementation,
> > > we stipulate that any runtime hugepage configuration size that is not 2MB
> > > is considered an outlier. If the end-user would like to configure either
> > > 1GB hugepages or any unique hugepage size outside of 2MB, then they should
> > > make these configurations either at startup (in the case of 1GB hugepages)
> > > or runtime outside of DTS configuration (if a user would like hugepages
> > > that are not 2MB). In either case, the expectation is that, if wish to
> > > use hugepage sizes that are not 2MB, you will make these changes outside
> > > and prior to the initialization of DTS.
> > >
> > > The end-user has two options: remove the option for hugepage
> > > configuration in the conf.yaml, or keep the option and specify the
> > > amount of 2MB hugepages desired. In the case of the former, then we assume
> > > that hugepages are already configured prior to DTS initialization. In
> > > the latter case, the user must define the amount of 2MB hugepages to be
> > > configured at runtime. 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 is either greater than or equal to the amount
> > > already configured on the system, then nothing is done.
> > >
> > > Nicholas Pratte (2):
> > >   dts: Change hugepage runtime config to 2MB Exclusively
> > >   dts: Change hugepage 'amount' to a different term
> > >
> > >  doc/guides/tools/dts.rst                     |  6 ++++-
> > >  dts/conf.yaml                                |  8 +++---
> > >  dts/framework/config/__init__.py             |  8 +++---
> > >  dts/framework/config/conf_yaml_schema.json   | 12 ++++-----
> > >  dts/framework/config/types.py                |  4 +--
> > >  dts/framework/testbed_model/linux_session.py | 28 +++++++++++---------
> > >  dts/framework/testbed_model/node.py          |  4 ++-
> > >  dts/framework/testbed_model/os_session.py    |  7 ++++-
> > >  8 files changed, 45 insertions(+), 32 deletions(-)
> > >
> > > --
> > > 2.44.0
> > >

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v7 0/2] Methodology change for hugepage configuration
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
                     ` (2 preceding siblings ...)
  2024-05-07 17:44   ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
@ 2024-05-30 17:58   ` Nicholas Pratte
  2024-05-30 17:58     ` [PATCH v7 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
  2024-05-30 17:58     ` [PATCH v7 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  2024-05-30 18:37   ` [PATCH v8 0/2] Methodology change for hugepage configuration Nicholas Pratte
  2024-05-30 19:37   ` Nicholas Pratte
  5 siblings, 2 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-30 17:58 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, jspewock, paul.szczepanek,
	bruce.richardson, yoan.picchi, probb, luca.vizzarro,
	juraj.linkes
  Cc: dev, Nicholas Pratte

In order to prevent accidental misconfiguration of hugepages at runtime,
the following changes are made to only allow for configuration of 2MB
hugepages within the DTS config.yaml. In the previous implementation, a
default hugepage size was selected via the size listed in /proc/meminfo.
The problem with this implementation is that, assuming the end-user has
made prior modifications to the system, /proc/meminfo may default to
hugepage sizes that are not recommended to be configured at runtime
(i.e. 1GB hugepages). This can lead to two problems: overallocation of
hugepages (which may crash the remote host) configuration of hugepages
sizes that are not recommended during runtime. In this new implementation,
we stipulate that any runtime hugepage configuration size that is not 2MB
is considered an outlier. If the end-user would like to configure either
1GB hugepages or any unique hugepage size outside of 2MB, then they should
make these configurations either at startup (in the case of 1GB hugepages)
or runtime outside of DTS configuration (if a user would like hugepages
that are not 2MB). In either case, the expectation is that, if wish to
use hugepage sizes that are not 2MB, you will make these changes outside
and prior to the initialization of DTS.

The end-user has two options: remove the option for hugepage
configuration in the conf.yaml, or keep the option and specify the
amount of 2MB hugepages desired. In the case of the former, then we assume
that hugepages are already configured prior to DTS initialization. In
the latter case, the user must define the amount of 2MB hugepages to be
configured at runtime. 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 is either greater than or equal to the amount
already configured on the system, then nothing is done.

Nicholas Pratte (2):
  dts: Change hugepage runtime config to 2MB Exclusively
  dts: Change hugepage 'amount' to a different term

 doc/guides/tools/dts.rst                     | 14 +++++----
 dts/conf.yaml                                |  8 +++---
 dts/framework/config/__init__.py             |  8 +++---
 dts/framework/config/conf_yaml_schema.json   | 12 ++++----
 dts/framework/config/types.py                |  4 +--
 dts/framework/testbed_model/linux_session.py | 30 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 ++-
 dts/framework/testbed_model/os_session.py    | 11 +++++--
 8 files changed, 52 insertions(+), 39 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v7 1/2] dts: Change hugepage runtime config to 2MB Exclusively
  2024-05-30 17:58   ` [PATCH v7 " Nicholas Pratte
@ 2024-05-30 17:58     ` Nicholas Pratte
  2024-05-30 17:58     ` [PATCH v7 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  1 sibling, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-30 17:58 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, jspewock, paul.szczepanek,
	bruce.richardson, yoan.picchi, probb, luca.vizzarro,
	juraj.linkes
  Cc: dev, Nicholas Pratte

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 hugepage
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 is
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 <npratte@iol.unh.edu>
Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
v8:
 * Some areas of the dts.rst needed to be rewritten to reflect the
 * changes "hugepages" attribute in the conf-yaml. These areas were
 * fixed

v4:
 * dts.rst punctuation/grammar corrections and 2mb exclusivity
   justifications included in documentation

changes made to documentation for hugepages
---
 doc/guides/tools/dts.rst                     | 14 ++++++++----
 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 | 24 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 +++-
 dts/framework/testbed_model/os_session.py    |  7 +++++-
 8 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst
index 47b218b2c6..6e6a7e1f73 100644
--- a/doc/guides/tools/dts.rst
+++ b/doc/guides/tools/dts.rst
@@ -131,7 +131,11 @@ There are two areas that need to be set up on a System Under Test:
 
      You may specify the optional hugepage configuration in the DTS config file.
      If you do, DTS will take care of configuring hugepages,
-     overwriting your current SUT hugepage configuration.
+     overwriting your current SUT hugepage configuration. Configuration of hugepages via DTS
+     allows only for allocation of 2MB hugepages, as doing so prevents accidental/over
+     allocation of hugepage sizes not recommended during runtime due to
+     contiguous memory space requirements. Thus, if you require hugepage
+     sizes not equal to 2MB, then this configuration must be done outside of the DTS framework.
 
    * System under test configuration
 
@@ -453,11 +457,11 @@ _`Build target`
                         **Example**: ``ccache``
    ==================== =================================================================
 
-_`hugepages`
-   *mapping* – hugepages described as:
+_`hugepages_2mb`
+   *mapping* – hugepages_2mb described as:
 
    ==================== ================================================================
-   ``amount``           *integer* – The amount of hugepages to configure.
+   ``number_of``        *integer* – The number of 2MB hugepages to configure.
 
                         Hugepage size will be the system default.
    ``force_first_numa`` (*optional*, defaults to ``false``) – If ``true``, it forces the
@@ -570,7 +574,7 @@ involved in the testing. These can be defined with the following mappings:
    |                       |                                                                                       |
    |                       | The number of the memory channels to use.                                             |
    +-----------------------+---------------------------------------------------------------------------------------+
-   | ``hugepages``         | (*optional*) See `hugepages`_. If unset, hugepages won't be configured                |
+   | ``hugepages_2mb``     | (*optional*) See `hugepages`_. If unset, 2MB hugepages won't be configured            |
    |                       |                                                                                       |
    |                       | in favour of the system configuration.                                                |
    +-----------------------+---------------------------------------------------------------------------------------+
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 = None
-        if "hugepages" in d:
-            hugepage_config_dict = d["hugepages"]
+        if "hugepages_2mb" in d:
+            hugepage_config_dict = d["hugepages_2mb"]
             if "force_first_numa" not in hugepage_config_dict:
                 hugepage_config_dict["force_first_numa"] = False
             hugepage_config = HugepageConfiguration(**hugepage_config_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 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, 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..d0f7cfa77c 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
@@ -84,14 +84,20 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """Overrides :meth:`~.os_session.OSSession.get_dpdk_file_prefix`."""
         return dpdk_prefix
 
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: 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()
-        hugepages_total = self._get_hugepages_total()
+        hugepages_total = self._get_hugepages_total(hugepage_size)
+        if (
+            f"hugepages-{hugepage_size}kB"
+            not in self.send_command("ls /sys/kernel/mm/hugepages").stdout
+        ):
+            raise ConfigurationError("hugepage size not supported by operating system")
         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)
@@ -99,13 +105,9 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
             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:
+    def _get_hugepages_total(self, hugepage_size: int) -> int:
         hugepages_total = self.send_command(
-            "awk '/HugePages_Total/ { print $2 }' /proc/meminfo"
+            f"cat /sys/kernel/mm/hugepages/hugepages-{hugepage_size}kB/nr_hugepages"
         ).stdout
         return int(hugepages_total)
 
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 74061f6262..3f2a727c3b 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,9 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount, self.config.hugepages.force_first_numa
+                self.config.hugepages.amount,
+                self.main_session.hugepage_size,
+                self.config.hugepages.force_first_numa,
             )
 
     def configure_port_state(self, port: Port, enable: bool = True) -> None:
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index d5bf7e0401..19dcf5f963 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -64,6 +64,7 @@ class OSSession(ABC):
     _logger: DTSLogger
     remote_session: RemoteSession
     interactive_session: InteractiveRemoteSession
+    hugepage_size: int
 
     def __init__(
         self,
@@ -80,6 +81,7 @@ def __init__(
             name: The name of the session.
             logger: The logger instance this session will use.
         """
+        self.hugepage_size = 2048
         self._config = node_config
         self.name = name
         self._logger = logger
@@ -345,7 +347,9 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """
 
     @abstractmethod
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+    ) -> None:
         """Configure hugepages on the node.
 
         Get the node's Hugepage Size, configure the specified count of hugepages
@@ -353,6 +357,7 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
 
         Args:
             hugepage_count: Configure this many hugepages.
+            hugepage_size: Configure hugepages of this size.
             force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.
         """
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v7 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-30 17:58   ` [PATCH v7 " Nicholas Pratte
  2024-05-30 17:58     ` [PATCH v7 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
@ 2024-05-30 17:58     ` Nicholas Pratte
  1 sibling, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-30 17:58 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, jspewock, paul.szczepanek,
	bruce.richardson, yoan.picchi, probb, luca.vizzarro,
	juraj.linkes
  Cc: dev, Nicholas Pratte

The term 'amount' is used for uncountable nouns. Since total hugepages
is a discrete value (i.e. countable), the declaration of the 'amount'
key value pair should be changes to a different term in both the config
and the rest of the code.
---
 * v8: Decided on a variable name "number_of" to be used throughout the
 * configuration.

---
 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 | 10 +++++-----
 dts/framework/testbed_model/node.py          |  2 +-
 dts/framework/testbed_model/os_session.py    |  6 +++---
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dts/conf.yaml b/dts/conf.yaml
index 56c3ae6f4c..ce475776a7 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -36,7 +36,7 @@ nodes:
     use_first_core: false # tells DPDK to use any physical core
     memory_channels: 4 # tells DPDK to use 4 memory channels
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        number_of: 256
         force_first_numa: false
     ports:
       # sets up the physical link between "SUT 1"@000:00:08.0 and "TG 1"@0000:00:08.0
@@ -72,7 +72,7 @@ nodes:
         peer_node: "SUT 1"
         peer_pci: "0000:00:08.1"
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        number_of: 256
         force_first_numa: false
     traffic_generator:
         type: SCAPY
diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py
index b6f820e39e..81dd321b18 100644
--- a/dts/framework/config/__init__.py
+++ b/dts/framework/config/__init__.py
@@ -127,11 +127,11 @@ class HugepageConfiguration:
     r"""The hugepage configuration of :class:`~framework.testbed_model.node.Node`\s.
 
     Attributes:
-        amount: The number of hugepages.
+        number_of: The number of hugepages to allocate.
         force_first_numa: If :data:`True`, the hugepages will be configured on the first NUMA node.
     """
 
-    amount: int
+    number_of: int
     force_first_numa: bool
 
 
diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index f4d7199523..71c893662a 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -150,9 +150,9 @@
       "type": "object",
       "description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
       "properties": {
-        "amount": {
+        "number_of": {
           "type": "integer",
-          "description": "The amount of hugepages to configure. Hugepage size will be the system default."
+          "description": "The number of hugepages to configure. Hugepage size will be the system default."
         },
         "force_first_numa": {
           "type": "boolean",
@@ -161,7 +161,7 @@
       },
       "additionalProperties": false,
       "required": [
-        "amount"
+        "number_of"
       ]
     },
     "mac_address": {
diff --git a/dts/framework/config/types.py b/dts/framework/config/types.py
index 016e0c3dbd..5c9d659901 100644
--- a/dts/framework/config/types.py
+++ b/dts/framework/config/types.py
@@ -37,7 +37,7 @@ class HugepageConfigurationDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    amount: int
+    number_of: int
     #:
     force_first_numa: bool
 
diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index d0f7cfa77c..6a09d0e69a 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -85,7 +85,7 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         return dpdk_prefix
 
     def setup_hugepages(
-        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+        self, number_of: int, hugepage_size: int, force_first_numa: bool
     ) -> None:
         """Overrides :meth:`~.os_session.OSSession.setup_hugepages`."""
         self._logger.info("Getting Hugepage information.")
@@ -97,10 +97,10 @@ def setup_hugepages(
             raise ConfigurationError("hugepage size not supported by operating system")
         self._numa_nodes = self._get_numa_nodes()
 
-        if force_first_numa or hugepages_total < hugepage_count:
+        if force_first_numa or hugepages_total < number_of:
             # 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(number_of, hugepage_size, force_first_numa)
         else:
             self._logger.info("Hugepages already configured.")
         self._mount_huge_pages()
@@ -138,7 +138,7 @@ 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, number_of: int, size: int, force_first_numa: bool) -> None:
         self._logger.info("Configuring Hugepages.")
         hugepage_config_path = f"/sys/kernel/mm/hugepages/hugepages-{size}kB/nr_hugepages"
         if force_first_numa and self._supports_numa():
@@ -149,7 +149,7 @@ def _configure_huge_pages(self, amount: int, size: int, force_first_numa: bool)
                 f"/hugepages-{size}kB/nr_hugepages"
             )
 
-        self.send_command(f"echo {amount} | tee {hugepage_config_path}", privileged=True)
+        self.send_command(f"echo {number_of} | tee {hugepage_config_path}", privileged=True)
 
     def update_ports(self, ports: list[Port]) -> None:
         """Overrides :meth:`~.os_session.OSSession.update_ports`."""
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 3f2a727c3b..6818a057d0 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,7 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount,
+                self.config.hugepages.number_of,
                 self.main_session.hugepage_size,
                 self.config.hugepages.force_first_numa,
             )
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index 19dcf5f963..1f23f5524f 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -348,7 +348,7 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
 
     @abstractmethod
     def setup_hugepages(
-        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+        self, number_of: int, hugepage_size: int, force_first_numa: bool
     ) -> None:
         """Configure hugepages on the node.
 
@@ -356,9 +356,9 @@ def setup_hugepages(
         if needed and mount the hugepages if needed.
 
         Args:
-            hugepage_count: Configure this many hugepages.
+            number_of: Configure this many hugepages.
             hugepage_size: Configure hugepages of this size.
-            force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.
+            force_first_numa:  If :data:`True`, configure just on the first numa node.
         """
 
     @abstractmethod
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v8 0/2] Methodology change for hugepage configuration
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
                     ` (3 preceding siblings ...)
  2024-05-30 17:58   ` [PATCH v7 " Nicholas Pratte
@ 2024-05-30 18:37   ` Nicholas Pratte
  2024-05-30 19:37   ` Nicholas Pratte
  5 siblings, 0 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-30 18:37 UTC (permalink / raw)
  To: npratte; +Cc: dev

In order to prevent accidental misconfiguration of hugepages at runtime,
the following changes are made to only allow for configuration of 2MB
hugepages within the DTS config.yaml. In the previous implementation, a
default hugepage size was selected via the size listed in /proc/meminfo.
The problem with this implementation is that, assuming the end-user has
made prior modifications to the system, /proc/meminfo may default to
hugepage sizes that are not recommended to be configured at runtime
(i.e. 1GB hugepages). This can lead to two problems: overallocation of
hugepages (which may crash the remote host) configuration of hugepages
sizes that are not recommended during runtime. In this new implementation,
we stipulate that any runtime hugepage configuration size that is not 2MB
is considered an outlier. If the end-user would like to configure either
1GB hugepages or any unique hugepage size outside of 2MB, then they should
make these configurations either at startup (in the case of 1GB hugepages)
or runtime outside of DTS configuration (if a user would like hugepages
that are not 2MB). In either case, the expectation is that, if wish to
use hugepage sizes that are not 2MB, you will make these changes outside
and prior to the initialization of DTS.

The end-user has two options: remove the option for hugepage
configuration in the conf.yaml, or keep the option and specify the
amount of 2MB hugepages desired. In the case of the former, then we assume
that hugepages are already configured prior to DTS initialization. In
the latter case, the user must define the amount of 2MB hugepages to be
configured at runtime. 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 is either greater than or equal to the amount
already configured on the system, then nothing is done.

Nicholas Pratte (2):
  dts: Change hugepage runtime config to 2MB Exclusively
  dts: Change hugepage 'amount' to a different term

 doc/guides/tools/dts.rst                     | 14 +++++----
 dts/conf.yaml                                |  8 +++---
 dts/framework/config/__init__.py             |  8 +++---
 dts/framework/config/conf_yaml_schema.json   | 12 ++++----
 dts/framework/config/types.py                |  4 +--
 dts/framework/testbed_model/linux_session.py | 30 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 ++-
 dts/framework/testbed_model/os_session.py    | 11 +++++--
 8 files changed, 52 insertions(+), 39 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v8 0/2] Methodology change for hugepage configuration
  2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
                     ` (4 preceding siblings ...)
  2024-05-30 18:37   ` [PATCH v8 0/2] Methodology change for hugepage configuration Nicholas Pratte
@ 2024-05-30 19:37   ` Nicholas Pratte
  2024-05-30 19:37     ` [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
  2024-05-30 19:38     ` [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  5 siblings, 2 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-30 19:37 UTC (permalink / raw)
  To: luca.vizzarro, juraj.linkes, jspewock, paul.szczepanek,
	bruce.richardson, Honnappa.Nagarahalli, yoan.picchi, probb
  Cc: dev, Nicholas Pratte

In order to prevent accidental misconfiguration of hugepages at runtime,
the following changes are made to only allow for configuration of 2MB
hugepages within the DTS config.yaml. In the previous implementation, a
default hugepage size was selected via the size listed in /proc/meminfo.
The problem with this implementation is that, assuming the end-user has
made prior modifications to the system, /proc/meminfo may default to
hugepage sizes that are not recommended to be configured at runtime
(i.e. 1GB hugepages). This can lead to two problems: overallocation of
hugepages (which may crash the remote host) configuration of hugepages
sizes that are not recommended during runtime. In this new implementation,
we stipulate that any runtime hugepage configuration size that is not 2MB
is considered an outlier. If the end-user would like to configure either
1GB hugepages or any unique hugepage size outside of 2MB, then they should
make these configurations either at startup (in the case of 1GB hugepages)
or runtime outside of DTS configuration (if a user would like hugepages
that are not 2MB). In either case, the expectation is that, if wish to
use hugepage sizes that are not 2MB, you will make these changes outside
and prior to the initialization of DTS.

The end-user has two options: remove the option for hugepage
configuration in the conf.yaml, or keep the option and specify the
amount of 2MB hugepages desired. In the case of the former, then we assume
that hugepages are already configured prior to DTS initialization. In
the latter case, the user must define the amount of 2MB hugepages to be
configured at runtime. 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 is either greater than or equal to the amount
already configured on the system, then nothing is done.

Nicholas Pratte (2):
  dts: Change hugepage runtime config to 2MB Exclusively
  dts: Change hugepage 'amount' to a different term

 doc/guides/tools/dts.rst                     | 14 +++++----
 dts/conf.yaml                                |  8 +++---
 dts/framework/config/__init__.py             |  8 +++---
 dts/framework/config/conf_yaml_schema.json   | 12 ++++----
 dts/framework/config/types.py                |  4 +--
 dts/framework/testbed_model/linux_session.py | 30 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 ++-
 dts/framework/testbed_model/os_session.py    | 11 +++++--
 8 files changed, 52 insertions(+), 39 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively
  2024-05-30 19:37   ` Nicholas Pratte
@ 2024-05-30 19:37     ` Nicholas Pratte
  2024-05-31  6:52       ` Juraj Linkeš
  2024-05-31 11:37       ` Luca Vizzarro
  2024-05-30 19:38     ` [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  1 sibling, 2 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-30 19:37 UTC (permalink / raw)
  To: luca.vizzarro, juraj.linkes, jspewock, paul.szczepanek,
	bruce.richardson, Honnappa.Nagarahalli, yoan.picchi, probb
  Cc: dev, Nicholas Pratte

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 hugepage
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 is
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 <npratte@iol.unh.edu>
Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
v7:
 * Some areas of the dts.rst needed to be rewritten to reflect the
 * changes "hugepages" attribute in the conf-yaml. These areas were
 * fixed

v4:
 * dts.rst punctuation/grammar corrections and 2mb exclusivity
   justifications included in documentation

changes made to documentation for hugepages
---
 doc/guides/tools/dts.rst                     | 14 ++++++++----
 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 | 24 +++++++++++---------
 dts/framework/testbed_model/node.py          |  4 +++-
 dts/framework/testbed_model/os_session.py    |  7 +++++-
 8 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst
index 47b218b2c6..6e6a7e1f73 100644
--- a/doc/guides/tools/dts.rst
+++ b/doc/guides/tools/dts.rst
@@ -131,7 +131,11 @@ There are two areas that need to be set up on a System Under Test:
 
      You may specify the optional hugepage configuration in the DTS config file.
      If you do, DTS will take care of configuring hugepages,
-     overwriting your current SUT hugepage configuration.
+     overwriting your current SUT hugepage configuration. Configuration of hugepages via DTS
+     allows only for allocation of 2MB hugepages, as doing so prevents accidental/over
+     allocation of hugepage sizes not recommended during runtime due to
+     contiguous memory space requirements. Thus, if you require hugepage
+     sizes not equal to 2MB, then this configuration must be done outside of the DTS framework.
 
    * System under test configuration
 
@@ -453,11 +457,11 @@ _`Build target`
                         **Example**: ``ccache``
    ==================== =================================================================
 
-_`hugepages`
-   *mapping* – hugepages described as:
+_`hugepages_2mb`
+   *mapping* – hugepages_2mb described as:
 
    ==================== ================================================================
-   ``amount``           *integer* – The amount of hugepages to configure.
+   ``number_of``        *integer* – The number of 2MB hugepages to configure.
 
                         Hugepage size will be the system default.
    ``force_first_numa`` (*optional*, defaults to ``false``) – If ``true``, it forces the
@@ -570,7 +574,7 @@ involved in the testing. These can be defined with the following mappings:
    |                       |                                                                                       |
    |                       | The number of the memory channels to use.                                             |
    +-----------------------+---------------------------------------------------------------------------------------+
-   | ``hugepages``         | (*optional*) See `hugepages`_. If unset, hugepages won't be configured                |
+   | ``hugepages_2mb``     | (*optional*) See `hugepages`_. If unset, 2MB hugepages won't be configured            |
    |                       |                                                                                       |
    |                       | in favour of the system configuration.                                                |
    +-----------------------+---------------------------------------------------------------------------------------+
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 = None
-        if "hugepages" in d:
-            hugepage_config_dict = d["hugepages"]
+        if "hugepages_2mb" in d:
+            hugepage_config_dict = d["hugepages_2mb"]
             if "force_first_numa" not in hugepage_config_dict:
                 hugepage_config_dict["force_first_numa"] = False
             hugepage_config = HugepageConfiguration(**hugepage_config_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 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, 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..d0f7cfa77c 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
@@ -84,14 +84,20 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """Overrides :meth:`~.os_session.OSSession.get_dpdk_file_prefix`."""
         return dpdk_prefix
 
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: 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()
-        hugepages_total = self._get_hugepages_total()
+        hugepages_total = self._get_hugepages_total(hugepage_size)
+        if (
+            f"hugepages-{hugepage_size}kB"
+            not in self.send_command("ls /sys/kernel/mm/hugepages").stdout
+        ):
+            raise ConfigurationError("hugepage size not supported by operating system")
         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)
@@ -99,13 +105,9 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
             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:
+    def _get_hugepages_total(self, hugepage_size: int) -> int:
         hugepages_total = self.send_command(
-            "awk '/HugePages_Total/ { print $2 }' /proc/meminfo"
+            f"cat /sys/kernel/mm/hugepages/hugepages-{hugepage_size}kB/nr_hugepages"
         ).stdout
         return int(hugepages_total)
 
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 74061f6262..3f2a727c3b 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,9 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount, self.config.hugepages.force_first_numa
+                self.config.hugepages.amount,
+                self.main_session.hugepage_size,
+                self.config.hugepages.force_first_numa,
             )
 
     def configure_port_state(self, port: Port, enable: bool = True) -> None:
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index d5bf7e0401..19dcf5f963 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -64,6 +64,7 @@ class OSSession(ABC):
     _logger: DTSLogger
     remote_session: RemoteSession
     interactive_session: InteractiveRemoteSession
+    hugepage_size: int
 
     def __init__(
         self,
@@ -80,6 +81,7 @@ def __init__(
             name: The name of the session.
             logger: The logger instance this session will use.
         """
+        self.hugepage_size = 2048
         self._config = node_config
         self.name = name
         self._logger = logger
@@ -345,7 +347,9 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         """
 
     @abstractmethod
-    def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
+    def setup_hugepages(
+        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+    ) -> None:
         """Configure hugepages on the node.
 
         Get the node's Hugepage Size, configure the specified count of hugepages
@@ -353,6 +357,7 @@ def setup_hugepages(self, hugepage_count: int, force_first_numa: bool) -> None:
 
         Args:
             hugepage_count: Configure this many hugepages.
+            hugepage_size: Configure hugepages of this size.
             force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.
         """
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-30 19:37   ` Nicholas Pratte
  2024-05-30 19:37     ` [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
@ 2024-05-30 19:38     ` Nicholas Pratte
  2024-05-31  6:53       ` Juraj Linkeš
  2024-05-31 11:37       ` Luca Vizzarro
  1 sibling, 2 replies; 33+ messages in thread
From: Nicholas Pratte @ 2024-05-30 19:38 UTC (permalink / raw)
  To: luca.vizzarro, juraj.linkes, jspewock, paul.szczepanek,
	bruce.richardson, Honnappa.Nagarahalli, yoan.picchi, probb
  Cc: dev, Nicholas Pratte

The term 'amount' is used for uncountable nouns. Since total hugepages
is a discrete value (i.e. countable), the declaration of the 'amount'
key value pair should be changes to a different term in both the config
and the rest of the code.

Bugzilla ID: 1370
Signed-off-by: Nicholas Pratte <npratte@iol.unh.edu>
Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 * v8: Decided on a variable name "number_of" to be used throughout the
 * configuration.

---
 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 | 10 +++++-----
 dts/framework/testbed_model/node.py          |  2 +-
 dts/framework/testbed_model/os_session.py    |  6 +++---
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dts/conf.yaml b/dts/conf.yaml
index 56c3ae6f4c..ce475776a7 100644
--- a/dts/conf.yaml
+++ b/dts/conf.yaml
@@ -36,7 +36,7 @@ nodes:
     use_first_core: false # tells DPDK to use any physical core
     memory_channels: 4 # tells DPDK to use 4 memory channels
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        number_of: 256
         force_first_numa: false
     ports:
       # sets up the physical link between "SUT 1"@000:00:08.0 and "TG 1"@0000:00:08.0
@@ -72,7 +72,7 @@ nodes:
         peer_node: "SUT 1"
         peer_pci: "0000:00:08.1"
     hugepages_2mb: # optional; if removed, will use system hugepage configuration
-        amount: 256
+        number_of: 256
         force_first_numa: false
     traffic_generator:
         type: SCAPY
diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py
index b6f820e39e..81dd321b18 100644
--- a/dts/framework/config/__init__.py
+++ b/dts/framework/config/__init__.py
@@ -127,11 +127,11 @@ class HugepageConfiguration:
     r"""The hugepage configuration of :class:`~framework.testbed_model.node.Node`\s.
 
     Attributes:
-        amount: The number of hugepages.
+        number_of: The number of hugepages to allocate.
         force_first_numa: If :data:`True`, the hugepages will be configured on the first NUMA node.
     """
 
-    amount: int
+    number_of: int
     force_first_numa: bool
 
 
diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json
index f4d7199523..71c893662a 100644
--- a/dts/framework/config/conf_yaml_schema.json
+++ b/dts/framework/config/conf_yaml_schema.json
@@ -150,9 +150,9 @@
       "type": "object",
       "description": "Optional hugepage configuration. If not specified, hugepages won't be configured and DTS will use system configuration.",
       "properties": {
-        "amount": {
+        "number_of": {
           "type": "integer",
-          "description": "The amount of hugepages to configure. Hugepage size will be the system default."
+          "description": "The number of hugepages to configure. Hugepage size will be the system default."
         },
         "force_first_numa": {
           "type": "boolean",
@@ -161,7 +161,7 @@
       },
       "additionalProperties": false,
       "required": [
-        "amount"
+        "number_of"
       ]
     },
     "mac_address": {
diff --git a/dts/framework/config/types.py b/dts/framework/config/types.py
index 016e0c3dbd..5c9d659901 100644
--- a/dts/framework/config/types.py
+++ b/dts/framework/config/types.py
@@ -37,7 +37,7 @@ class HugepageConfigurationDict(TypedDict):
     """Allowed keys and values."""
 
     #:
-    amount: int
+    number_of: int
     #:
     force_first_numa: bool
 
diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index d0f7cfa77c..6a09d0e69a 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -85,7 +85,7 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
         return dpdk_prefix
 
     def setup_hugepages(
-        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+        self, number_of: int, hugepage_size: int, force_first_numa: bool
     ) -> None:
         """Overrides :meth:`~.os_session.OSSession.setup_hugepages`."""
         self._logger.info("Getting Hugepage information.")
@@ -97,10 +97,10 @@ def setup_hugepages(
             raise ConfigurationError("hugepage size not supported by operating system")
         self._numa_nodes = self._get_numa_nodes()
 
-        if force_first_numa or hugepages_total < hugepage_count:
+        if force_first_numa or hugepages_total < number_of:
             # 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(number_of, hugepage_size, force_first_numa)
         else:
             self._logger.info("Hugepages already configured.")
         self._mount_huge_pages()
@@ -138,7 +138,7 @@ 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, number_of: int, size: int, force_first_numa: bool) -> None:
         self._logger.info("Configuring Hugepages.")
         hugepage_config_path = f"/sys/kernel/mm/hugepages/hugepages-{size}kB/nr_hugepages"
         if force_first_numa and self._supports_numa():
@@ -149,7 +149,7 @@ def _configure_huge_pages(self, amount: int, size: int, force_first_numa: bool)
                 f"/hugepages-{size}kB/nr_hugepages"
             )
 
-        self.send_command(f"echo {amount} | tee {hugepage_config_path}", privileged=True)
+        self.send_command(f"echo {number_of} | tee {hugepage_config_path}", privileged=True)
 
     def update_ports(self, ports: list[Port]) -> None:
         """Overrides :meth:`~.os_session.OSSession.update_ports`."""
diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 3f2a727c3b..6818a057d0 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -266,7 +266,7 @@ def _setup_hugepages(self) -> None:
         """
         if self.config.hugepages:
             self.main_session.setup_hugepages(
-                self.config.hugepages.amount,
+                self.config.hugepages.number_of,
                 self.main_session.hugepage_size,
                 self.config.hugepages.force_first_numa,
             )
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index 19dcf5f963..1f23f5524f 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -348,7 +348,7 @@ def get_dpdk_file_prefix(self, dpdk_prefix: str) -> str:
 
     @abstractmethod
     def setup_hugepages(
-        self, hugepage_count: int, hugepage_size: int, force_first_numa: bool
+        self, number_of: int, hugepage_size: int, force_first_numa: bool
     ) -> None:
         """Configure hugepages on the node.
 
@@ -356,9 +356,9 @@ def setup_hugepages(
         if needed and mount the hugepages if needed.
 
         Args:
-            hugepage_count: Configure this many hugepages.
+            number_of: Configure this many hugepages.
             hugepage_size: Configure hugepages of this size.
-            force_first_numa:  If :data:`True`, configure hugepages just on the first numa node.
+            force_first_numa:  If :data:`True`, configure just on the first numa node.
         """
 
     @abstractmethod
-- 
2.44.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively
  2024-05-30 19:37     ` [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
@ 2024-05-31  6:52       ` Juraj Linkeš
  2024-05-31 11:37       ` Luca Vizzarro
  1 sibling, 0 replies; 33+ messages in thread
From: Juraj Linkeš @ 2024-05-31  6:52 UTC (permalink / raw)
  To: Nicholas Pratte
  Cc: luca.vizzarro, jspewock, paul.szczepanek, bruce.richardson,
	Honnappa.Nagarahalli, yoan.picchi, probb, dev

On Thu, May 30, 2024 at 9:38 PM Nicholas Pratte <npratte@iol.unh.edu> 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 hugepage
> 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 is
> 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 <npratte@iol.unh.edu>
> Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>

Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-30 19:38     ` [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
@ 2024-05-31  6:53       ` Juraj Linkeš
  2024-05-31 11:37       ` Luca Vizzarro
  1 sibling, 0 replies; 33+ messages in thread
From: Juraj Linkeš @ 2024-05-31  6:53 UTC (permalink / raw)
  To: Nicholas Pratte
  Cc: luca.vizzarro, jspewock, paul.szczepanek, bruce.richardson,
	Honnappa.Nagarahalli, yoan.picchi, probb, dev

On Thu, May 30, 2024 at 9:38 PM Nicholas Pratte <npratte@iol.unh.edu> wrote:
>
> The term 'amount' is used for uncountable nouns. Since total hugepages
> is a discrete value (i.e. countable), the declaration of the 'amount'
> key value pair should be changes to a different term in both the config
> and the rest of the code.
>
> Bugzilla ID: 1370
> Signed-off-by: Nicholas Pratte <npratte@iol.unh.edu>
> Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>

Reviewed-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively
  2024-05-30 19:37     ` [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
  2024-05-31  6:52       ` Juraj Linkeš
@ 2024-05-31 11:37       ` Luca Vizzarro
  1 sibling, 0 replies; 33+ messages in thread
From: Luca Vizzarro @ 2024-05-31 11:37 UTC (permalink / raw)
  To: Nicholas Pratte, juraj.linkes, jspewock, paul.szczepanek,
	bruce.richardson, Honnappa.Nagarahalli, yoan.picchi, probb
  Cc: dev

Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term
  2024-05-30 19:38     ` [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
  2024-05-31  6:53       ` Juraj Linkeš
@ 2024-05-31 11:37       ` Luca Vizzarro
  1 sibling, 0 replies; 33+ messages in thread
From: Luca Vizzarro @ 2024-05-31 11:37 UTC (permalink / raw)
  To: Nicholas Pratte, juraj.linkes, jspewock, paul.szczepanek,
	bruce.richardson, Honnappa.Nagarahalli, yoan.picchi, probb
  Cc: dev

Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2024-05-31 11:37 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30 18:45 [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
2024-04-30 18:45 ` [PATCH v5 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
2024-05-02 11:55   ` Juraj Linkeš
2024-05-07 11:15   ` Luca Vizzarro
2024-05-07 12:05   ` Bruce Richardson
2024-05-07 12:43     ` Luca Vizzarro
2024-05-07 13:00       ` Bruce Richardson
2024-05-13 10:06         ` Juraj Linkeš
2024-05-15 15:12           ` Nicholas Pratte
2024-04-30 18:45 ` [PATCH v5 0/2] Methodology change for hugepage configuration Nicholas Pratte
2024-05-07 11:16   ` Luca Vizzarro
2024-05-07 16:37   ` [PATCH v6 " Nicholas Pratte
2024-05-07 16:37     ` [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
2024-05-07 16:37     ` [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
2024-05-07 17:44   ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
2024-05-07 17:44     ` [PATCH v6 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
2024-05-07 17:44     ` [PATCH v6 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
2024-05-07 17:46     ` [PATCH v6 0/2] Methodology change for hugepage configuration Nicholas Pratte
2024-05-13  9:53     ` Juraj Linkeš
2024-05-15 14:50       ` Nicholas Pratte
2024-05-29 10:30         ` Juraj Linkeš
2024-05-30 17:58   ` [PATCH v7 " Nicholas Pratte
2024-05-30 17:58     ` [PATCH v7 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
2024-05-30 17:58     ` [PATCH v7 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
2024-05-30 18:37   ` [PATCH v8 0/2] Methodology change for hugepage configuration Nicholas Pratte
2024-05-30 19:37   ` Nicholas Pratte
2024-05-30 19:37     ` [PATCH v8 1/2] dts: Change hugepage runtime config to 2MB Exclusively Nicholas Pratte
2024-05-31  6:52       ` Juraj Linkeš
2024-05-31 11:37       ` Luca Vizzarro
2024-05-30 19:38     ` [PATCH v8 2/2] dts: Change hugepage 'amount' to a different term Nicholas Pratte
2024-05-31  6:53       ` Juraj Linkeš
2024-05-31 11:37       ` Luca Vizzarro
2024-05-02 11:55 ` [PATCH v5 1/2] dts: Change hugepage runtime config to 2MB Exclusively Juraj Linkeš

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).