]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.1/drm-etnaviv-lock-mmu-while-dumping-core.patch
fix up the 5.1 queue :(
[thirdparty/kernel/stable-queue.git] / queue-5.1 / drm-etnaviv-lock-mmu-while-dumping-core.patch
1 From aa701d01362af58c435671d924aff6dd7cac8692 Mon Sep 17 00:00:00 2001
2 From: Lucas Stach <l.stach@pengutronix.de>
3 Date: Tue, 21 May 2019 14:53:40 +0200
4 Subject: drm/etnaviv: lock MMU while dumping core
5
6 [ Upstream commit 1396500d673bd027683a0609ff84dca7eb6ea2e7 ]
7
8 The devcoredump needs to operate on a stable state of the MMU while
9 it is writing the MMU state to the coredump. The missing lock
10 allowed both the userspace submit, as well as the GPU job finish
11 paths to mutate the MMU state while a coredump is under way.
12
13 Fixes: a8c21a5451d8 (drm/etnaviv: add initial etnaviv DRM driver)
14 Reported-by: David Jander <david@protonic.nl>
15 Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
16 Tested-by: David Jander <david@protonic.nl>
17 Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
18 Signed-off-by: Sasha Levin <sashal@kernel.org>
19 ---
20 drivers/gpu/drm/etnaviv/etnaviv_dump.c | 5 +++++
21 1 file changed, 5 insertions(+)
22
23 diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
24 index 33854c94cb85..515515ef24f9 100644
25 --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
26 +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
27 @@ -125,6 +125,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
28 return;
29 etnaviv_dump_core = false;
30
31 + mutex_lock(&gpu->mmu->lock);
32 +
33 mmu_size = etnaviv_iommu_dump_size(gpu->mmu);
34
35 /* We always dump registers, mmu, ring and end marker */
36 @@ -167,6 +169,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
37 iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY,
38 PAGE_KERNEL);
39 if (!iter.start) {
40 + mutex_unlock(&gpu->mmu->lock);
41 dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
42 return;
43 }
44 @@ -234,6 +237,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
45 obj->base.size);
46 }
47
48 + mutex_unlock(&gpu->mmu->lock);
49 +
50 etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);
51
52 dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);
53 --
54 2.20.1
55