From cec3e4c2a035b5eae89bee9ca07cfe5a8df2e952 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Fri, 9 Aug 2024 13:07:02 -0500 Subject: [PATCH 1/4] [SWDEV-478576] Added Disclaimer for CLI Tool Signed-off-by: Maisam Arif Change-Id: I3d432ac3f8c9663365921591d183a5d1f35c4707 --- amdsmi_cli/README.md | 2 ++ docs/how-to/using-AMD-SMI-CLI-tool.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/amdsmi_cli/README.md b/amdsmi_cli/README.md index 7ae27c8df8..9c35f8a064 100644 --- a/amdsmi_cli/README.md +++ b/amdsmi_cli/README.md @@ -1,5 +1,7 @@ # AMD SMI CLI Tool +**Disclaimer: CLI Tool is provided as example code to aid development of telemetry tools. Use of the Python or C++ Library is reccomended for a reliable source of data.** + This tool acts as a command line interface for manipulating and monitoring the amdgpu kernel, and is intended to replace and deprecate the existing rocm_smi CLI tool & gpuv-smi tool. diff --git a/docs/how-to/using-AMD-SMI-CLI-tool.md b/docs/how-to/using-AMD-SMI-CLI-tool.md index 952d15bf49..33d9e1834f 100644 --- a/docs/how-to/using-AMD-SMI-CLI-tool.md +++ b/docs/how-to/using-AMD-SMI-CLI-tool.md @@ -1,5 +1,7 @@ # Using AMD SMI Command Line Interface tool +**Disclaimer: CLI Tool is provided as example code to aid development of telemetry tools. Use of the Python or C++ Library is reccomended for a reliable source of data.** + AMD-SMI reports the version and current platform detected when running the command line interface (CLI) without arguments: ``` bash From 210680b570ff7d5614e84090978dad08c27b9bc2 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Thu, 8 Aug 2024 00:34:05 -0500 Subject: [PATCH 2/4] Removed metric --ecc & --ecc-blocks commands from VM ecc is not supported on VM Added static --ras because ras features are still detectable Signed-off-by: Maisam Arif Change-Id: Ied4132b863989dfd67897e00904f04d140fd2773 --- amdsmi_cli/amdsmi_commands.py | 25 +++++++++++++++---------- amdsmi_cli/amdsmi_parser.py | 5 ++++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 9d4e7ebc07..9b4be69351 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -293,6 +293,8 @@ class AMDSMICommands(): args.board = board if driver: args.driver = driver + if ras: + args.ras = ras if vram: args.vram = vram if cache: @@ -301,14 +303,12 @@ class AMDSMICommands(): args.process_isolation = process_isolation # Store args that are applicable to the current platform - current_platform_args = ["asic", "bus", "vbios", "driver", "vram", "cache", - "board", "process_isolation"] - current_platform_values = [args.asic, args.bus, args.vbios, args.driver, args.vram, args.cache, - args.board, args.process_isolation] + current_platform_args = ["asic", "bus", "vbios", "driver", "ras", + "vram", "cache", "board", "process_isolation"] + current_platform_values = [args.asic, args.bus, args.vbios, args.driver, args.ras, + args.vram, args.cache, args.board, args.process_isolation] if self.helpers.is_linux() and self.helpers.is_baremetal(): - if ras: - args.ras = ras if partition: args.partition = partition if limit: @@ -1191,14 +1191,19 @@ class AMDSMICommands(): args.clock = clock if temperature: args.temperature = temperature + if pcie: + args.pcie = pcie + current_platform_args += ["usage", "power", "clock", "temperature", "pcie"] + current_platform_values += [args.usage, args.power, args.clock, args.temperature, args.pcie] + + # Only args that are applicable to Hypervisors and BM Linux + if self.helpers.is_hypervisor() and (self.helpers.is_baremetal() and self.helpers.is_linux()): if ecc: args.ecc = ecc if ecc_blocks: args.ecc_blocks = ecc_blocks - if pcie: - args.pcie = pcie - current_platform_args += ["usage", "power", "clock", "temperature", "ecc", "ecc_blocks", "pcie"] - current_platform_values += [args.usage, args.power, args.clock, args.temperature, args.ecc, args.ecc_blocks, args.pcie] + current_platform_args += ["ecc", "ecc_blocks"] + current_platform_values += [args.ecc, args.ecc_blocks] if self.helpers.is_baremetal() and self.helpers.is_linux(): if fan: diff --git a/amdsmi_cli/amdsmi_parser.py b/amdsmi_cli/amdsmi_parser.py index 04721427db..be80ece190 100644 --- a/amdsmi_cli/amdsmi_parser.py +++ b/amdsmi_cli/amdsmi_parser.py @@ -620,10 +620,10 @@ class AMDSMIParser(argparse.ArgumentParser): static_parser.add_argument('-c', '--cache', action='store_true', required=False, help=cache_help) static_parser.add_argument('-B', '--board', action='store_true', required=False, help=board_help) static_parser.add_argument('-R', '--process-isolation', action='store_true', required=False, help=process_isolation_help) + static_parser.add_argument('-r', '--ras', action='store_true', required=False, help=ras_help) # Options to display on Hypervisors and Baremetal if self.helpers.is_hypervisor() or self.helpers.is_baremetal(): - static_parser.add_argument('-r', '--ras', action='store_true', required=False, help=ras_help) static_parser.add_argument('-p', '--partition', action='store_true', required=False, help=partition_help) static_parser.add_argument('-l', '--limit', action='store_true', required=False, help=limit_help) static_parser.add_argument('-P', '--soc-pstate', action='store_true', required=False, help=soc_pstate_help) @@ -804,6 +804,9 @@ class AMDSMIParser(argparse.ArgumentParser): metric_parser.add_argument('-c', '--clock', action='store_true', required=False, help=clock_help) metric_parser.add_argument('-t', '--temperature', action='store_true', required=False, help=temperature_help) metric_parser.add_argument('-P', '--pcie', action='store_true', required=False, help=pcie_help) + + # Options that only apply to Hypervisors and Baremetal Linux + if self.helpers.is_hypervisor() or (self.helpers.is_baremetal() and self.helpers.is_linux()): metric_parser.add_argument('-e', '--ecc', action='store_true', required=False, help=ecc_help) metric_parser.add_argument('-k', '--ecc-blocks', action='store_true', required=False, help=ecc_blocks_help) From 037f8689fe35329bed45ef363264afccf682c50a Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Fri, 9 Aug 2024 17:20:36 -0500 Subject: [PATCH 3/4] Fixed Guest VM registering as Passthrough VM Signed-off-by: Maisam Arif Change-Id: I0edc36e1a114166647dc10ebc646665b62c5d88e --- amdsmi_cli/amdsmi_helpers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/amdsmi_cli/amdsmi_helpers.py b/amdsmi_cli/amdsmi_helpers.py index 10c91824a3..d1f1da1184 100644 --- a/amdsmi_cli/amdsmi_helpers.py +++ b/amdsmi_cli/amdsmi_helpers.py @@ -807,12 +807,11 @@ class AMDSMIHelpers(): pci_devices_path = "/sys/bus/pci/devices" pci_devices: set[str] = set() for device in os.listdir(pci_devices_path): - subsystem_device_path = os.path.join(pci_devices_path, device, "subsystem_device") + device_path = os.path.join(pci_devices_path, device, "device") try: - with open(subsystem_device_path, 'r') as f: - subsystem_device = f.read().strip() - pci_devices.add(subsystem_device) + with open(device_path, 'r') as f: + device = f.read().strip() + pci_devices.add(device) except Exception as _: continue return pci_devices - From b49c5596b5c37bcba1a65acaedd4c95432c06753 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Fri, 9 Aug 2024 17:03:15 -0500 Subject: [PATCH 4/4] [SWDEV-478576] Adjusted Disclaimer Signed-off-by: Maisam Arif Change-Id: I0dbdcd1c8ff200336e7ee0e8ca88a5eba1b41057 --- amdsmi_cli/README.md | 2 +- docs/how-to/using-AMD-SMI-CLI-tool.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/amdsmi_cli/README.md b/amdsmi_cli/README.md index 9c35f8a064..f88c596a11 100644 --- a/amdsmi_cli/README.md +++ b/amdsmi_cli/README.md @@ -1,6 +1,6 @@ # AMD SMI CLI Tool -**Disclaimer: CLI Tool is provided as example code to aid development of telemetry tools. Use of the Python or C++ Library is reccomended for a reliable source of data.** +**Disclaimer: CLI Tool is provided as an example code to aid the development of telemetry tools. Python or C++ Library is recommended as a reliable data source.** This tool acts as a command line interface for manipulating and monitoring the amdgpu kernel, and is intended to replace diff --git a/docs/how-to/using-AMD-SMI-CLI-tool.md b/docs/how-to/using-AMD-SMI-CLI-tool.md index 33d9e1834f..e7eac67132 100644 --- a/docs/how-to/using-AMD-SMI-CLI-tool.md +++ b/docs/how-to/using-AMD-SMI-CLI-tool.md @@ -1,6 +1,6 @@ # Using AMD SMI Command Line Interface tool -**Disclaimer: CLI Tool is provided as example code to aid development of telemetry tools. Use of the Python or C++ Library is reccomended for a reliable source of data.** +**Disclaimer: CLI Tool is provided as an example code to aid the development of telemetry tools. Python or C++ Library is recommended as a reliable data source.** AMD-SMI reports the version and current platform detected when running the command line interface (CLI) without arguments: