1 |
From 476fdcdaaae7b06c780cdfc234c704107f16c529 Mon Sep 17 00:00:00 2001 |
2 |
From: Nirmoy Das <nirmoy.das@intel.com> |
3 |
Date: Fri, 23 Dec 2022 10:20:11 +0100 |
4 |
Subject: drm/i915: Reserve enough fence slot for i915_vma_unbind_async |
5 |
MIME-Version: 1.0 |
6 |
Content-Type: text/plain; charset=UTF-8 |
7 |
Content-Transfer-Encoding: 8bit |
8 |
|
9 |
From: Nirmoy Das <nirmoy.das@intel.com> |
10 |
|
11 |
commit 476fdcdaaae7b06c780cdfc234c704107f16c529 upstream. |
12 |
|
13 |
A nested dma_resv_reserve_fences(1) will not reserve slot from the |
14 |
2nd call onwards and folowing dma_resv_add_fence() might hit the |
15 |
"BUG_ON(fobj->num_fences >= fobj->max_fences)" check. |
16 |
|
17 |
I915 hit above nested dma_resv case in ttm_bo_handle_move_mem() with |
18 |
async unbind: |
19 |
|
20 |
dma_resv_reserve_fences() from --> ttm_bo_handle_move_mem() |
21 |
dma_resv_reserve_fences() from --> i915_vma_unbind_async() |
22 |
dma_resv_add_fence() from --> i915_vma_unbind_async() |
23 |
dma_resv_add_fence() from -->ttm_bo_move_accel_cleanup() |
24 |
|
25 |
Resolve this by adding an extra fence in i915_vma_unbind_async(). |
26 |
|
27 |
Suggested-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> |
28 |
Fixes: 2f6b90da9192 ("drm/i915: Use vma resources for async unbinding") |
29 |
Cc: <stable@vger.kernel.org> # v5.18+ |
30 |
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com> |
31 |
Reviewed-by: Matthew Auld <matthew.auld@intel.com> |
32 |
Signed-off-by: Matthew Auld <matthew.auld@intel.com> |
33 |
Link: https://patchwork.freedesktop.org/patch/msgid/20221223092011.11657-1-nirmoy.das@intel.com |
34 |
(cherry picked from commit 4f0755c2faf7388616109717facc5bbde6850e60) |
35 |
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> |
36 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
37 |
--- |
38 |
drivers/gpu/drm/i915/i915_vma.c | 2 +- |
39 |
1 file changed, 1 insertion(+), 1 deletion(-) |
40 |
|
41 |
--- a/drivers/gpu/drm/i915/i915_vma.c |
42 |
+++ b/drivers/gpu/drm/i915/i915_vma.c |
43 |
@@ -2114,7 +2114,7 @@ int i915_vma_unbind_async(struct i915_vm |
44 |
if (!obj->mm.rsgt) |
45 |
return -EBUSY; |
46 |
|
47 |
- err = dma_resv_reserve_fences(obj->base.resv, 1); |
48 |
+ err = dma_resv_reserve_fences(obj->base.resv, 2); |
49 |
if (err) |
50 |
return -EBUSY; |
51 |
|