mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
fix: Synchronize power property retrievals
Related-To: NEO-10525 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
588921ed9b
commit
a023b40c90
@@ -42,6 +42,10 @@ class LinuxPowerImp::PowerLimitRestorer : NEO::NonCopyableOrMovableClass {
|
||||
uint64_t powerLimitValue = 0;
|
||||
};
|
||||
|
||||
std::unique_lock<std::mutex> LinuxPowerImp::obtainMutex() {
|
||||
return std::unique_lock<std::mutex>(this->powerLimitMutex);
|
||||
}
|
||||
|
||||
ze_result_t LinuxPowerImp::getProperties(zes_power_properties_t *pProperties) {
|
||||
pProperties->onSubdevice = isSubdevice;
|
||||
pProperties->subdeviceId = subdeviceId;
|
||||
@@ -60,6 +64,7 @@ ze_result_t LinuxPowerImp::getProperties(zes_power_properties_t *pProperties) {
|
||||
return result;
|
||||
}
|
||||
|
||||
auto lock = this->obtainMutex();
|
||||
auto powerLimitRestorer = L0::Sysman::LinuxPowerImp::PowerLimitRestorer(pSysfsAccess, sustainedPowerLimit);
|
||||
if (powerLimitRestorer != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read %s and returning error:0x%x \n", __FUNCTION__, sustainedPowerLimit.c_str(), getErrorCode(powerLimitRestorer));
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "level_zero/sysman/source/api/power/sysman_os_power.h"
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace L0 {
|
||||
@@ -44,12 +45,14 @@ class LinuxPowerImp : public OsPower, NEO::NonCopyableOrMovableClass {
|
||||
SysFsAccessInterface *pSysfsAccess = nullptr;
|
||||
SysmanKmdInterface *pSysmanKmdInterface = nullptr;
|
||||
SysmanProductHelper *pSysmanProductHelper = nullptr;
|
||||
virtual std::unique_lock<std::mutex> obtainMutex();
|
||||
|
||||
private:
|
||||
std::string intelGraphicsHwmonDir = {};
|
||||
std::string criticalPowerLimit = {};
|
||||
std::string sustainedPowerLimit = {};
|
||||
std::string sustainedPowerLimitInterval = {};
|
||||
std::mutex powerLimitMutex{};
|
||||
bool canControl = false;
|
||||
bool isSubdevice = false;
|
||||
uint32_t subdeviceId = 0;
|
||||
|
||||
Reference in New Issue
Block a user