public inbox for dri-devel@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/4] dma-fence: Propagate errors to dma-fence-array container
@ 2019-08-10 15:34 Chris Wilson
  2019-08-10 15:34 ` [PATCH 2/4] dma-fence: Report the composite sync_file status Chris Wilson
                   ` (5 more replies)
  0 siblings, 6 replies; 29+ messages in thread
From: Chris Wilson @ 2019-08-10 15:34 UTC (permalink / raw)
  To: dri-devel; +Cc: Gustavo Padovan, intel-gfx, christian.koenig

When one of the array of fences is signaled, propagate its errors to the
parent fence-array (keeping the first error to be raised).

v2: Opencode cmpxchg_local to avoid compiler freakout.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
---
 drivers/dma-buf/dma-fence-array.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index 12c6f64c0bc2..d90675bb4fcc 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -13,6 +13,12 @@
 #include <linux/slab.h>
 #include <linux/dma-fence-array.h>
 
+static void fence_set_error_once(struct dma_fence *fence, int error)
+{
+	if (!fence->error && error)
+		dma_fence_set_error(fence, error);
+}
+
 static const char *dma_fence_array_get_driver_name(struct dma_fence *fence)
 {
 	return "dma_fence_array";
@@ -38,6 +44,13 @@ static void dma_fence_array_cb_func(struct dma_fence *f,
 		container_of(cb, struct dma_fence_array_cb, cb);
 	struct dma_fence_array *array = array_cb->array;
 
+	/*
+	 * Propagate the first error reported by any of our fences, but only
+	 * before we ourselves are signaled.
+	 */
+	if (atomic_read(&array->num_pending) > 0)
+		fence_set_error_once(&array->base, f->error);
+
 	if (atomic_dec_and_test(&array->num_pending))
 		irq_work_queue(&array->work);
 	else
@@ -63,6 +76,8 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
 		dma_fence_get(&array->base);
 		if (dma_fence_add_callback(array->fences[i], &cb[i].cb,
 					   dma_fence_array_cb_func)) {
+			fence_set_error_once(&array->base,
+					     array->fences[i]->error);
 			dma_fence_put(&array->base);
 			if (atomic_dec_and_test(&array->num_pending))
 				return false;
-- 
2.23.0.rc1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2019-08-16  7:58 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-10 15:34 [PATCH 1/4] dma-fence: Propagate errors to dma-fence-array container Chris Wilson
2019-08-10 15:34 ` [PATCH 2/4] dma-fence: Report the composite sync_file status Chris Wilson
2019-08-12  9:05   ` [Intel-gfx] " Matthew Auld
2019-08-10 15:34 ` [PATCH 3/4] dma-fence: Refactor signaling for manual invocation Chris Wilson
2019-08-12 14:34   ` Koenig, Christian
2019-08-12 14:43     ` Chris Wilson
2019-08-12 14:50       ` Koenig, Christian
2019-08-12 14:53         ` Chris Wilson
2019-08-13  6:59           ` Koenig, Christian
2019-08-13  8:25             ` Chris Wilson
2019-08-13  8:49               ` Koenig, Christian
2019-08-10 15:34 ` [PATCH 4/4] dma-fence: Always execute signal callbacks Chris Wilson
2019-08-11  9:01   ` Koenig, Christian
2019-08-11  9:15     ` [PATCH 5/4] dma-fence: Have dma_fence_signal call signal_locked Chris Wilson
2019-08-11 16:09       ` Koenig, Christian
2019-08-14 17:20       ` Daniel Vetter
2019-08-15 18:45         ` Chris Wilson
2019-08-15 18:48           ` Daniel Vetter
2019-08-15 19:03             ` Chris Wilson
2019-08-15 19:29               ` Chris Wilson
2019-08-16  7:58                 ` Koenig, Christian
2019-08-11  8:58 ` [PATCH 1/4] dma-fence: Propagate errors to dma-fence-array container Koenig, Christian
2019-08-11 11:56   ` Chris Wilson
2019-08-11 12:09 ` [PATCH v3] " Chris Wilson
2019-08-11 12:21 ` [PATCH v4] " Chris Wilson
2019-08-11 16:08   ` Koenig, Christian
2019-08-11 16:25     ` [PATCH v5] " Chris Wilson
2019-08-11 16:28       ` Koenig, Christian
2019-08-11 19:33   ` [PATCH v4] " kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox