sysman:close diagnostics handles before reset
Relates-to:LOCI-2650 Signed-off-by: T J Vivek Vilvaraj <t.j.vivek.vilvaraj@intel.com>
This commit is contained in:
parent
9aad34bb1c
commit
e1a1e96110
|
@ -12,12 +12,15 @@
|
|||
namespace L0 {
|
||||
class OsDiagnostics;
|
||||
DiagnosticsHandleContext::~DiagnosticsHandleContext() {
|
||||
releaseDiagnosticsHandles();
|
||||
}
|
||||
|
||||
void DiagnosticsHandleContext::releaseDiagnosticsHandles() {
|
||||
for (Diagnostics *pDiagnostics : handleList) {
|
||||
delete pDiagnostics;
|
||||
}
|
||||
handleList.clear();
|
||||
}
|
||||
|
||||
void DiagnosticsHandleContext::createHandle(ze_device_handle_t deviceHandle, const std::string &diagTests) {
|
||||
Diagnostics *pDiagnostics = new DiagnosticsImp(pOsSysman, diagTests, deviceHandle);
|
||||
handleList.push_back(pDiagnostics);
|
||||
|
|
|
@ -35,6 +35,7 @@ class Diagnostics : _zes_diag_handle_t {
|
|||
|
||||
struct DiagnosticsHandleContext {
|
||||
DiagnosticsHandleContext(OsSysman *pOsSysman) : pOsSysman(pOsSysman){};
|
||||
void releaseDiagnosticsHandles();
|
||||
~DiagnosticsHandleContext();
|
||||
|
||||
void init(std::vector<ze_device_handle_t> &deviceHandles);
|
||||
|
|
|
@ -12,12 +12,15 @@
|
|||
namespace L0 {
|
||||
class OsFirmware;
|
||||
FirmwareHandleContext::~FirmwareHandleContext() {
|
||||
releaseFwHandles();
|
||||
}
|
||||
|
||||
void FirmwareHandleContext::releaseFwHandles() {
|
||||
for (Firmware *pFirmware : handleList) {
|
||||
delete pFirmware;
|
||||
}
|
||||
handleList.clear();
|
||||
}
|
||||
|
||||
void FirmwareHandleContext::createHandle(const std::string &fwType) {
|
||||
Firmware *pFirmware = new FirmwareImp(pOsSysman, fwType);
|
||||
if (pFirmware->isFirmwareEnabled == true) {
|
||||
|
|
|
@ -36,6 +36,7 @@ class Firmware : _zes_firmware_handle_t {
|
|||
struct FirmwareHandleContext {
|
||||
FirmwareHandleContext(OsSysman *pOsSysman) : pOsSysman(pOsSysman){};
|
||||
~FirmwareHandleContext();
|
||||
void releaseFwHandles();
|
||||
|
||||
void init();
|
||||
|
||||
|
|
|
@ -124,7 +124,10 @@ static void getPidFdsForOpenDevice(ProcfsAccess *pProcfsAccess, SysfsAccess *pSy
|
|||
void LinuxGlobalOperationsImp::releaseSysmanDeviceResources() {
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pEngineHandleContext->releaseEngines();
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pRasHandleContext->releaseRasHandles();
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pDiagnosticsHandleContext->releaseDiagnosticsHandles();
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pFirmwareHandleContext->releaseFwHandles();
|
||||
pLinuxSysmanImp->releasePmtObject();
|
||||
pLinuxSysmanImp->releaseFwUtilInterface();
|
||||
pLinuxSysmanImp->releaseLocalDrmHandle();
|
||||
}
|
||||
|
||||
|
@ -140,8 +143,11 @@ void LinuxGlobalOperationsImp::releaseDeviceResources() {
|
|||
void LinuxGlobalOperationsImp::reInitSysmanDeviceResources() {
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->updateSubDeviceHandlesLocally();
|
||||
pLinuxSysmanImp->createPmtHandles();
|
||||
pLinuxSysmanImp->createFwUtilInterface();
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pRasHandleContext->init(pLinuxSysmanImp->getSysmanDeviceImp()->deviceHandles);
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pEngineHandleContext->init();
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pDiagnosticsHandleContext->init(pLinuxSysmanImp->getSysmanDeviceImp()->deviceHandles);
|
||||
pLinuxSysmanImp->getSysmanDeviceImp()->pFirmwareHandleContext->init();
|
||||
}
|
||||
|
||||
ze_result_t LinuxGlobalOperationsImp::initDevice() {
|
||||
|
@ -322,9 +328,9 @@ ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vector<zes_process
|
|||
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
if (ZE_RESULT_ERROR_NOT_AVAILABLE == result) {
|
||||
//update the result as Success as ZE_RESULT_ERROR_NOT_AVAILABLE is expected if the "realClientPidPath" folder is empty
|
||||
//this condition(when encountered) must not prevent the information accumulated for other clientIds
|
||||
//this situation occurs when there is no call modifying result,
|
||||
// update the result as Success as ZE_RESULT_ERROR_NOT_AVAILABLE is expected if the "realClientPidPath" folder is empty
|
||||
// this condition(when encountered) must not prevent the information accumulated for other clientIds
|
||||
// this situation occurs when there is no call modifying result,
|
||||
result = ZE_RESULT_SUCCESS;
|
||||
continue;
|
||||
} else {
|
||||
|
@ -338,10 +344,10 @@ ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vector<zes_process
|
|||
result = pSysfsAccess->scanDirEntries(busyDirForEngines, engineNums);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
if (ZE_RESULT_ERROR_NOT_AVAILABLE == result) {
|
||||
//update the result as Success as ZE_RESULT_ERROR_NOT_AVAILABLE is expected if the "realClientPidPath" folder is empty
|
||||
//this condition(when encountered) must not prevent the information accumulated for other clientIds
|
||||
//this situation occurs when there is no call modifying result,
|
||||
//Here its seen when the last element of clientIds returns ZE_RESULT_ERROR_NOT_AVAILABLE for some reason.
|
||||
// update the result as Success as ZE_RESULT_ERROR_NOT_AVAILABLE is expected if the "realClientPidPath" folder is empty
|
||||
// this condition(when encountered) must not prevent the information accumulated for other clientIds
|
||||
// this situation occurs when there is no call modifying result,
|
||||
// Here its seen when the last element of clientIds returns ZE_RESULT_ERROR_NOT_AVAILABLE for some reason.
|
||||
engineType = ZES_ENGINE_TYPE_FLAG_OTHER; // When busy node is absent assign engine type with ZES_ENGINE_TYPE_FLAG_OTHER
|
||||
} else {
|
||||
return result;
|
||||
|
@ -444,7 +450,6 @@ LinuxGlobalOperationsImp::LinuxGlobalOperationsImp(OsSysman *pOsSysman) {
|
|||
pProcfsAccess = &pLinuxSysmanImp->getProcfsAccess();
|
||||
pFsAccess = &pLinuxSysmanImp->getFsAccess();
|
||||
pDevice = pLinuxSysmanImp->getDeviceHandle();
|
||||
pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||
auto device = static_cast<DeviceImp *>(pDevice);
|
||||
devicePciBdf = device->getNEODevice()->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>()->getPciPath();
|
||||
executionEnvironment = device->getNEODevice()->getExecutionEnvironment();
|
||||
|
|
|
@ -37,8 +37,6 @@ class LinuxGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMo
|
|||
SysfsAccess *pSysfsAccess = nullptr;
|
||||
LinuxSysmanImp *pLinuxSysmanImp = nullptr;
|
||||
Device *pDevice = nullptr;
|
||||
FirmwareUtil *pFwInterface = nullptr;
|
||||
|
||||
int resetTimeout = 10000; // in milliseconds
|
||||
void releaseSysmanDeviceResources();
|
||||
void releaseDeviceResources();
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "level_zero/tools/source/sysman/linux/fs_access.h"
|
||||
|
||||
#include "sysman/linux/firmware_util/firmware_util.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
ze_result_t LinuxSysmanImp::init() {
|
||||
|
@ -39,10 +41,22 @@ ze_result_t LinuxSysmanImp::init() {
|
|||
pPmuInterface = PmuInterface::create(this);
|
||||
|
||||
DEBUG_BREAK_IF(nullptr == pPmuInterface);
|
||||
pFwUtilInterface = FirmwareUtil::create(pDrm->getPciPath());
|
||||
|
||||
createFwUtilInterface();
|
||||
return createPmtHandles();
|
||||
}
|
||||
|
||||
void LinuxSysmanImp::createFwUtilInterface() {
|
||||
std::string realRootPath;
|
||||
auto result = pSysfsAccess->getRealPath("device", realRootPath);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
return;
|
||||
}
|
||||
auto rootPciPathOfGpuDevice = getPciRootPortDirectoryPath(realRootPath);
|
||||
auto loc = realRootPath.find_last_of('/');
|
||||
pFwUtilInterface = FirmwareUtil::create(realRootPath.substr(loc + 1, std::string::npos));
|
||||
}
|
||||
|
||||
ze_result_t LinuxSysmanImp::createPmtHandles() {
|
||||
std::string realRootPath;
|
||||
auto result = pSysfsAccess->getRealPath("device", realRootPath);
|
||||
|
@ -146,6 +160,12 @@ void LinuxSysmanImp::releasePmtObject() {
|
|||
}
|
||||
mapOfSubDeviceIdToPmtObject.clear();
|
||||
}
|
||||
void LinuxSysmanImp::releaseFwUtilInterface() {
|
||||
if (nullptr != pFwUtilInterface) {
|
||||
delete pFwUtilInterface;
|
||||
pFwUtilInterface = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
LinuxSysmanImp::~LinuxSysmanImp() {
|
||||
if (nullptr != pSysfsAccess) {
|
||||
|
@ -160,14 +180,11 @@ LinuxSysmanImp::~LinuxSysmanImp() {
|
|||
delete pFsAccess;
|
||||
pFsAccess = nullptr;
|
||||
}
|
||||
if (nullptr != pFwUtilInterface) {
|
||||
delete pFwUtilInterface;
|
||||
pFwUtilInterface = nullptr;
|
||||
}
|
||||
if (nullptr != pPmuInterface) {
|
||||
delete pPmuInterface;
|
||||
pPmuInterface = nullptr;
|
||||
}
|
||||
releaseFwUtilInterface();
|
||||
releasePmtObject();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
|
|||
std::string getPciRootPortDirectoryPath(std::string realPciPath);
|
||||
void releasePmtObject();
|
||||
ze_result_t createPmtHandles();
|
||||
void createFwUtilInterface();
|
||||
void releaseFwUtilInterface();
|
||||
void releaseLocalDrmHandle();
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue