Add cgroup support

Some nodes are unavailable based on the task's cgroup hierarchy. Handle
this situation by ignoring those nodes

Change-Id: I72f9e822d2ec8cf15732df95e427d5549a75b55d
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
This commit is contained in:
Harish Kasiviswanathan
2018-08-21 13:59:48 -04:00
parent 866ef20054
commit 7876bb70a9
+9 -3
View File
@@ -501,15 +501,19 @@ static HSAKMT_STATUS topology_sysfs_get_gpu_id(uint32_t sysfs_node_id, uint32_t
if (!fd)
return HSAKMT_STATUS_ERROR;
if (fscanf(fd, "%ul", gpu_id) != 1)
ret = HSAKMT_STATUS_ERROR;
ret = (errno == EPERM) ? HSAKMT_STATUS_NOT_SUPPORTED :
HSAKMT_STATUS_ERROR;
fclose(fd);
return ret;
}
/* Check if the sysfs node is supported. This function will be passed with sysfs node id.
/* Check if the @sysfs_node_id is supported. This function will be passed with sysfs node id.
* This function can not use topology_* help functions, because those functions are
* using user node id. A sysfs node is supported only if corresponding drm render node is available.
* using user node id.
* A sysfs node is not supported
* - if corresponding drm render node is not available.
* - if node information is not accessible (EPERM)
*/
static HSAKMT_STATUS topology_sysfs_check_node_supported(uint32_t sysfs_node_id, bool *is_node_supported)
{
@@ -529,6 +533,8 @@ static HSAKMT_STATUS topology_sysfs_check_node_supported(uint32_t sysfs_node_id,
/* Retrieve the GPU ID */
ret = topology_sysfs_get_gpu_id(sysfs_node_id, &gpu_id);
if (ret == HSAKMT_STATUS_NOT_SUPPORTED)
return HSAKMT_STATUS_SUCCESS;
if (ret != HSAKMT_STATUS_SUCCESS)
return ret;