]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.9/drm-wake-up-next-in-drm_read-chain-if-we-are-forced-.patch
Linux 4.14.123
[thirdparty/kernel/stable-queue.git] / queue-4.9 / drm-wake-up-next-in-drm_read-chain-if-we-are-forced-.patch
1 From 0a1dd9752b7498685b51a74d341fe540ab8be7e3 Mon Sep 17 00:00:00 2001
2 From: Chris Wilson <chris@chris-wilson.co.uk>
3 Date: Fri, 4 Aug 2017 09:23:28 +0100
4 Subject: drm: Wake up next in drm_read() chain if we are forced to putback the
5 event
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 [ Upstream commit 60b801999c48b6c1dd04e653a38e2e613664264e ]
11
12 After an event is sent, we try to copy it into the user buffer of the
13 first waiter in drm_read() and if the user buffer doesn't have enough
14 room we put it back onto the list. However, we didn't wake up any
15 subsequent waiter, so that event may sit on the list until either a new
16 vblank event is sent or a new waiter appears. Rare, but in the worst
17 case may lead to a stuck process.
18
19 Testcase: igt/drm_read/short-buffer-wakeup
20 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
21 Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
22 Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
23 Link: https://patchwork.freedesktop.org/patch/msgid/20170804082328.17173-1-chris@chris-wilson.co.uk
24 Signed-off-by: Sasha Levin <sashal@kernel.org>
25 ---
26 drivers/gpu/drm/drm_fops.c | 1 +
27 1 file changed, 1 insertion(+)
28
29 diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
30 index c37b7b5f1dd31..921f7f690ae9b 100644
31 --- a/drivers/gpu/drm/drm_fops.c
32 +++ b/drivers/gpu/drm/drm_fops.c
33 @@ -515,6 +515,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
34 file_priv->event_space -= length;
35 list_add(&e->link, &file_priv->event_list);
36 spin_unlock_irq(&dev->event_lock);
37 + wake_up_interruptible(&file_priv->event_wait);
38 break;
39 }
40
41 --
42 2.20.1
43