[SWDEV-516013]-rocm-smi runtime status check fix (#28)

rocm-smi is not working in mGPU, Blocking DLM tests
Updates include:
 - Creating check_runtime_status function to check for device status of active.
 - Added warning to users that No AMD GPUs are available, check power status/control.
 - Added check for empty string coming from HWMON, if emtpy returns unexpected data.

---------

Signed-off-by: Juan Castillo <juan.castillo@amd.com>
Este commit está contenido en:
Castillo, Juan authored and GitHub committed 2025-04-14 13:05:22 -05:00
1 padre d18e40f204
commit 2630bf0a8c
2 files changed
+67 -5

No files matched your search

+46 -4
Ver fichero
@@ -368,10 +368,31 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type,
return amd::smi::ErrnoToRsmiStatus(ret);
}
if (val_str.empty()) {
std::ostringstream ss;
ss << __PRETTY_FUNCTION__
<< " | ======= end ======= "
<< " | Fail "
<< " | Device #: " << dv_ind
<< " | Type: " << monitorTypesToString.at(type)
<< " | Cause: SYSFS read was empty"
<< " | Returning = "
<< getRSMIStatusString(RSMI_STATUS_UNEXPECTED_DATA) << " |";
LOG_INFO(ss);
return RSMI_STATUS_UNEXPECTED_DATA;
}
if (!amd::smi::IsInteger(val_str)) {
std::ostringstream ss;
ss << "Expected integer value from monitor, but got \"" << val_str << "\"";
LOG_ERROR(ss);
ss << __PRETTY_FUNCTION__
<< " | ======= end ======= "
<< " | Fail "
<< " | Device #: " << dv_ind
<< " | Type: " << monitorTypesToString.at(type)
<< " | Cause: Expected integer value from monitor, but got "<< val_str
<< " | Returning = "
<< getRSMIStatusString(RSMI_STATUS_UNEXPECTED_DATA) << " |";
LOG_INFO(ss);
return RSMI_STATUS_UNEXPECTED_DATA;
}
@@ -398,10 +419,31 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type,
return amd::smi::ErrnoToRsmiStatus(ret);
}
if (val_str.empty()) {
std::ostringstream ss;
ss << __PRETTY_FUNCTION__
<< " | ======= end ======= "
<< " | Fail "
<< " | Device #: " << dv_ind
<< " | Type: " << monitorTypesToString.at(type)
<< " | Cause: SYSFS read was empty"
<< " | Returning = "
<< getRSMIStatusString(RSMI_STATUS_UNEXPECTED_DATA) << " |";
LOG_INFO(ss);
return RSMI_STATUS_UNEXPECTED_DATA;
}
if (!amd::smi::IsInteger(val_str)) {
std::ostringstream ss;
ss << "Expected integer value from monitor, but got \"" << val_str << "\"";
LOG_ERROR(ss);
ss << __PRETTY_FUNCTION__
<< " | ======= end ======= "
<< " | Fail "
<< " | Device #: " << dv_ind
<< " | Type: " << monitorTypesToString.at(type)
<< " | Cause: Expected integer value from monitor, but got "<< val_str
<< " | Returning = "
<< getRSMIStatusString(RSMI_STATUS_UNEXPECTED_DATA) << " |";
LOG_INFO(ss);
return RSMI_STATUS_UNEXPECTED_DATA;
}