From 17e44606907cdd7f3dc83718cdee5d0fd01c9121 Mon Sep 17 00:00:00 2001 From: Divya Shikre Date: Tue, 18 Jan 2022 14:58:13 -0500 Subject: [PATCH 1/5] Don't assert when fan is not supported. Add a check when RSMI_STATUS_NOT_SUPPORTED is returned for fanRead/fanReadWrite. Fix for SWDEV-314176 & SWDEV-314175 reported. Signed-off-by: Divya Shikre Change-Id: Icf2cc541a3fa5ca4794aff5d6bc91104adc45e6d [ROCm/rocm_smi_lib commit: 11a71c63b1486de654266f0c8c5317659eb7beca] --- .../tests/rocm_smi_test/functional/fan_read.cc | 11 ++++++++++- .../tests/rocm_smi_test/functional/fan_read_write.cc | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read.cc index 1597e13b8e..ad1356f69b 100755 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read.cc @@ -102,7 +102,16 @@ void TestFanRead::Run(void) { std::cout << "\t**Current Fan Speed: "; } err = rsmi_dev_fan_speed_get(i, 0, &val_i64); - CHK_ERR_ASRT(err) + if (err == RSMI_STATUS_NOT_SUPPORTED) { + IF_VERB(STANDARD) { + std::cout << "\t**" << ": " << + "Not supported on this machine" << std::endl; + } + return; + } else { + CHK_ERR_ASRT(err) + } + // Verify api support checking functionality is working err = rsmi_dev_fan_speed_get(i, 0, nullptr); diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read_write.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read_write.cc index 4342c7a15a..c8129a2f2e 100755 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read_write.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/fan_read_write.cc @@ -101,7 +101,15 @@ void TestFanReadWrite::Run(void) { PrintDeviceHeader(dv_ind); ret = rsmi_dev_fan_speed_get(dv_ind, 0, &orig_speed); - CHK_ERR_ASRT(ret) + if (ret == RSMI_STATUS_NOT_SUPPORTED) { + IF_VERB(STANDARD) { + std::cout << "\t**" << ": " << + "Not supported on this machine" << std::endl; + } + return; + } else { + CHK_ERR_ASRT(ret) + } IF_VERB(STANDARD) { std::cout << "Original fan speed: " << orig_speed << std::endl; } From 9db28252c24b3b49c9026d8f694fcfa4e014885a Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Thu, 20 Jan 2022 13:29:50 -0500 Subject: [PATCH 2/5] Add rpm License header Add rpm License header for cpack Change-Id: I2f4a89015b6389cfde801f41d4f6e0f59e7087aa [ROCm/rocm_smi_lib commit: ce9cfa584fb8170dd5fb2e08b42f3403f4ebbc4d] --- projects/rocm-smi-lib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/rocm-smi-lib/CMakeLists.txt b/projects/rocm-smi-lib/CMakeLists.txt index c8138f44ea..221c19520b 100755 --- a/projects/rocm-smi-lib/CMakeLists.txt +++ b/projects/rocm-smi-lib/CMakeLists.txt @@ -176,6 +176,7 @@ install(EXPORT rocm_smiTargets DESTINATION "${ROCM_SMI}/lib/cmake" COMPONENT dev) #License file +set(CPACK_RPM_PACKAGE_LICENSE "NCSA") install( FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION share/doc/smi-lib RENAME LICENSE.txt) ########################### From a7a7c65e2ab0229480f30db7766546fc48a779ee Mon Sep 17 00:00:00 2001 From: Divya Shikre Date: Tue, 25 Jan 2022 19:50:57 -0500 Subject: [PATCH 3/5] Add fix to check for vector size while reading pp_dpm_pcie pop_back() was causing a seg fault when pp_dpm_pcie file is empty and returns whitespace. Signed-off-by: Divya Shikre Change-Id: I888f1f79751cd456e43751a5b96d08560a039677 [ROCm/rocm_smi_lib commit: ec71380e1ce7892957c595b4bf4c6409617bbba2] --- projects/rocm-smi-lib/src/rocm_smi_device.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/rocm-smi-lib/src/rocm_smi_device.cc b/projects/rocm-smi-lib/src/rocm_smi_device.cc index 51e6782263..a80fcd3145 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_device.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_device.cc @@ -630,7 +630,7 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) { ret = RSMI_STATUS_NOT_SUPPORTED; } fs.close(); - + return ret; } @@ -742,7 +742,8 @@ int Device::readDevInfoMultiLineStr(DevInfoTypes type, return 0; } // Remove any *trailing* empty (whitespace) lines - while (retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) { + while (retVec->size() != 0 && + retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) { retVec->pop_back(); } return 0; From fbb6e77dda708396713a69785df099f01afcab3a Mon Sep 17 00:00:00 2001 From: Laurent Morichetti Date: Wed, 19 Jan 2022 19:43:45 +0000 Subject: [PATCH 4/5] Don't use NDEBUG when the intent is !DEBUG CMakeLists.txt does not set up the DEBUG macro correctly to mean !NDEBUG, so, as a workaround, replace all uses of ifdef NDEBUG with ifndef DEBUG in the library sources. Change-Id: I408adb36d1a2310fb894a486574469662ebb27cd (cherry picked from commit f430cd4f9178f1423ccc74d07b263f484e3930cc) [ROCm/rocm_smi_lib commit: 2804bf7c28c8066a310d36c531a99232f352f494] --- projects/rocm-smi-lib/src/rocm_smi_device.cc | 2 +- projects/rocm-smi-lib/src/rocm_smi_main.cc | 4 ++-- projects/rocm-smi-lib/src/rocm_smi_monitor.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/rocm-smi-lib/src/rocm_smi_device.cc b/projects/rocm-smi-lib/src/rocm_smi_device.cc index a80fcd3145..69dff42111 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_device.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_device.cc @@ -485,7 +485,7 @@ static const std::map kDevFuncDependsMap = { Device::Device(std::string p, RocmSMI_env_vars const *e) : monitor_(nullptr), path_(p), env_(e), evt_notif_anon_fd_(-1), gpu_metrics_ver_{0, 0, 0} { -#ifdef NDEBUG +#ifndef DEBUG env_ = nullptr; #endif diff --git a/projects/rocm-smi-lib/src/rocm_smi_main.cc b/projects/rocm-smi-lib/src/rocm_smi_main.cc index d760d55171..171fc9d803 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_main.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_main.cc @@ -341,7 +341,7 @@ RocmSMI& RocmSMI::getInstance(uint64_t flags) { } static uint32_t GetEnvVarUInteger(const char *ev_str) { -#ifdef NDEBUG +#ifndef DEBUG (void)ev_str; #else ev_str = getenv(ev_str); @@ -357,7 +357,7 @@ static uint32_t GetEnvVarUInteger(const char *ev_str) { // Get and store env. variables in this method void RocmSMI::GetEnvVariables(void) { -#ifdef NDEBUG +#ifndef DEBUG (void)GetEnvVarUInteger(nullptr); // This is to quiet release build warning. env_vars_.debug_output_bitfield = 0; env_vars_.path_DRM_root_override = nullptr; diff --git a/projects/rocm-smi-lib/src/rocm_smi_monitor.cc b/projects/rocm-smi-lib/src/rocm_smi_monitor.cc index 53659efe36..15c995ebae 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_monitor.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_monitor.cc @@ -279,7 +279,7 @@ static const std::map kMonFuncDependsMap = { Monitor::Monitor(std::string path, RocmSMI_env_vars const *e) : path_(path), env_(e) { -#ifdef NDEBUG +#ifndef DEBUG env_ = nullptr; #endif } From 25c9398a0d6e5322cbf1c540f2ff8fabfb7c7b14 Mon Sep 17 00:00:00 2001 From: Divya Shikre Date: Thu, 27 Jan 2022 14:31:44 -0500 Subject: [PATCH 5/5] Temporary blacklist TestPerfLevelReadWrite for navi21 Signed-off-by: Divya Shikre Change-Id: Iee2146170b6828fe4fe2846c3ebfd57f95734f34 [ROCm/rocm_smi_lib commit: 8c4635aceaffd8790a3133539e08d0bfea9fab81] --- projects/rocm-smi-lib/tests/rocm_smi_test/rsmitst.exclude | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/rsmitst.exclude b/projects/rocm-smi-lib/tests/rocm_smi_test/rsmitst.exclude index 02cc056429..4be605df2a 100644 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/rsmitst.exclude +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/rsmitst.exclude @@ -48,4 +48,9 @@ $BLACKLIST_ALL_ASICS\ "rsmitstReadWrite.FanReadWrite:"\ "rsmitstReadWrite.TestFrequenciesReadWrite:"\ "rsmitstReadWrite.TestPciReadWrite:"\ -"rsmitstReadWrite.TestPowerReadWrite" \ No newline at end of file +"rsmitstReadWrite.TestPowerReadWrite" + +# SWDEV-319795 +FILTER[sienna_cichlid]=\ +$BLACKLIST_ALL_ASICS\ +"rsmitstReadWrite.TestPerfLevelReadWrite" \ No newline at end of file