Skip to contentSkip to conversation

drm/i915/sw_fence: Allocate callbacks from dedicates slab caches

RFC In review Tvrtko Ursulin 3 participants 3 messages Nov 2, 2016

Subsystems (2)
lore
Share & tools
lore

Tvrtko Ursulin

author maintainer
#0 lore raw

RFC 1/1 drm/i915/sw_fence: Allocate callbacks from dedicates slab caches

From: Tvrtko Ursulin <[email protected]>

Not sure if it matters for performance at all but it should save some wastage and enable a better insight into the usage.

---
 drivers/gpu/drm/i915/i915_gem.c      | 10 +++++-
 drivers/gpu/drm/i915/i915_sw_fence.c | 67 +++++++++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/i915_sw_fence.h |  3 ++
 3 files changed, 75 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +9 -1
index 5839bebba64a..57e550449992 100644
@@ -4748,6 +4748,10 @@ i915_gem_load_init(struct drm_device *dev)
 		goto err_vmas;
 	}
 
+	err = i915_init_sw_fences();
+	if (err)
+		goto err_requests;
+
 	mutex_lock(&dev_priv->drm.struct_mutex);
 	INIT_LIST_HEAD(&dev_priv->gt.timelines);
 	err = i915_gem_timeline_init(dev_priv,
@@ -4755,7 +4759,7 @@ i915_gem_load_init(struct drm_device *dev)
 				     "[execution]");
 	mutex_unlock(&dev_priv->drm.struct_mutex);
 	if (err)
-		goto err_requests;
+		goto err_sw_fences;
 
 	INIT_LIST_HEAD(&dev_priv->context_list);
 	INIT_WORK(&dev_priv->mm.free_work, __i915_gem_free_work);
@@ -4783,6 +4787,8 @@ i915_gem_load_init(struct drm_device *dev)
 
 	return 0;
 
+err_sw_fences:
+	i915_fini_sw_fences();
 err_requests:
 	kmem_cache_destroy(dev_priv->requests);
 err_vmas:
@@ -4799,6 +4805,8 @@ void i915_gem_load_cleanup(struct drm_device *dev)
 
 	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
 
+	i915_fini_sw_fences();
+
 	kmem_cache_destroy(dev_priv->requests);
 	kmem_cache_destroy(dev_priv->vmas);
 	kmem_cache_destroy(dev_priv->objects);
drivers/gpu/drm/i915/i915_sw_fence.c +63 -4

100 lines not on this page · raw message

drivers/gpu/drm/i915/i915_sw_fence.h +3 -0
index 707dfc4f0da5..33153a9c6f2a 100644
@@ -40,6 +40,9 @@ typedef int (*i915_sw_fence_notify_t)(struct i915_sw_fence *,
 				      enum i915_sw_fence_notify state);
 #define __i915_sw_fence_call __aligned(4)
 
+int i915_init_sw_fences(void);
+void i915_fini_sw_fences(void);
+
 void i915_sw_fence_init(struct i915_sw_fence *fence, i915_sw_fence_notify_t fn);
 void i915_sw_fence_commit(struct i915_sw_fence *fence);
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 4 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Not sure if it matters for performance at all but it should save some wastage and enable a better insight into the usage.

With the caveat of avoiding the plug into the i915.ko...

This should wait until after kernel/fence.c, as the split will make this a little more interesting.

drivers/gpu/drm/i915/i915_sw_fence.c int i915_sw_fence_await_reservation(struct i915_sw_fence *fence, · line 406

Quoted 5 lines
drivers/gpu/drm/i915/i915_sw_fence.c +5 -0
+int i915_init_sw_fences(void)
+{
+	struct kmem_cache *wq_cache, *cb_cache;
+
+	mutex_lock(&i915_sw_fence_mutex);

If switched over to init ctor, the mutex is then redundant.

drivers/gpu/drm/i915/i915_sw_fence.c int i915_sw_fence_await_reservation(struct i915_sw_fence *fence, · line 419

Quoted 12 lines
drivers/gpu/drm/i915/i915_sw_fence.c +12 -0
+	if (i915_sw_fence_usecnt == 0) {
+		wq_cache = kmem_cache_create("i915_sw_fence_wq",
+					     sizeof(wait_queue_t),
+					     __alignof__(wait_queue_head_t),
+					     0, NULL);
+		if (!wq_cache)
+			goto err;
+
+		cb_cache = kmem_cache_create("i915_sw_fence_cb",
+					     sizeof(struct i915_sw_dma_fence_cb),
+					     __alignof__(struct i915_sw_dma_fence_cb),
+					     0, NULL);

For example, this cache will need to end up in
drivers/dma-buf/dma-fence.c
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✓ Fi.CI.BAT: success for drm/i915/sw_fence: Allocate callbacks from dedicates slab caches

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915/sw_fence: Allocate callbacks from dedicates slab caches
URL : https://patchwork.freedesktop.org/series/14750/
State : success

== Summary ==

Series 14750v1 drm/i915/sw_fence: Allocate callbacks from dedicates slab caches
https://patchwork.freedesktop.org/api/1.0/series/14750/revisions/1/mbox/

fi-bdw-5557u     total:241  pass:226  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:241  pass:201  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:241  pass:213  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:241  pass:213  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:241  pass:209  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:241  pass:221  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-ilk-650       total:241  pass:187  dwarn:0   dfail:0   fail:0   skip:54 
fi-ivb-3520m     total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-ivb-3770      total:241  pass:218  dwarn:0   dfail:0   fail:0   skip:23 
fi-kbl-7200u     total:241  pass:219  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:241  pass:227  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:241  pass:220  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:241  pass:219  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:241  pass:227  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:241  pass:208  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:241  pass:207  dwarn:0   dfail:0   fail:0   skip:34 

bf6b989af8b0fde56a352d9005c97b2d8e3bbbe3 drm-intel-nightly: 2016y-11m-02d-15h-44m-03s UTC integration manifest 7adc7ac drm/i915/sw_fence: Allocate callbacks from dedicates slab caches

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_2893/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx