Skip to contentSkip to conversation

drm/i915: Accomodate for nested dma_resv fence addition

PATCH In review Nirmoy Das 2 participants 3 messages Dec 19, 2022

Subsystems (2)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 drm/i915: Accomodate for nested dma_resv fence addition

We have below nested fence slot reservation and then fence addition to that dma_resv.
dma_resv_reserve_fences() from --> ttm_bo_handle_move_mem()

        dma_resv_reserve_fences() from --> i915_vma_unbind_async()
        dma_resv_add_fence() from --> i915_vma_unbind_async()

dma_resv_add_fence() from -->ttm_bo_move_accel_cleanup()

A nested dma_resv_reserve_fences will not reserve extra slots and if the BO comes with lots of fences in its dma_resv, we might see:

BUG_ON(fobj->num_fences >= fobj->max_fences);

---
 drivers/gpu/drm/i915/i915_vma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_vma.c +1 -1
index 7d044888ac33..5ac4c1c2403c 100644
@@ -2149,7 +2149,7 @@ int i915_vma_unbind_async(struct i915_vma *vma, bool trylock_vm)
 	if (!obj->mm.rsgt)
 		return -EBUSY;
 
-	err = dma_resv_reserve_fences(obj->base.resv, 1);
+	err = dma_resv_reserve_fences(obj->base.resv, 2);
 	if (err)
 		return -EBUSY;
 
Signature · 1 line
2.38.0
#1 lore raw

This needs better explanation and probably CC to stable.

Please ignore this, I will resend.

Nirmoy

Quoted 31 lines · Nirmoy Das

We have below nested fence slot reservation and then fence addition to that dma_resv.
dma_resv_reserve_fences() from --> ttm_bo_handle_move_mem()

         dma_resv_reserve_fences() from --> i915_vma_unbind_async()
         dma_resv_add_fence() from --> i915_vma_unbind_async()

dma_resv_add_fence() from -->ttm_bo_move_accel_cleanup()

A nested dma_resv_reserve_fences will not reserve extra slots and if the BO comes with lots of fences in its dma_resv, we might see:

BUG_ON(fobj->num_fences >= fobj->max_fences);

---
  drivers/gpu/drm/i915/i915_vma.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_vma.c +1 -1
index 7d044888ac33..5ac4c1c2403c 100644
@@ -2149,7 +2149,7 @@ int i915_vma_unbind_async(struct i915_vma *vma, bool trylock_vm)
  	if (!obj->mm.rsgt)
  		return -EBUSY;
 
-	err = dma_resv_reserve_fences(obj->base.resv, 1);
+	err = dma_resv_reserve_fences(obj->base.resv, 2);
  	if (err)
  		return -EBUSY;
 
#2 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Accomodate for nested dma_resv fence addition

In reply to Nirmoy Das
== Series Details ==

== Series Details ==

Series: drm/i915: Accomodate for nested dma_resv fence addition
URL : https://patchwork.freedesktop.org/series/112054/
State : warning

== Summary ==

Error: dim checkpatch failed
ce8f7ee44caa drm/i915: Accomodate for nested dma_resv fence addition -:4: WARNING:TYPO_SPELLING: 'Accomodate' may be misspelled - perhaps 'Accommodate'? #4:
Subject: [PATCH] drm/i915: Accomodate for nested dma_resv fence addition

                           ^^^^^^^^^^

total: 0 errors, 1 warnings, 0 checks, 8 lines checked