[Public] Reviewed-by: Prike Liang <prike.li...@amd.com>
Regards, Prike > -----Original Message----- > From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> On Behalf Of Alex > Deucher > Sent: Saturday, April 26, 2025 2:34 AM > To: amd-gfx@lists.freedesktop.org > Cc: Deucher, Alexander <alexander.deuc...@amd.com> > Subject: [PATCH 2/2] drm/amdgpu/userq: take the userq_mgr lock in enforce > isolation > > Add the missing locking. > > Fixes: 94976e7e5ede ("drm/amdgpu/userq: add helpers to start/stop scheduling") > Signed-off-by: Alex Deucher <alexander.deuc...@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > index 1fa9d2be87f39..afbe01149ed3f 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c > @@ -865,6 +865,7 @@ int > amdgpu_userq_stop_sched_for_enforce_isolation(struct amdgpu_device *adev, > adev->userq_halt_for_enforce_isolation = true; > list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) { > cancel_delayed_work_sync(&uqm->resume_work); > + mutex_lock(&uqm->userq_mutex); > idr_for_each_entry(&uqm->userq_idr, queue, queue_id) { > if (((queue->queue_type == AMDGPU_HW_IP_GFX) || > (queue->queue_type == AMDGPU_HW_IP_COMPUTE)) > && @@ -874,6 +875,7 @@ int > amdgpu_userq_stop_sched_for_enforce_isolation(struct amdgpu_device *adev, > ret = r; > } > } > + mutex_unlock(&uqm->userq_mutex); > } > mutex_unlock(&adev->userq_mutex); > return ret; > @@ -897,6 +899,7 @@ int > amdgpu_userq_start_sched_for_enforce_isolation(struct amdgpu_device *adev, > dev_warn(adev->dev, "userq scheduling already started!\n"); > adev->userq_halt_for_enforce_isolation = false; > list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) { > + mutex_lock(&uqm->userq_mutex); > idr_for_each_entry(&uqm->userq_idr, queue, queue_id) { > if (((queue->queue_type == AMDGPU_HW_IP_GFX) || > (queue->queue_type == AMDGPU_HW_IP_COMPUTE)) > && @@ -906,6 +909,7 @@ int > amdgpu_userq_start_sched_for_enforce_isolation(struct amdgpu_device *adev, > ret = r; > } > } > + mutex_unlock(&uqm->userq_mutex); > } > mutex_unlock(&adev->userq_mutex); > return ret; > -- > 2.49.0