summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_debugfs_crc.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-06-05 22:45:56 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-06-06 12:35:14 +0300
commit1882018a70e06376234133e69ede9dd743b4dbd9 (patch)
tree77a1bd82ed0ce8105047b554a4d6e8a9e53dd7a8 /drivers/gpu/drm/drm_debugfs_crc.c
parent1a1e5c0f5b84cdfd15735ba1fb0fe4c0da1c831c (diff)
downloadlinux-1882018a70e06376234133e69ede9dd743b4dbd9.tar.xz
drm/crc-debugfs: User irqsafe spinlock in drm_crtc_add_crc_entry
We can be called from any context, we need to be prepared. Noticed this while hacking on vkms, which calls this function from a normal worker. Which really upsets lockdep. Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Cc: Emil Velikov <emil.velikov@collabora.com> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190605194556.16744-1-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/drm_debugfs_crc.c')
-rw-r--r--drivers/gpu/drm/drm_debugfs_crc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index 585169f0dcc5..7f35b5ba1924 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -396,8 +396,9 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
struct drm_crtc_crc *crc = &crtc->crc;
struct drm_crtc_crc_entry *entry;
int head, tail;
+ unsigned long flags;
- spin_lock(&crc->lock);
+ spin_lock_irqsave(&crc->lock, flags);
/* Caller may not have noticed yet that userspace has stopped reading */
if (!crc->entries) {
@@ -428,7 +429,7 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
head = (head + 1) & (DRM_CRC_ENTRIES_NR - 1);
crc->head = head;
- spin_unlock(&crc->lock);
+ spin_unlock_irqrestore(&crc->lock, flags);
wake_up_interruptible(&crc->wq);