[v1,1/1] dts: add admin privileges to hugepage mounting

Message ID 20240812150421.31226-2-jspewock@iol.unh.edu (mailing list archive)
State Accepted
Delegated to: Juraj Linkeš
Headers
Series dts: fix hugepage mounting |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Jeremy Spewock Aug. 12, 2024, 3:04 p.m. UTC
From: Jeremy Spewock <jspewock@iol.unh.edu>

There were two different commands in the hugepage mounting process that
were not using super-user privileges; one for unmounting hugepages and
another for re-mounting them. This patch adds the flag that enables
enhanced permissions for both of these actions.

Bugzilla ID: 1439
Fixes: b8bdc4c58f57 ("dts: replace pexpect with fabric")
Cc: juraj.linkes@pantheon.tech

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/testbed_model/linux_session.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Nicholas Pratte Aug. 12, 2024, 3:17 p.m. UTC | #1
Reviewed-by: Nicholas Pratte <npratte@iol.unh.edu>

On Mon, Aug 12, 2024 at 11:04 AM <jspewock@iol.unh.edu> wrote:
>
> From: Jeremy Spewock <jspewock@iol.unh.edu>
>
> There were two different commands in the hugepage mounting process that
> were not using super-user privileges; one for unmounting hugepages and
> another for re-mounting them. This patch adds the flag that enables
> enhanced permissions for both of these actions.
>
> Bugzilla ID: 1439
> Fixes: b8bdc4c58f57 ("dts: replace pexpect with fabric")
> Cc: juraj.linkes@pantheon.tech
>
> Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
> ---
>  dts/framework/testbed_model/linux_session.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
> index 99abc21353..544a665b83 100644
> --- a/dts/framework/testbed_model/linux_session.py
> +++ b/dts/framework/testbed_model/linux_session.py
> @@ -123,12 +123,12 @@ def _get_numa_nodes(self) -> list[int]:
>      def _mount_huge_pages(self) -> None:
>          self._logger.info("Re-mounting Hugepages.")
>          hugapge_fs_cmd = "awk '/hugetlbfs/ { print $2 }' /proc/mounts"
> -        self.send_command(f"umount $({hugapge_fs_cmd})")
> +        self.send_command(f"umount $({hugapge_fs_cmd})", privileged=True)
>          result = self.send_command(hugapge_fs_cmd)
>          if result.stdout == "":
>              remote_mount_path = "/mnt/huge"
> -            self.send_command(f"mkdir -p {remote_mount_path}")
> -            self.send_command(f"mount -t hugetlbfs nodev {remote_mount_path}")
> +            self.send_command(f"mkdir -p {remote_mount_path}", privileged=True)
> +            self.send_command(f"mount -t hugetlbfs nodev {remote_mount_path}", privileged=True)
>
>      def _supports_numa(self) -> bool:
>          # the system supports numa if self._numa_nodes is non-empty and there are more
> --
> 2.45.2
>
  
Luca Vizzarro Sept. 9, 2024, 3:44 p.m. UTC | #2
Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
  
Juraj Linkeš Sept. 9, 2024, 3:48 p.m. UTC | #3
On 12. 8. 2024 17:04, jspewock@iol.unh.edu wrote:
> From: Jeremy Spewock <jspewock@iol.unh.edu>
> 
> There were two different commands in the hugepage mounting process that
> were not using super-user privileges; one for unmounting hugepages and
> another for re-mounting them. This patch adds the flag that enables
> enhanced permissions for both of these actions.
> 
> Bugzilla ID: 1439
> Fixes: b8bdc4c58f57 ("dts: replace pexpect with fabric")
> Cc: juraj.linkes@pantheon.tech
> 
> Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>

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

Patch

diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index 99abc21353..544a665b83 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -123,12 +123,12 @@  def _get_numa_nodes(self) -> list[int]:
     def _mount_huge_pages(self) -> None:
         self._logger.info("Re-mounting Hugepages.")
         hugapge_fs_cmd = "awk '/hugetlbfs/ { print $2 }' /proc/mounts"
-        self.send_command(f"umount $({hugapge_fs_cmd})")
+        self.send_command(f"umount $({hugapge_fs_cmd})", privileged=True)
         result = self.send_command(hugapge_fs_cmd)
         if result.stdout == "":
             remote_mount_path = "/mnt/huge"
-            self.send_command(f"mkdir -p {remote_mount_path}")
-            self.send_command(f"mount -t hugetlbfs nodev {remote_mount_path}")
+            self.send_command(f"mkdir -p {remote_mount_path}", privileged=True)
+            self.send_command(f"mount -t hugetlbfs nodev {remote_mount_path}", privileged=True)
 
     def _supports_numa(self) -> bool:
         # the system supports numa if self._numa_nodes is non-empty and there are more