drm/drm_exec: remove contention for num_objects is 0
A message that is not in the archive (sent off-list or not yet received): [email protected]
The subject line should be something like "fix contention when num_objects is 0" to actually note that this is an important bug fix.
Quoted 5 lines · Sunil Khatri
Drivers that chain multiple
drm_exec_prepare_array()calls perdrm_exec_until_all_locked()iteration could passnum_objectsas 0 in one prepare array under contention could lead to infinite retry to lock loop check as contention is never reset in loop with 0 objects.
That needs a bit more description. I know what it is all about but somebody not familiar with the problem won't get why this can cause an endless loop.
Quoted 5 lines
Add an additional check during prepare when
num_objectsis zero resolved this infinite loop.Signed-off-by Sunil Khatri <[email protected]>
That needs CC: stable and Fixes tag. Potentially the patch when drm_exec_prepare_array() was added.
Quoted 9 lines
--- drivers/gpu/drm/drm_exec.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/drm_exec.c +0
-0
drivers/gpu/drm/drm_exec.c int drm_exec_prepare_array(struct drm_exec *exec, · line 327
Quoted 6 lines
drivers/gpu/drm/drm_exec.c +3
-0@@ -322,6 +322,9 @@ int drm_exec_prepare_array(struct drm_exec *exec, {int ret; +if (!num_objects) +return drm_exec_lock_contended (exec); +
We need a comment here explaining why that is important to have.
Something like:
/**
* Make sure to clear look contention when no objects are handled to avoid endless loop in patterns like:
* ret = drm_exec_prepare_array(exec, objs, num_objects); with num_objects = 0
* drm_exec_retry_on_contention(exec);
*/
Regards,
Christian.
Quoted 3 lines
drivers/gpu/drm/drm_exec.c +0
-0for (unsigned int i =0 ; i < num_objects; ++i) { ret =drm_exec_prepare_obj (exec, objects[i], num_fences);if (unlikely (ret))