]> git.baikalelectronics.ru Git - kernel.git/commit
drm: Avoid drm_global_mutex for simple inc/dec of dev->open_count
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 24 Jan 2020 13:01:07 +0000 (13:01 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 24 Jan 2020 17:41:34 +0000 (17:41 +0000)
commitdcb95d89978516ba0b5fb2c30a947e840f4c672a
treea20b339f718dd71ca66899a60a970230acc5963a
parent2aa4ef8657f405be9d5b8a71772c566f67ce458f
drm: Avoid drm_global_mutex for simple inc/dec of dev->open_count

Since drm_global_mutex is a true global mutex across devices, we don't
want to acquire it unless absolutely necessary. For maintaining the
device local open_count, we can use atomic operations on the counter
itself, except when making the transition to/from 0. Here, we tackle the
easy portion of delaying acquiring the drm_global_mutex for the final
release by using atomic_dec_and_mutex_lock(), leaving the global
serialisation across the device opens.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Hellström (VMware) <thomas_os@shipmail.org>
Reviewed-by: Thomas Hellström <thellstrom@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200124130107.125404-1-chris@chris-wilson.co.uk
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/drm_file.c
drivers/gpu/drm/i915/i915_switcheroo.c
drivers/gpu/drm/nouveau/nouveau_vga.c
drivers/gpu/drm/radeon/radeon_device.c
include/drm/drm_device.h