Am 10.01.25 um 04:38 schrieb Srinivasan Shanmugam:
This commit adds mutex locking to the `amdgpu_vmid_mgr_init` function.
By acquiring and releasing the `enforce_isolation_mutex`, so that it now
safely allocates reserved VMIDs, which is important for enforcing
isolation between different GPU processes.
Mutex ensures that the process of allocating VMIDs is done
correctly and without interference
That is unnecessary.
The VMID mgr is only initialized during driver load and at that moment
the enforce isolation setting should be static.
Regards,
Christian.
Fixes: 96595204195d ("drm/amdgpu: Make enforce_isolation setting per GPU")
Cc: Christian König <christian.koenig@xxxxxxx>
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
index 8e712a11aba5..6ae835a7f031 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
@@ -602,10 +602,12 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev)
}
}
/* alloc a default reserved vmid to enforce isolation */
+ mutex_lock(&adev->enforce_isolation_mutex);
for (i = 0; i < (adev->xcp_mgr ? adev->xcp_mgr->num_xcps : 1); i++) {
if (adev->enforce_isolation[i])
amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i));
}
+ mutex_unlock(&adev->enforce_isolation_mutex);
}
/**