Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd: Fix error handling with multiple userq IDRs

If multiple userq IDR are in use and there is an error handling one
at suspend or resume it will be silently discarded.
Switch the suspend/resume() code to use guards and return immediately.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Mario Limonciello and committed by
Alex Deucher
78779340 173360fe

+11 -14
+11 -14
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
··· 1076 1076 struct amdgpu_usermode_queue *queue; 1077 1077 struct amdgpu_userq_mgr *uqm, *tmp; 1078 1078 int queue_id; 1079 - int ret = 0, r; 1079 + int r; 1080 1080 1081 1081 if (!ip_mask) 1082 1082 return 0; 1083 1083 1084 - mutex_lock(&adev->userq_mutex); 1084 + guard(mutex)(&adev->userq_mutex); 1085 1085 list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) { 1086 1086 cancel_delayed_work_sync(&uqm->resume_work); 1087 - mutex_lock(&uqm->userq_mutex); 1087 + guard(mutex)(&uqm->userq_mutex); 1088 1088 idr_for_each_entry(&uqm->userq_idr, queue, queue_id) { 1089 1089 if (adev->in_s0ix) 1090 1090 r = amdgpu_userq_preempt_helper(uqm, queue); 1091 1091 else 1092 1092 r = amdgpu_userq_unmap_helper(uqm, queue); 1093 1093 if (r) 1094 - ret = r; 1094 + return r; 1095 1095 } 1096 - mutex_unlock(&uqm->userq_mutex); 1097 1096 } 1098 - mutex_unlock(&adev->userq_mutex); 1099 - return ret; 1097 + return 0; 1100 1098 } 1101 1099 1102 1100 int amdgpu_userq_resume(struct amdgpu_device *adev) ··· 1103 1105 struct amdgpu_usermode_queue *queue; 1104 1106 struct amdgpu_userq_mgr *uqm, *tmp; 1105 1107 int queue_id; 1106 - int ret = 0, r; 1108 + int r; 1107 1109 1108 1110 if (!ip_mask) 1109 1111 return 0; 1110 1112 1111 - mutex_lock(&adev->userq_mutex); 1113 + guard(mutex)(&adev->userq_mutex); 1112 1114 list_for_each_entry_safe(uqm, tmp, &adev->userq_mgr_list, list) { 1113 - mutex_lock(&uqm->userq_mutex); 1115 + guard(mutex)(&uqm->userq_mutex); 1114 1116 idr_for_each_entry(&uqm->userq_idr, queue, queue_id) { 1115 1117 if (adev->in_s0ix) 1116 1118 r = amdgpu_userq_restore_helper(uqm, queue); 1117 1119 else 1118 1120 r = amdgpu_userq_map_helper(uqm, queue); 1119 1121 if (r) 1120 - ret = r; 1122 + return r; 1121 1123 } 1122 - mutex_unlock(&uqm->userq_mutex); 1123 1124 } 1124 - mutex_unlock(&adev->userq_mutex); 1125 - return ret; 1125 + 1126 + return 0; 1126 1127 } 1127 1128 1128 1129 int amdgpu_userq_stop_sched_for_enforce_isolation(struct amdgpu_device *adev,