Bug 117861 - DRM dead lock code path
Summary: DRM dead lock code path
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - non Intel) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_video-dri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-09 06:53 UTC by Qiang Yu
Modified: 2016-07-08 17:55 UTC (History)
1 user (show)

See Also:
Kernel Version: master 4.4/4.5/4.6
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Qiang Yu 2016-05-09 06:53:01 UTC
dead lock code path exist for DRM
drivers/gpu/drm/{drm_prime.c,drm_gem.c}

drm_gem_prime_fd_to_handle()
| mutex_lock(&file_priv->prime.lock);
| drm_prime_add_buf_handle() goto fail
| drm_gem_handle_delete()
| | drm_gem_object_release_handle()
| | | drm_gem_remove_prime_handles()
| | | | mutex_lock(&filp->prime.lock)
| mutex_unlock(&file_priv->prime.lock)
Comment 1 Alex Deucher 2016-05-10 17:21:04 UTC
I believe this is fixed in:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6984128d01cf935820a0563f3a00c6623ba58109
Which should probably go to stable.
Comment 2 Qiang Yu 2016-05-11 01:37:38 UTC
(In reply to Alex Deucher from comment #1)
> I believe this is fixed in:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/
> ?id=6984128d01cf935820a0563f3a00c6623ba58109
> Which should probably go to stable.

Your fix is in 4.5 kernel and related to another dead lock path:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1579610

This dead lock path is different and remains in the kernel master branch.
Comment 3 Alex Deucher 2016-07-08 17:55:08 UTC
fixed in:
https://cgit.freedesktop.org/~airlied/linux/commit/?h=drm-next&id=bd6e2732f0e2894ce792f344c41fc32591436fe3

drm/prime: fix error path deadlock fail
There were a couple messed up things about this fail path.
(1) it would drop object_name_lock twice
(2) drm_gem_handle_delete() (in drm_gem_remove_prime_handles())
    needs to grab prime_lock

Reported-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465500559-17873-1-git-send-email-robdclark@gmail.com

Which should go upstream in the next merge window.

Note You need to log in before you can comment on or make changes to this bug.