From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D280E45420; Thu, 13 Jun 2024 22:22:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C584141144; Thu, 13 Jun 2024 22:22:03 +0200 (CEST) Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) by mails.dpdk.org (Postfix) with ESMTP id 8402B4113D for ; Thu, 13 Jun 2024 22:22:02 +0200 (CEST) Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3d21a80b8ceso219257b6e.3 for ; Thu, 13 Jun 2024 13:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718310122; x=1718914922; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fq6mHFDy39obw4pareQnbt/Sog3RGj4JDSqf+IuUNF8=; b=hrjZKcemlqTARObZ2bGnEJ7zKknikEEJMAQORl4cXaBmXGufm0EINXYPovFk6QUd4D wuSKg1NfHNONhwkRo5aqguZQT6D25F4xcHPdHdSeO1o0AZzPl4Zo13/FflQJGI1xUAzi blXBoMk8FwE93FydTp1DqNH/vnDgtLoSoC834= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718310122; x=1718914922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fq6mHFDy39obw4pareQnbt/Sog3RGj4JDSqf+IuUNF8=; b=KDWuZoQ5OByMkBVcrwPv2BoORFLcMKV4htJFvJgHN+6auTjeSZN8c8vThEk16hC6Hz KIQL9O+5mmU0BI71GLyd0XRY3NDR+8euUMxuq9DESZOZ0dBGRPJyNoo/L3lQ2ZgWHhp2 ejLrKxh5KJao1SBL8QrDwj6Hyx13i6peGN3uWjM71SgfveI5n/8BAI3wjzCAkqr8J0jh kvtVm3r3bn9Pjw8hsvqGA58s0UULmpDnz63HU6qSd1ggip/7b5xrlR3bypKzYXfWYXhZ SDbsHs59f42PXYYgNRljfL8R7G/H/BxvLRlYVwWcJ3ksuuabtG6N+oPcCnlyF1Mzmkl9 jJ9w== X-Gm-Message-State: AOJu0YwCldGHZ29KWOOfYpyRxWmLXa4IdI/wzNQZUoXE2skBLMWA0jTI dfzDFfLiYBqdxQlj0RwseI1AJP5Z8v7LK636GbBAlX/L+Mr2aCAvqZYySpIgjN4= X-Google-Smtp-Source: AGHT+IGdazTzogXwZX2k6AfITZf2gwNGxjENWy/dfV3/CwWa44Ro0vJX7hbs/DLdpzfVM33DZmGdbQ== X-Received: by 2002:a05:6808:218a:b0:3d2:2755:3300 with SMTP id 5614622812f47-3d24ea03dbbmr624613b6e.5.1718310121596; Thu, 13 Jun 2024 13:22:01 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4420c5e8e4bsm8493731cf.39.2024.06.13.13.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 13:22:01 -0700 (PDT) From: Nicholas Pratte To: Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, luca.vizzarro@arm.com, juraj.linkes@pantheon.tech, bruce.richardson@intel.com, jspewock@iol.unh.edu, probb@iol.unh.edu, dmarx@iol.unh.edu, yoan.picchi@foss.arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH 3/4] dts: Self-Discovering Architecture Change Date: Thu, 13 Jun 2024 16:18:32 -0400 Message-ID: <20240613201831.9748-9-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240613201831.9748-3-npratte@iol.unh.edu> References: <20240613201831.9748-3-npratte@iol.unh.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The 'arch' attribute in the conf.yaml is unnecessary, as this can be readily discovered within the constructor of any given node. Since OS is determined within user configuration, finding system arch can be done both reliably and easily within the framework. For Linux/Posix systems, the 'uname' command is used to determine system architecture. I believe that this is posix-standard and utilizes a standardized output. Bugzilla ID: 1360 Signed-off-by: Nicholas Pratte --- doc/guides/tools/dts.rst | 2 -- dts/conf.yaml | 2 -- dts/framework/config/__init__.py | 4 ---- dts/framework/config/conf_yaml_schema.json | 12 ------------ dts/framework/config/types.py | 2 -- dts/framework/testbed_model/node.py | 3 +++ dts/framework/testbed_model/os_session.py | 8 ++++++++ dts/framework/testbed_model/posix_session.py | 6 ++++++ 8 files changed, 17 insertions(+), 22 deletions(-) diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst index fbb5c6f17b..0453a15a73 100644 --- a/doc/guides/tools/dts.rst +++ b/doc/guides/tools/dts.rst @@ -542,8 +542,6 @@ involved in the testing. These can be defined with the following mappings: | | | | | **NB**: Use only as last resort. SSH keys are **strongly** preferred. | +-----------------------+---------------------------------------------------------------------------------------+ - | ``arch`` | The architecture of this node. See `ARCH`_ for supported values. | - +-----------------------+---------------------------------------------------------------------------------------+ | ``os`` | The operating system of this node. See `OS`_ for supported values. | +-----------------------+---------------------------------------------------------------------------------------+ | ``lcores`` | | (*optional*, defaults to 1 if not used) *string* – Comma-separated list of logical | diff --git a/dts/conf.yaml b/dts/conf.yaml index c20afb9621..b9f5704ca5 100644 --- a/dts/conf.yaml +++ b/dts/conf.yaml @@ -27,7 +27,6 @@ nodes: - name: "SUT 1" hostname: sut1.change.me.localhost user: dtsuser - arch: x86_64 os: linux lcores: "" # use all available logical cores (Skips first core) memory_channels: 4 # tells DPDK to use 4 memory channels @@ -52,7 +51,6 @@ nodes: - name: "TG 1" hostname: tg1.change.me.localhost user: dtsuser - arch: x86_64 os: linux ports: # sets up the physical link between "TG 1"@000:00:08.0 and "SUT 1"@0000:00:08.0 diff --git a/dts/framework/config/__init__.py b/dts/framework/config/__init__.py index 6bc290a56a..07b85a6afb 100644 --- a/dts/framework/config/__init__.py +++ b/dts/framework/config/__init__.py @@ -207,7 +207,6 @@ class NodeConfiguration: the :class:`~framework.testbed_model.node.Node`. password: The password of the user. The use of passwords is heavily discouraged. Please use keys instead. - arch: The architecture of the :class:`~framework.testbed_model.node.Node`. os: The operating system of the :class:`~framework.testbed_model.node.Node`. lcores: A comma delimited list of logical cores to use when running DPDK. use_first_core: If :data:`True`, the first logical core won't be used. @@ -219,7 +218,6 @@ class NodeConfiguration: hostname: str user: str password: str | None - arch: Architecture os: OS lcores: str use_first_core: bool @@ -256,7 +254,6 @@ def from_dict( hostname=d["hostname"], user=d["user"], password=d.get("password"), - arch=Architecture(d["arch"]), os=OS(d["os"]), lcores=lcores, use_first_core=use_first_core, @@ -270,7 +267,6 @@ def from_dict( hostname=d["hostname"], user=d["user"], password=d.get("password"), - arch=Architecture(d["arch"]), os=OS(d["os"]), lcores=lcores, use_first_core=use_first_core, diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index 7c8429abbc..49db384967 100644 --- a/dts/framework/config/conf_yaml_schema.json +++ b/dts/framework/config/conf_yaml_schema.json @@ -6,14 +6,6 @@ "type": "string", "description": "A unique identifier for a node" }, - "ARCH": { - "type": "string", - "enum": [ - "x86_64", - "arm64", - "ppc64le" - ] - }, "OS": { "type": "string", "enum": [ @@ -155,9 +147,6 @@ "type": "string", "description": "The password to use on this node. Use only as a last resort. SSH keys are STRONGLY preferred." }, - "arch": { - "$ref": "#/definitions/ARCH" - }, "os": { "$ref": "#/definitions/OS" }, @@ -233,7 +222,6 @@ "name", "hostname", "user", - "arch", "os" ] }, diff --git a/dts/framework/config/types.py b/dts/framework/config/types.py index fccea61608..c841ab2d7c 100644 --- a/dts/framework/config/types.py +++ b/dts/framework/config/types.py @@ -56,8 +56,6 @@ class NodeConfigDict(TypedDict): #: password: str #: - arch: str - #: os: str #: lcores: str diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index 470cd18e30..ee4577cf35 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -18,6 +18,7 @@ from framework.config import ( OS, + Architecture, BuildTargetConfiguration, ExecutionConfiguration, NodeConfiguration, @@ -61,6 +62,7 @@ class Node(ABC): main_session: OSSession config: NodeConfiguration name: str + arch: Architecture lcores: list[LogicalCore] ports: list[Port] _logger: DTSLogger @@ -84,6 +86,7 @@ def __init__(self, node_config: NodeConfiguration): self.name = node_config.name self._logger = get_dts_logger(self.name) self.main_session = create_session(self.config, self.name, self._logger) + self.arch = Architecture(self.main_session.get_arch_info()) self._logger.info(f"Connected to node: {self.name}") diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py index d5bf7e0401..e082102b00 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -375,6 +375,14 @@ def get_node_info(self) -> NodeInfo: Node information. """ + @abstractmethod + def get_arch_info(self) -> str: + """Discover CPU architecture of the remote host. + + Returns: + Remote host CPU architecture. + """ + @abstractmethod def update_ports(self, ports: list[Port]) -> None: """Get additional information about ports from the operating system and update them. diff --git a/dts/framework/testbed_model/posix_session.py b/dts/framework/testbed_model/posix_session.py index d279bb8b53..91afca61ea 100644 --- a/dts/framework/testbed_model/posix_session.py +++ b/dts/framework/testbed_model/posix_session.py @@ -295,3 +295,9 @@ def get_node_info(self) -> NodeInfo: ).stdout.split("\n") kernel_version = self.send_command("uname -r", SETTINGS.timeout).stdout return NodeInfo(os_release_info[0].strip(), os_release_info[1].strip(), kernel_version) + + def get_arch_info(self) -> str: + """Overrides :meth'~.os_session.OSSession.get_arch_info'.""" + # return str(self.send_command('arch')).stdout + + return str(self.send_command("uname -m").stdout.removesuffix("\n")) -- 2.44.0