Sysman device reset stability fix

Close PMT, and PMU fds created during Sysman's init before calling
device reset.

Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2021-04-14 12:30:33 +00:00
committed by Compute-Runtime-Automation
parent c9b5de0f1d
commit 46c51cb8a9
6 changed files with 20 additions and 7 deletions

View File

@@ -170,6 +170,8 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
}
pLinuxSysmanImp->getSysmanDeviceImp()->pEngineHandleContext->releaseEngines();
pLinuxSysmanImp->getSysmanDeviceImp()->pRasHandleContext->releaseRasHandles();
pLinuxSysmanImp->releasePmtObject();
static_cast<DeviceImp *>(getDevice())->releaseResources();
for (auto &&fd : myPidFds) {
// Close open filedescriptors to the device

View File

@@ -117,6 +117,12 @@ LinuxSysmanImp::LinuxSysmanImp(SysmanDeviceImp *pParentSysmanDeviceImp) {
this->pParentSysmanDeviceImp = pParentSysmanDeviceImp;
}
void LinuxSysmanImp::releasePmtObject() {
for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject) {
delete subDeviceIdToPmtEntry.second;
}
}
LinuxSysmanImp::~LinuxSysmanImp() {
if (nullptr != pSysfsAccess) {
delete pSysfsAccess;
@@ -142,9 +148,7 @@ LinuxSysmanImp::~LinuxSysmanImp() {
delete pPmuInterface;
pPmuInterface = nullptr;
}
for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject) {
delete subDeviceIdToPmtEntry.second;
}
releasePmtObject();
}
OsSysman *OsSysman::create(SysmanDeviceImp *pParentSysmanDeviceImp) {

View File

@@ -41,6 +41,7 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
Device *getDeviceHandle();
SysmanDeviceImp *getSysmanDeviceImp();
std::string getPciRootPortDirectoryPath(std::string realPciPath);
void releasePmtObject();
protected:
XmlParser *pXmlParser = nullptr;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,11 +11,17 @@
namespace L0 {
RasHandleContext::~RasHandleContext() {
void RasHandleContext::releaseRasHandles() {
for (Ras *pRas : handleList) {
delete pRas;
}
handleList.clear();
}
RasHandleContext::~RasHandleContext() {
releaseRasHandles();
}
void RasHandleContext::createHandle(zes_ras_error_type_t type, ze_device_handle_t deviceHandle) {
Ras *pRas = new RasImp(pOsSysman, type, deviceHandle);
handleList.push_back(pRas);

View File

@@ -39,6 +39,7 @@ struct RasHandleContext {
~RasHandleContext();
void init(std::vector<ze_device_handle_t> &deviceHandles);
void releaseRasHandles();
ze_result_t rasGet(uint32_t *pCount, zes_ras_handle_t *phRas);

View File

@@ -151,8 +151,7 @@ TEST_F(SysmanRasFixture, GivenValidRasHandleWhenCallingzesRasSetConfigWithoutPer
memset(setConfig.detailedThresholds.category, 1, sizeof(setConfig.detailedThresholds.category));
EXPECT_EQ(ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, zesRasSetConfig(handle, &setConfig));
}
pSysmanDeviceImp->pRasHandleContext->handleList.pop_back();
delete pTestRasImp;
pSysmanDeviceImp->pRasHandleContext->releaseRasHandles();
}
} // namespace ult