]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/drm-virtio-do-not-reuse-resource-ids.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.0 / drm-virtio-do-not-reuse-resource-ids.patch
1 From 16065fcdd19ddb9e093192914ac863884f308766 Mon Sep 17 00:00:00 2001
2 From: Gerd Hoffmann <kraxel@redhat.com>
3 Date: Fri, 8 Feb 2019 15:04:09 +0100
4 Subject: drm/virtio: do NOT reuse resource ids
5
6 From: Gerd Hoffmann <kraxel@redhat.com>
7
8 commit 16065fcdd19ddb9e093192914ac863884f308766 upstream.
9
10 Bisected guest kernel changes crashing qemu. Landed at
11 "6c1cd97bda drm/virtio: fix resource id handling". Looked again, and
12 noticed we where not only leaking *some* ids, but *all* ids. The old
13 code never ever called virtio_gpu_resource_id_put().
14
15 So, commit 6c1cd97bda effectively makes the linux kernel starting
16 re-using IDs after releasing them, and apparently virglrenderer can't
17 deal with that. Oops.
18
19 This patch puts a temporary stopgap into place for the 5.0 release.
20
21 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
22 Reviewed-by: Dave Airlie <airlied@redhat.com>
23 Signed-off-by: Dave Airlie <airlied@redhat.com>
24 Link: https://patchwork.freedesktop.org/patch/msgid/20190208140409.15280-1-kraxel@redhat.com
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 drivers/gpu/drm/virtio/virtgpu_object.c | 13 +++++++++++++
29 1 file changed, 13 insertions(+)
30
31 --- a/drivers/gpu/drm/virtio/virtgpu_object.c
32 +++ b/drivers/gpu/drm/virtio/virtgpu_object.c
33 @@ -28,10 +28,21 @@
34 static int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
35 uint32_t *resid)
36 {
37 +#if 0
38 int handle = ida_alloc(&vgdev->resource_ida, GFP_KERNEL);
39
40 if (handle < 0)
41 return handle;
42 +#else
43 + static int handle;
44 +
45 + /*
46 + * FIXME: dirty hack to avoid re-using IDs, virglrenderer
47 + * can't deal with that. Needs fixing in virglrenderer, also
48 + * should figure a better way to handle that in the guest.
49 + */
50 + handle++;
51 +#endif
52
53 *resid = handle + 1;
54 return 0;
55 @@ -39,7 +50,9 @@ static int virtio_gpu_resource_id_get(st
56
57 static void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
58 {
59 +#if 0
60 ida_free(&vgdev->resource_ida, id - 1);
61 +#endif
62 }
63
64 static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)