Skip to contentSkip to conversation

dma-buf: add new dma_fence_chain container v4

PATCH In review Chunming Zhou 8 participants 24 messages Dec 11, 2018 – Dec 13, 2018 3 messages not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/10 dma-buf: add new dma_fence_chain container v4

From: Christian König <[email protected]>

Lockless container implementation similar to a dma_fence_array, but with only two elements per node and automatic garbage collection.

v2: properly document dma_fence_chain_for_each, add dma_fence_chain_find_seqno,
drop prev reference during garbage collection if it's not a chain fence.
v3: use head and iterator for dma_fence_chain_for_each
v4: fix reference count in dma_fence_chain_enable_signaling

---
 drivers/dma-buf/Makefile          |   3 +-
 drivers/dma-buf/dma-fence-chain.c | 241 ++++++++++++++++++++++++++++++
 include/linux/dma-fence-chain.h   |  81 ++++++++++
 3 files changed, 324 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma-buf/dma-fence-chain.c
 create mode 100644 include/linux/dma-fence-chain.h
drivers/dma-buf/Makefile +2 -1
index 0913a6ccab5a..1f006e083eb9 100644
@@ -1,4 +1,5 @@
-obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o
+obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
+	 reservation.o seqno-fence.o
 obj-$(CONFIG_SYNC_FILE)		+= sync_file.o
 obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)		+= udmabuf.o
drivers/dma-buf/dma-fence-chain.c new file +241 -0

241 lines not on this page · raw message

include/linux/dma-fence-chain.h new file +81 -0

81 lines not on this page · raw message

Signature · 6 lines
2.17.1

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

PATCH 2/10 drm/syncobj: remove drm_syncobj_cb and cleanup

From: Christian König <[email protected]>

This completes "drm/syncobj: Drop add/remove_callback from driver interface" and cleans up the implementation a bit.

---
 drivers/gpu/drm/drm_syncobj.c | 91 ++++++++++++-----------------------
 include/drm/drm_syncobj.h     | 21 --------
 2 files changed, 30 insertions(+), 82 deletions(-)
drivers/gpu/drm/drm_syncobj.c +30 -61
index db30a0e89db8..e19525af0cce 100644
@@ -56,6 +56,16 @@
 #include "drm_internal.h"
 #include <drm/drm_syncobj.h>
 
+struct syncobj_wait_entry {
+	struct list_head node;
+	struct task_struct *task;
+	struct dma_fence *fence;
+	struct dma_fence_cb fence_cb;
+};
+
+static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj,
+				      struct syncobj_wait_entry *wait);
+
 /**
  * drm_syncobj_find - lookup and reference a sync object.
  * @file_private: drm file private pointer
@@ -82,58 +92,33 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private,
 }
 EXPORT_SYMBOL(drm_syncobj_find);
 
-static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj,
-					    struct drm_syncobj_cb *cb,
-					    drm_syncobj_func_t func)
+static void drm_syncobj_fence_add_wait(struct drm_syncobj *syncobj,
+				       struct syncobj_wait_entry *wait)
 {
-	cb->func = func;
-	list_add_tail(&cb->node, &syncobj->cb_list);
-}
-
-static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj,
-						 struct dma_fence **fence,
-						 struct drm_syncobj_cb *cb,
-						 drm_syncobj_func_t func)
-{
-	int ret;
-
-	*fence = drm_syncobj_fence_get(syncobj);
-	if (*fence)
-		return 1;
+	if (wait->fence)
+		return;
 
 	spin_lock(&syncobj->lock);
 	/* We've already tried once to get a fence and failed.  Now that we
 	 * have the lock, try one more time just to be sure we don't add a
 	 * callback when a fence has already been set.
 	 */
-	if (syncobj->fence) {
-		*fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
-								 lockdep_is_held(&syncobj->lock)));
-		ret = 1;
-	} else {
-		*fence = NULL;
-		drm_syncobj_add_callback_locked(syncobj, cb, func);
-		ret = 0;
-	}
+	if (syncobj->fence)
+		wait->fence = dma_fence_get(
+			rcu_dereference_protected(syncobj->fence, 1));
+	else
+		list_add_tail(&wait->node, &syncobj->cb_list);
 	spin_unlock(&syncobj->lock);
-
-	return ret;
 }
 
-void drm_syncobj_add_callback(struct drm_syncobj *syncobj,
-			      struct drm_syncobj_cb *cb,
-			      drm_syncobj_func_t func)
+static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj,
+				    struct syncobj_wait_entry *wait)
 {
-	spin_lock(&syncobj->lock);
-	drm_syncobj_add_callback_locked(syncobj, cb, func);
-	spin_unlock(&syncobj->lock);
-}
+	if (!wait->node.next)
+		return;
 
-void drm_syncobj_remove_callback(struct drm_syncobj *syncobj,
-				 struct drm_syncobj_cb *cb)
-{
 	spin_lock(&syncobj->lock);
-	list_del_init(&cb->node);
+	list_del_init(&wait->node);
 	spin_unlock(&syncobj->lock);
 }
 
@@ -148,7 +133,7 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
 			       struct dma_fence *fence)
 {
 	struct dma_fence *old_fence;
-	struct drm_syncobj_cb *cur, *tmp;
+	struct syncobj_wait_entry *cur, *tmp;
 
 	if (fence)
 		dma_fence_get(fence);
@@ -162,7 +147,7 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
 	if (fence != old_fence) {
 		list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) {
 			list_del_init(&cur->node);
-			cur->func(syncobj, cur);
+			syncobj_wait_syncobj_func(syncobj, cur);
 		}
 	}
 
@@ -608,13 +593,6 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
 					&args->handle);
 }
 
-struct syncobj_wait_entry {
-	struct task_struct *task;
-	struct dma_fence *fence;
-	struct dma_fence_cb fence_cb;
-	struct drm_syncobj_cb syncobj_cb;
-};
-
 static void syncobj_wait_fence_func(struct dma_fence *fence,
 				    struct dma_fence_cb *cb)
 {
@@ -625,11 +603,8 @@ static void syncobj_wait_fence_func(struct dma_fence *fence,
 }
 
 static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj,
-				      struct drm_syncobj_cb *cb)
+				      struct syncobj_wait_entry *wait)
 {
-	struct syncobj_wait_entry *wait =
-		container_of(cb, struct syncobj_wait_entry, syncobj_cb);
-
 	/* This happens inside the syncobj lock */
 	wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
 							      lockdep_is_held(&syncobj->lock)));
@@ -688,12 +663,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
 	 */
 
 	if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) {
-		for (i = 0; i < count; ++i) {
-			drm_syncobj_fence_get_or_add_callback(syncobjs[i],
-							      &entries[i].fence,
-							      &entries[i].syncobj_cb,
-							      syncobj_wait_syncobj_func);
-		}
+		for (i = 0; i < count; ++i)
+			drm_syncobj_fence_add_wait(syncobjs[i], &entries[i]);
 	}
 
 	do {
@@ -742,9 +713,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
 
 cleanup_entries:
 	for (i = 0; i < count; ++i) {
-		if (entries[i].syncobj_cb.func)
-			drm_syncobj_remove_callback(syncobjs[i],
-						    &entries[i].syncobj_cb);
+		drm_syncobj_remove_wait(syncobjs[i], &entries[i]);
 		if (entries[i].fence_cb.func)
 			dma_fence_remove_callback(entries[i].fence,
 						  &entries[i].fence_cb);
include/drm/drm_syncobj.h +0 -21
index b1fe921f8e8f..7c6ed845c70d 100644
@@ -28,8 +28,6 @@
 
 #include "linux/dma-fence.h"
 
-struct drm_syncobj_cb;
-
 /**
  * struct drm_syncobj - sync object.
  *
@@ -62,25 +60,6 @@ struct drm_syncobj {
 	struct file *file;
 };
 
-typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj,
-				   struct drm_syncobj_cb *cb);
-
-/**
- * struct drm_syncobj_cb - callback for drm_syncobj_add_callback
- * @node: used by drm_syncob_add_callback to append this struct to
- *	  &drm_syncobj.cb_list
- * @func: drm_syncobj_func_t to call
- *
- * This struct will be initialized by drm_syncobj_add_callback, additional
- * data can be passed along by embedding drm_syncobj_cb in another struct.
- * The callback will get called the next time drm_syncobj_replace_fence is
- * called.
- */
-struct drm_syncobj_cb {
-	struct list_head node;
-	drm_syncobj_func_t func;
-};
-
 void drm_syncobj_free(struct kref *kref);
 
 /**
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 3/10 drm/syncobj: add new drm_syncobj_add_point interface v3

In reply to Chunming Zhou

From: Christian König <[email protected]>

Use the dma_fence_chain object to create a timeline of fence objects instead of just replacing the existing fence.

v2: rebase and cleanup
v3: fix garbage collection parameters

---
 drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++++++++++++++++
 include/drm/drm_syncobj.h     |  5 +++++
 2 files changed, 42 insertions(+)
drivers/gpu/drm/drm_syncobj.c +37 -0
index e19525af0cce..2b8a744fbbb6 100644
@@ -122,6 +122,43 @@ static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj,
 	spin_unlock(&syncobj->lock);
 }
 
+/**
+ * drm_syncobj_add_point - add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */
+void drm_syncobj_add_point(struct drm_syncobj *syncobj,
+			   struct dma_fence_chain *chain,
+			   struct dma_fence *fence,
+			   uint64_t point)
+{
+	struct syncobj_wait_entry *cur, *tmp;
+	struct dma_fence *prev;
+
+	dma_fence_get(fence);
+
+	spin_lock(&syncobj->lock);
+
+	prev = drm_syncobj_fence_get(syncobj);
+	dma_fence_chain_init(chain, prev, fence, point);
+	rcu_assign_pointer(syncobj->fence, &chain->base);
+
+	list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) {
+		list_del_init(&cur->node);
+		syncobj_wait_syncobj_func(syncobj, cur);
+	}
+	spin_unlock(&syncobj->lock);
+
+	/* Walk the chain once to trigger garbage collection */
+	dma_fence_chain_for_each(fence, prev);
+	dma_fence_put(prev);
+}
+EXPORT_SYMBOL(drm_syncobj_add_point);
+
 /**
  * drm_syncobj_replace_fence - replace fence in a sync object.
  * @syncobj: Sync object to replace fence in
include/drm/drm_syncobj.h +5 -0
index 7c6ed845c70d..8acb4ae4f311 100644
@@ -27,6 +27,7 @@
 #define __DRM_SYNCOBJ_H__
 
 #include "linux/dma-fence.h"
+#include "linux/dma-fence-chain.h"
 
 /**
  * struct drm_syncobj - sync object.
@@ -110,6 +111,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj)
 
 struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private,
 				     u32 handle);
+void drm_syncobj_add_point(struct drm_syncobj *syncobj,
+			   struct dma_fence_chain *chain,
+			   struct dma_fence *fence,
+			   uint64_t point);
 void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
 			       struct dma_fence *fence);
 int drm_syncobj_find_fence(struct drm_file *file_private,
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 4/10 drm/syncobj: add support for timeline point wait v8

In reply to Chunming Zhou

points array is one-to-one match with syncobjs array. v2:
add seperate ioctl for timeline point wait, otherwise break uapi. v3:
userspace can specify two kinds waits::
a. Wait for time point to be completed.
b. and wait for time point to become available
v4:
rebase
v5:
add comment for xxx_WAIT_AVAILABLE
v6: rebase and rework on new container
v7: drop _WAIT_COMPLETED, it is the default anyway
v8: correctly handle garbage collected fences

Cc Daniel Rakos <[email protected]>
Cc Jason Ekstrand <[email protected]>
Cc Bas Nieuwenhuizen <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/drm_internal.h |   2 +
 drivers/gpu/drm/drm_ioctl.c    |   2 +
 drivers/gpu/drm/drm_syncobj.c  | 153 ++++++++++++++++++++++++++-------
 include/uapi/drm/drm.h         |  15 ++++
 4 files changed, 143 insertions(+), 29 deletions(-)
drivers/gpu/drm/drm_internal.h +2 -0
index c7a7d7ce5d1c..18b41e10195c 100644
@@ -178,6 +178,8 @@ int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
 				   struct drm_file *file_private);
 int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
 			   struct drm_file *file_private);
+int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
+				    struct drm_file *file_private);
 int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
 			    struct drm_file *file_private);
 int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/drm_ioctl.c +2 -0
index 94bd872d56c4..a9a17ed35cc4 100644
@@ -675,6 +675,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl,
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, drm_syncobj_timeline_wait_ioctl,
+		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_RESET, drm_syncobj_reset_ioctl,
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl,
drivers/gpu/drm/drm_syncobj.c +124 -29

253 lines not on this page · raw message

include/uapi/drm/drm.h +15 -0
index 300f336633f2..0092111d002c 100644
@@ -737,6 +737,7 @@ struct drm_syncobj_handle {
 
 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
+#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2)
 struct drm_syncobj_wait {
 	__u64 handles;
 	/* absolute timeout */
@@ -747,6 +748,19 @@ struct drm_syncobj_wait {
 	__u32 pad;
 };
 
+struct drm_syncobj_timeline_wait {
+	__u64 handles;
+	/* wait on specific timeline point for every handles*/
+	__u64 points;
+	/* absolute timeout */
+	__s64 timeout_nsec;
+	__u32 count_handles;
+	__u32 flags;
+	__u32 first_signaled; /* only valid when not waiting all */
+	__u32 pad;
+};
+
+
 struct drm_syncobj_array {
 	__u64 handles;
 	__u32 count_handles;
@@ -909,6 +923,7 @@ extern "C" {
 #define DRM_IOCTL_MODE_GET_LEASE	DRM_IOWR(0xC8, struct drm_mode_get_lease)
 #define DRM_IOCTL_MODE_REVOKE_LEASE	DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
 
+#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT	DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
 /**
  * Device specific ioctls should only be in their respective headers
  * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.17.1

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

PATCH 5/10 drm/syncobj: add timeline payload query ioctl v4

In reply to Chunming Zhou

user mode can query timeline payload.
v2: check return value of copy_to_user
v3: handle querying entry by entry
v4: rebase on new chain container, simplify interface

Cc Daniel Rakos <[email protected]>
Cc Jason Ekstrand <[email protected]>
Cc Bas Nieuwenhuizen <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/drm_internal.h |  2 ++
 drivers/gpu/drm/drm_ioctl.c    |  2 ++
 drivers/gpu/drm/drm_syncobj.c  | 43 ++++++++++++++++++++++++++++++++++
 include/uapi/drm/drm.h         | 10 ++++++++
 4 files changed, 57 insertions(+)
drivers/gpu/drm/drm_internal.h +2 -0
index 18b41e10195c..dab4d5936441 100644
@@ -184,6 +184,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
 			    struct drm_file *file_private);
 int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
 			     struct drm_file *file_private);
+int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
+			    struct drm_file *file_private);
 
 /* drm_framebuffer.c */
 void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
drivers/gpu/drm/drm_ioctl.c +2 -0
index a9a17ed35cc4..7578ef6dc1d1 100644
@@ -681,6 +681,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl,
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl,
+		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_CRTC_QUEUE_SEQUENCE, drm_crtc_queue_sequence_ioctl, DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_LEASE, drm_mode_create_lease_ioctl, DRM_MASTER|DRM_UNLOCKED),
drivers/gpu/drm/drm_syncobj.c +43 -0

46 lines not on this page · raw message

include/uapi/drm/drm.h +10 -0
index 0092111d002c..b2c36f2b2599 100644
@@ -767,6 +767,14 @@ struct drm_syncobj_array {
 	__u32 pad;
 };
 
+struct drm_syncobj_timeline_array {
+	__u64 handles;
+	__u64 points;
+	__u32 count_handles;
+	__u32 pad;
+};
+
+
 /* Query current scanout sequence number */
 struct drm_crtc_get_sequence {
 	__u32 crtc_id;		/* requested crtc_id */
@@ -924,6 +932,8 @@ extern "C" {
 #define DRM_IOCTL_MODE_REVOKE_LEASE	DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
 
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT	DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
+#define DRM_IOCTL_SYNCOBJ_QUERY		DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
+
 /**
  * Device specific ioctls should only be in their respective headers
  * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 6/10 drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

In reply to Chunming Zhou

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
 drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +40 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
 			   struct dma_fence **fence)
 {
 	struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-	int ret = 0;
+	struct syncobj_wait_entry wait;
+	int ret;
 
 	if (!syncobj)
 		return -ENOENT;
 
 	*fence = drm_syncobj_fence_get(syncobj);
-	if (!*fence) {
+	drm_syncobj_put(syncobj);
+
+	if (*fence) {
+		ret = dma_fence_chain_find_seqno(fence, point);
+		if (!ret)
+			return 0;
+		dma_fence_put(*fence);
+	} else {
 		ret = -EINVAL;
 	}
-	drm_syncobj_put(syncobj);
+
+	if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+		return ret;
+
+	memset(&wait, 0, sizeof(wait));
+	wait.task = current;
+	wait.point = point;
+	drm_syncobj_fence_add_wait(syncobj, &wait);
+
+	do {
+		set_current_state(TASK_INTERRUPTIBLE);
+		if (wait.fence) {
+			ret = 0;
+			break;
+		}
+
+		if (signal_pending(current)) {
+			ret = -ERESTARTSYS;
+			break;
+		}
+
+		schedule();
+	} while (1);
+
+	__set_current_state(TASK_RUNNING);
+	*fence = wait.fence;
+
+	if (wait.node.next)
+		drm_syncobj_remove_wait(syncobj, &wait);
+
 	return ret;
 }
 EXPORT_SYMBOL(drm_syncobj_find_fence);
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Quoting Chunming Zhou (2018-12-11 10:34:45)

Quoted 54 lines

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
 drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +23 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
                           struct dma_fence **fence)
 {
        struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-       int ret = 0;
+       struct syncobj_wait_entry wait;
+       int ret;
 
        if (!syncobj)
                return -ENOENT;
 
        *fence = drm_syncobj_fence_get(syncobj);
-       if (!*fence) {
+       drm_syncobj_put(syncobj);
+
+       if (*fence) {
+               ret = dma_fence_chain_find_seqno(fence, point);
+               if (!ret)
+                       return 0;
+               dma_fence_put(*fence);
+       } else {
                ret = -EINVAL;
        }
-       drm_syncobj_put(syncobj);
+
+       if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+               return ret;
+
+       memset(&wait, 0, sizeof(wait));
+       wait.task = current;
+       wait.point = point;
+       drm_syncobj_fence_add_wait(syncobj, &wait);
 
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (wait.fence) {
+                       ret = 0;

drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 274

Quoted 10 lines
drivers/gpu/drm/drm_syncobj.c +10 -0
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       ret = -ERESTARTSYS;
+                       break;
+               }
+
+               schedule();
+       } while (1);

I've previously used a dma_fence_proxy so that we could do nonblocking waits on future submits. That would be preferrable (a requirement for our stupid BKL-driven code).
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Am 13.12.18 um 12:37 schrieb Chris Wilson:

Quoted 59 lines

Quoting Chunming Zhou (2018-12-11 10:34:45)

Quoted 58 lines

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
  drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
  1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +28 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
                            struct dma_fence **fence)
  {
         struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-       int ret = 0;
+       struct syncobj_wait_entry wait;
+       int ret;
 
         if (!syncobj)
                 return -ENOENT;
 
         *fence = drm_syncobj_fence_get(syncobj);
-       if (!*fence) {
+       drm_syncobj_put(syncobj);
+
+       if (*fence) {
+               ret = dma_fence_chain_find_seqno(fence, point);
+               if (!ret)
+                       return 0;
+               dma_fence_put(*fence);
+       } else {
                 ret = -EINVAL;
         }
-       drm_syncobj_put(syncobj);
+
+       if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+               return ret;
+
+       memset(&wait, 0, sizeof(wait));
+       wait.task = current;
+       wait.point = point;
+       drm_syncobj_fence_add_wait(syncobj, &wait);
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (wait.fence) {
+                       ret = 0;
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       ret = -ERESTARTSYS;
Quoted 8 lines

drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 273

Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +5 -0
+                       break;
+               }
+
+               schedule();
+       } while (1);

I've previously used a dma_fence_proxy so that we could do nonblocking waits on future submits. That would be preferrable (a requirement for our stupid BKL-driven code).

That is exactly what I would definitely NAK.

I would rather say we should come up with a wait_multiple_events() macro and completely nuke the custom implementation of this in:
1. dma_fence_default_wait and dma_fence_wait_any_timeout
2. the radeon fence implementation
3. the nouveau fence implementation
4. the syncobj code

Cause all of them do exactly the same. The dma_fence implementation unfortunately came up with a custom event handling mechanism instead of extending the core Linux wait_event() system.

This in turn lead to a lot of this duplicated handling.

Christian.

Quoted 1 line

-Chris

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 36d34a20-2562-4265-9abc-4d3bd6d358ef-5C7GfCeVMHo@public.gmane.org

#9 lore raw

Re: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Quoting Koenig, Christian (2018-12-13 12:11:10)

Quoted 78 lines

Am 13.12.18 um 12:37 schrieb Chris Wilson:

Quoted 59 lines

Quoting Chunming Zhou (2018-12-11 10:34:45)

Quoted 58 lines

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
  drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
  1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +28 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
                            struct dma_fence **fence)
  {
         struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-       int ret = 0;
+       struct syncobj_wait_entry wait;
+       int ret;
 
         if (!syncobj)
                 return -ENOENT;
 
         *fence = drm_syncobj_fence_get(syncobj);
-       if (!*fence) {
+       drm_syncobj_put(syncobj);
+
+       if (*fence) {
+               ret = dma_fence_chain_find_seqno(fence, point);
+               if (!ret)
+                       return 0;
+               dma_fence_put(*fence);
+       } else {
                 ret = -EINVAL;
         }
-       drm_syncobj_put(syncobj);
+
+       if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+               return ret;
+
+       memset(&wait, 0, sizeof(wait));
+       wait.task = current;
+       wait.point = point;
+       drm_syncobj_fence_add_wait(syncobj, &wait);
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (wait.fence) {
+                       ret = 0;
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       ret = -ERESTARTSYS;
Quoted 8 lines

drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 273

Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +5 -0
+                       break;
+               }
+
+               schedule();
+       } while (1);

I've previously used a dma_fence_proxy so that we could do nonblocking waits on future submits. That would be preferrable (a requirement for our stupid BKL-driven code).

That is exactly what I would definitely NAK.

I would rather say we should come up with a wait_multiple_events() macro and completely nuke the custom implementation of this in:
1. dma_fence_default_wait and dma_fence_wait_any_timeout
2. the radeon fence implementation
3. the nouveau fence implementation
4. the syncobj code

Quoted 3 lines

Cause all of them do exactly the same. The dma_fence implementation unfortunately came up with a custom event handling mechanism instead of extending the core Linux wait_event() system.

I don't want a blocking wait at all.
-Chris
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw

Re: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Am 13.12.18 um 13:21 schrieb Chris Wilson:

Quoted 78 lines

Quoting Koenig, Christian (2018-12-13 12:11:10)

Quoted 77 lines

Am 13.12.18 um 12:37 schrieb Chris Wilson:

Quoted 59 lines

Quoting Chunming Zhou (2018-12-11 10:34:45)

Quoted 58 lines

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
   drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
   1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +28 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
                             struct dma_fence **fence)
   {
          struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-       int ret = 0;
+       struct syncobj_wait_entry wait;
+       int ret;
 
          if (!syncobj)
                  return -ENOENT;
 
          *fence = drm_syncobj_fence_get(syncobj);
-       if (!*fence) {
+       drm_syncobj_put(syncobj);
+
+       if (*fence) {
+               ret = dma_fence_chain_find_seqno(fence, point);
+               if (!ret)
+                       return 0;
+               dma_fence_put(*fence);
+       } else {
                  ret = -EINVAL;
          }
-       drm_syncobj_put(syncobj);
+
+       if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+               return ret;
+
+       memset(&wait, 0, sizeof(wait));
+       wait.task = current;
+       wait.point = point;
+       drm_syncobj_fence_add_wait(syncobj, &wait);
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (wait.fence) {
+                       ret = 0;
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       ret = -ERESTARTSYS;
Quoted 8 lines

drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 273

Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +5 -0
+                       break;
+               }
+
+               schedule();
+       } while (1);

I've previously used a dma_fence_proxy so that we could do nonblocking waits on future submits. That would be preferrable (a requirement for our stupid BKL-driven code).

That is exactly what I would definitely NAK.

I would rather say we should come up with a wait_multiple_events() macro and completely nuke the custom implementation of this in:
1. dma_fence_default_wait and dma_fence_wait_any_timeout
2. the radeon fence implementation
3. the nouveau fence implementation
4. the syncobj code

Quoted 4 lines
Quoted 3 lines

Cause all of them do exactly the same. The dma_fence implementation unfortunately came up with a custom event handling mechanism instead of extending the core Linux wait_event() system.

I don't want a blocking wait at all.

Ok I wasn't clear enough :) That is exactly what I would NAK!

The wait must be blocking or otherwise you would allow wait-before-signal.

Christian.

Quoted 1 line

-Chris

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#11 lore raw

Re: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Quoted 79 lines · Christian

Am 13.12.18 um 13:21 schrieb Chris Wilson:

Quoted 78 lines

Quoting Koenig, Christian (2018-12-13 12:11:10)

Quoted 77 lines

Am 13.12.18 um 12:37 schrieb Chris Wilson:

Quoted 59 lines

Quoting Chunming Zhou (2018-12-11 10:34:45)

Quoted 58 lines

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
   drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
   1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +28 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
                             struct dma_fence **fence)
   {
          struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-       int ret = 0;
+       struct syncobj_wait_entry wait;
+       int ret;
 
          if (!syncobj)
                  return -ENOENT;
 
          *fence = drm_syncobj_fence_get(syncobj);
-       if (!*fence) {
+       drm_syncobj_put(syncobj);
+
+       if (*fence) {
+               ret = dma_fence_chain_find_seqno(fence, point);
+               if (!ret)
+                       return 0;
+               dma_fence_put(*fence);
+       } else {
                  ret = -EINVAL;
          }
-       drm_syncobj_put(syncobj);
+
+       if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+               return ret;
+
+       memset(&wait, 0, sizeof(wait));
+       wait.task = current;
+       wait.point = point;
+       drm_syncobj_fence_add_wait(syncobj, &wait);
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (wait.fence) {
+                       ret = 0;
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       ret = -ERESTARTSYS;
Quoted 8 lines

drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 273

Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +5 -0
+                       break;
+               }
+
+               schedule();
+       } while (1);

I've previously used a dma_fence_proxy so that we could do nonblocking waits on future submits. That would be preferrable (a requirement for our stupid BKL-driven code).

That is exactly what I would definitely NAK.

I would rather say we should come up with a wait_multiple_events() macro and completely nuke the custom implementation of this in:
1. dma_fence_default_wait and dma_fence_wait_any_timeout
2. the radeon fence implementation
3. the nouveau fence implementation
4. the syncobj code

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Cause all of them do exactly the same. The dma_fence implementation unfortunately came up with a custom event handling mechanism instead of extending the core Linux wait_event() system.

I don't want a blocking wait at all.

Ok I wasn't clear enough :) That is exactly what I would NAK!

The wait must be blocking or otherwise you would allow wait-before-signal.

Well the current implementation is pulling a rather big trick on readers in this regard: It looks like a dma_fence, it's implemented as one even, heck you even open-code a dma_fence_wait here.

Except the semantics are completely different.

So aside from the discussion whether we really want to fully chain them I think it just doesn't make sense to implement the "wait for fence submit" as a dma_fence wait. And I'd outright remove that part from the uapi, and force the wait. The current radv/anv plans I discussed with Jason was that we'd have a separate submit thread, and hence unconditionally blocking until the fence has materialized is the right thing to do. Even allowing that option, either through a flag, or making these things look like dma_fences (they are _not_) just tricks folks into misunderstanding what's going on. Code sharing just because the code looks similar is imo a really bad idea, when the semantics are entirely different (that was also the reason behind not reusing all the cpu event stuff for dma_fence, they're not normal cpu events).
-Daniel

Quoted 9 lines

Christian.

Quoted 1 line

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 20181213160148.GG21184-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org

#13 lore raw

Re: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Am 13.12.18 um 17:01 schrieb Daniel Vetter:

Quoted 93 lines · Christian
Quoted 79 lines

Am 13.12.18 um 13:21 schrieb Chris Wilson:

Quoted 78 lines

Quoting Koenig, Christian (2018-12-13 12:11:10)

Quoted 77 lines

Am 13.12.18 um 12:37 schrieb Chris Wilson:

Quoted 59 lines

Quoting Chunming Zhou (2018-12-11 10:34:45)

Quoted 58 lines

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
    drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
    1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +28 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
                              struct dma_fence **fence)
    {
           struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-       int ret = 0;
+       struct syncobj_wait_entry wait;
+       int ret;
 
           if (!syncobj)
                   return -ENOENT;
 
           *fence = drm_syncobj_fence_get(syncobj);
-       if (!*fence) {
+       drm_syncobj_put(syncobj);
+
+       if (*fence) {
+               ret = dma_fence_chain_find_seqno(fence, point);
+               if (!ret)
+                       return 0;
+               dma_fence_put(*fence);
+       } else {
                   ret = -EINVAL;
           }
-       drm_syncobj_put(syncobj);
+
+       if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+               return ret;
+
+       memset(&wait, 0, sizeof(wait));
+       wait.task = current;
+       wait.point = point;
+       drm_syncobj_fence_add_wait(syncobj, &wait);
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (wait.fence) {
+                       ret = 0;
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       ret = -ERESTARTSYS;
Quoted 8 lines

drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 273

Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +5 -0
+                       break;
+               }
+
+               schedule();
+       } while (1);

I've previously used a dma_fence_proxy so that we could do nonblocking waits on future submits. That would be preferrable (a requirement for our stupid BKL-driven code).

That is exactly what I would definitely NAK.

I would rather say we should come up with a wait_multiple_events() macro and completely nuke the custom implementation of this in:
1. dma_fence_default_wait and dma_fence_wait_any_timeout
2. the radeon fence implementation
3. the nouveau fence implementation
4. the syncobj code

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Cause all of them do exactly the same. The dma_fence implementation unfortunately came up with a custom event handling mechanism instead of extending the core Linux wait_event() system.

I don't want a blocking wait at all.

Ok I wasn't clear enough :) That is exactly what I would NAK!

The wait must be blocking or otherwise you would allow wait-before-signal.

Well the current implementation is pulling a rather big trick on readers in this regard: It looks like a dma_fence, it's implemented as one even, heck you even open-code a dma_fence_wait here.

Except the semantics are completely different.

Quoted 9 lines

So aside from the discussion whether we really want to fully chain them I think it just doesn't make sense to implement the "wait for fence submit" as a dma_fence wait. And I'd outright remove that part from the uapi, and force the wait. The current radv/anv plans I discussed with Jason was that we'd have a separate submit thread, and hence unconditionally blocking until the fence has materialized is the right thing to do. Even allowing that option, either through a flag, or making these things look like dma_fences (they are _not_) just tricks folks into misunderstanding what's going on.

Good, that sounds strongly like something I can agree on as well.

Quoted 4 lines

Code sharing just because the code looks similar is imo a really bad idea, when the semantics are entirely different (that was also the reason behind not reusing all the cpu event stuff for dma_fence, they're not normal cpu events).

Ok, the last sentence is what I don't understand.

What exactly is the semantic difference between the dma_fence_wait and the wait_event interface?

I mean the wait_event interface was introduced to prevent drivers from openly coding an event interface and getting it wrong all the time.

So a good part of the bugs we have seen around waiting for dma-fences are exactly why wait_event was invented in the first place.

The only big thing I can see missing in the wait_event interface is waiting for many events at the same time, but that should be a rather easy addition.

Regards,
Christian.

Quoted 9 lines

-Daniel

Quoted 7 lines

Christian.

Quoted 1 line

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#14 lore raw

Re: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Quoted 120 lines · Christian

Am 13.12.18 um 17:01 schrieb Daniel Vetter:

Quoted 93 lines · Christian
Quoted 79 lines

Am 13.12.18 um 13:21 schrieb Chris Wilson:

Quoted 78 lines

Quoting Koenig, Christian (2018-12-13 12:11:10)

Quoted 77 lines

Am 13.12.18 um 12:37 schrieb Chris Wilson:

Quoted 59 lines

Quoting Chunming Zhou (2018-12-11 10:34:45)

Quoted 58 lines

From: Christian König <[email protected]>

Implement finding the right timeline point in drm_syncobj_find_fence.

v2: return -EINVAL when the point is not submitted yet.
v3: fix reference counting bug, add flags handling as well

---
    drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++---
    1 file changed, 40 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +28 -3
index 76ce13dafc4d..d964b348ecba 100644
@@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
                              struct dma_fence **fence)
    {
           struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
-       int ret = 0;
+       struct syncobj_wait_entry wait;
+       int ret;
 
           if (!syncobj)
                   return -ENOENT;
 
           *fence = drm_syncobj_fence_get(syncobj);
-       if (!*fence) {
+       drm_syncobj_put(syncobj);
+
+       if (*fence) {
+               ret = dma_fence_chain_find_seqno(fence, point);
+               if (!ret)
+                       return 0;
+               dma_fence_put(*fence);
+       } else {
                   ret = -EINVAL;
           }
-       drm_syncobj_put(syncobj);
+
+       if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
+               return ret;
+
+       memset(&wait, 0, sizeof(wait));
+       wait.task = current;
+       wait.point = point;
+       drm_syncobj_fence_add_wait(syncobj, &wait);
+
+       do {
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (wait.fence) {
+                       ret = 0;
+                       break;
+               }
+
+               if (signal_pending(current)) {
+                       ret = -ERESTARTSYS;
Quoted 8 lines

drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 273

Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +5 -0
+                       break;
+               }
+
+               schedule();
+       } while (1);

I've previously used a dma_fence_proxy so that we could do nonblocking waits on future submits. That would be preferrable (a requirement for our stupid BKL-driven code).

That is exactly what I would definitely NAK.

I would rather say we should come up with a wait_multiple_events() macro and completely nuke the custom implementation of this in:
1. dma_fence_default_wait and dma_fence_wait_any_timeout
2. the radeon fence implementation
3. the nouveau fence implementation
4. the syncobj code

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Cause all of them do exactly the same. The dma_fence implementation unfortunately came up with a custom event handling mechanism instead of extending the core Linux wait_event() system.

I don't want a blocking wait at all.

Ok I wasn't clear enough :) That is exactly what I would NAK!

The wait must be blocking or otherwise you would allow wait-before-signal.

Well the current implementation is pulling a rather big trick on readers in this regard: It looks like a dma_fence, it's implemented as one even, heck you even open-code a dma_fence_wait here.

Except the semantics are completely different.

Quoted 9 lines

So aside from the discussion whether we really want to fully chain them I think it just doesn't make sense to implement the "wait for fence submit" as a dma_fence wait. And I'd outright remove that part from the uapi, and force the wait. The current radv/anv plans I discussed with Jason was that we'd have a separate submit thread, and hence unconditionally blocking until the fence has materialized is the right thing to do. Even allowing that option, either through a flag, or making these things look like dma_fences (they are _not_) just tricks folks into misunderstanding what's going on.

Good, that sounds strongly like something I can agree on as well.

Quoted 4 lines

Code sharing just because the code looks similar is imo a really bad idea, when the semantics are entirely different (that was also the reason behind not reusing all the cpu event stuff for dma_fence, they're not normal cpu events).

Ok, the last sentence is what I don't understand.

What exactly is the semantic difference between the dma_fence_wait and the wait_event interface?

I mean the wait_event interface was introduced to prevent drivers from openly coding an event interface and getting it wrong all the time.

Quoted 6 lines

So a good part of the bugs we have seen around waiting for dma-fences are exactly why wait_event was invented in the first place.

The only big thing I can see missing in the wait_event interface is waiting for many events at the same time, but that should be a rather easy addition.

So this bikeshed was years ago, maybe I should type a patch to document it, but as far as I remember the big difference is:

- wait_event and friends generally Just Work. It can go wrong of course, but the usual pattern is that the waker-side does and uncoditional wake_up_all, and hence all the waiter needs to do is add themselves to the waiter list.

- dma_buf otoh is entirely different: We wanted to support all kinds fo signalling modes, including having interrupts disabled by default (not sure whether we actually achieve this still with all the cpu-side scheduling the big drivers do). Which means the waker does not unconditionally call wake_up_all, at least not timeline, and waiters need to call dma_fence_enable_signalling before they can add themselves to the waiter list and call schedule().

The other bit difference is how you check for the classic wakeup races where the event happens between when you checked for it and when you go to sleep. Because hw is involved, the rules are again a bit different, and their different between drivers because hw is incoherent/broken in all kinds of ways. So there's also really tricky things going on between adding the waiter to the waiter list and dma_fence_enable_signalling. For pure cpu events you can ignore this and bake the few necessary barriers into the various macros, dma_fence needs more.

Adding Maarten, maybe there was more. I definitely remember huge&very long discussions about all this.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

Re: [Intel-gfx] [PATCH 06/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3

Am 13.12.18 um 18:26 schrieb Daniel Vetter:

Quoted 26 lines
Quoted 12 lines
Quoted 4 lines

Code sharing just because the code looks similar is imo a really bad idea, when the semantics are entirely different (that was also the reason behind not reusing all the cpu event stuff for dma_fence, they're not normal cpu events).

Ok, the last sentence is what I don't understand.

What exactly is the semantic difference between the dma_fence_wait and the wait_event interface?

I mean the wait_event interface was introduced to prevent drivers from openly coding an event interface and getting it wrong all the time.

Quoted 6 lines

So a good part of the bugs we have seen around waiting for dma-fences are exactly why wait_event was invented in the first place.

The only big thing I can see missing in the wait_event interface is waiting for many events at the same time, but that should be a rather easy addition.

So this bikeshed was years ago, maybe I should type a patch to document it, but as far as I remember the big difference is:

- wait_event and friends generally Just Work. It can go wrong of course, but the usual pattern is that the waker-side does and uncoditional wake_up_all, and hence all the waiter needs to do is add themselves to the waiter list.

Quoted 7 lines

- dma_buf otoh is entirely different: We wanted to support all kinds fo signalling modes, including having interrupts disabled by default (not sure whether we actually achieve this still with all the cpu-side scheduling the big drivers do). Which means the waker does not unconditionally call wake_up_all, at least not timeline, and waiters need to call dma_fence_enable_signalling before they can add themselves to the waiter list and call schedule().

Well that is not something I'm questioning because we really need this behavior as well.

But all of this can be perfectly implemented on top of wake_up_all.

Quoted 9 lines

The other bit difference is how you check for the classic wakeup races where the event happens between when you checked for it and when you go to sleep. Because hw is involved, the rules are again a bit different, and their different between drivers because hw is incoherent/broken in all kinds of ways. So there's also really tricky things going on between adding the waiter to the waiter list and dma_fence_enable_signalling. For pure cpu events you can ignore this and bake the few necessary barriers into the various macros, dma_fence needs more.

Ah, yes I think I know what you mean with that and I also consider this a bad idea as well.

Only very few drivers actually need this behavior and the ones who do should be perfectly able to implement this inside the driver code.

The crux is that leaking this behavior into the dma-fence made it unnecessary complicated and result in quite a bunch of unnecessary irq_work and delayed_work usage.

I will take a look at this over the holidays. Shouldn't be to hard to fix and actually has some value additional to being just a nice cleanup.

Regards,
Christian.

Quoted 4 lines

Adding Maarten, maybe there was more. I definitely remember huge&very long discussions about all this.
-Daniel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#17 lore raw

PATCH 7/10 drm/amdgpu: add timeline support in amdgpu CS v2

syncobj wait/signal operation is appending in command submission.
v2: separate to two kinds in/out_deps functions

Cc Daniel Rakos <[email protected]>
Cc Jason Ekstrand <[email protected]>
Cc Bas Nieuwenhuizen <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h    |  10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 147 +++++++++++++++++++++----
 include/uapi/drm/amdgpu_drm.h          |   8 ++
 3 files changed, 140 insertions(+), 25 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -2
index 42f882c633ee..f9160ea1396a 100644
@@ -545,6 +545,12 @@ struct amdgpu_cs_chunk {
 	void			*kdata;
 };
 
+struct amdgpu_cs_post_dep {
+	struct drm_syncobj *syncobj;
+	struct dma_fence_chain *chain;
+	u64 point;
+};
+
 struct amdgpu_cs_parser {
 	struct amdgpu_device	*adev;
 	struct drm_file		*filp;
@@ -574,8 +580,8 @@ struct amdgpu_cs_parser {
 	/* user fence */
 	struct amdgpu_bo_list_entry	uf_entry;
 
-	unsigned num_post_dep_syncobjs;
-	struct drm_syncobj **post_dep_syncobjs;
+	unsigned			num_post_deps;
+	struct amdgpu_cs_post_dep	*post_deps;
 };
 
 static inline u32 amdgpu_get_ib_value(struct amdgpu_cs_parser *p,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +124 -23

224 lines not on this page · raw message

include/uapi/drm/amdgpu_drm.h +8 -0
index be84e43c1e19..997222bc1afe 100644
@@ -523,6 +523,8 @@ struct drm_amdgpu_gem_va {
 #define AMDGPU_CHUNK_ID_SYNCOBJ_IN      0x04
 #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT     0x05
 #define AMDGPU_CHUNK_ID_BO_HANDLES      0x06
+#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT    0x07
+#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL  0x08
 
 struct drm_amdgpu_cs_chunk {
 	__u32		chunk_id;
@@ -598,6 +600,12 @@ struct drm_amdgpu_cs_chunk_sem {
 	__u32 handle;
 };
 
+struct drm_amdgpu_cs_chunk_syncobj {
+       __u32 handle;
+       __u32 flags;
+       __u64 point;
+};
+
 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ	0
 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD	1
 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD	2
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#18 lore raw

PATCH 8/10 drm/syncobj: add transition iotcls between binary and timeline v2

In reply to a message not in the archive

we need to import/export timeline point.

v2: unify to one transfer ioctl

---
 drivers/gpu/drm/drm_internal.h |  2 +
 drivers/gpu/drm/drm_ioctl.c    |  2 +
 drivers/gpu/drm/drm_syncobj.c  | 74 ++++++++++++++++++++++++++++++++++
 include/uapi/drm/drm.h         | 10 +++++
 4 files changed, 88 insertions(+)
drivers/gpu/drm/drm_internal.h +2 -0
index dab4d5936441..06c2adc4950e 100644
@@ -176,6 +176,8 @@ int drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, void *data,
 				   struct drm_file *file_private);
 int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
 				   struct drm_file *file_private);
+int drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data,
+			       struct drm_file *file_private);
 int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
 			   struct drm_file *file_private);
 int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/drm_ioctl.c +2 -0
index 7578ef6dc1d1..e9d4bed12783 100644
@@ -673,6 +673,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, drm_syncobj_fd_to_handle_ioctl,
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TRANSFER, drm_syncobj_transfer_ioctl,
+		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl,
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, drm_syncobj_timeline_wait_ioctl,
drivers/gpu/drm/drm_syncobj.c +74 -0

80 lines not on this page · raw message

include/uapi/drm/drm.h +10 -0
index b2c36f2b2599..4c1e2e6579fa 100644
@@ -735,6 +735,15 @@ struct drm_syncobj_handle {
 	__u32 pad;
 };
 
+struct drm_syncobj_transfer {
+	__u32 src_handle;
+	__u32 dst_handle;
+	__u64 src_point;
+	__u64 dst_point;
+	__u32 flags;
+	__u32 pad;
+};
+
 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2)
@@ -933,6 +942,7 @@ extern "C" {
 
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT	DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
 #define DRM_IOCTL_SYNCOBJ_QUERY		DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
+#define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
 
 /**
  * Device specific ioctls should only be in their respective headers
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#19 lore raw
In reply to a message not in the archive

Quoting Chunming Zhou (2018-12-11 10:34:40)

Quoted 36 lines

From: Christian König <[email protected]>

Lockless container implementation similar to a dma_fence_array, but with only two elements per node and automatic garbage collection.

v2: properly document dma_fence_chain_for_each, add dma_fence_chain_find_seqno,
drop prev reference during garbage collection if it's not a chain fence.
v3: use head and iterator for dma_fence_chain_for_each
v4: fix reference count in dma_fence_chain_enable_signaling

---
 drivers/dma-buf/Makefile          |   3 +-
 drivers/dma-buf/dma-fence-chain.c | 241 ++++++++++++++++++++++++++++++
 include/linux/dma-fence-chain.h   |  81 ++++++++++
 3 files changed, 324 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma-buf/dma-fence-chain.c
 create mode 100644 include/linux/dma-fence-chain.h
drivers/dma-buf/Makefile +2 -1
index 0913a6ccab5a..1f006e083eb9 100644
@@ -1,4 +1,5 @@
-obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o
+obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
+        reservation.o seqno-fence.o
 obj-$(CONFIG_SYNC_FILE)                += sync_file.o
 obj-$(CONFIG_SW_SYNC)          += sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)          += udmabuf.o
drivers/dma-buf/dma-fence-chain.c new file +0 -0
new file mode 100644
index 000000000000..0c5e3c902fa0

drivers/dma-buf/dma-fence-chain.c line 1

Quoted 1 line
drivers/dma-buf/dma-fence-chain.c new file +1 -0
@@ -0,0 +1,241 @@
+/*

SPDX-License-Identifier: GPL-2.0

Quoted 66 lines
drivers/dma-buf/dma-fence-chain.c new file +66 -0
+ * fence-chain: chain fences together in a timeline
+ *
+ * Copyright (C) 2018 Advanced Micro Devices, Inc.
+ * Authors:
+ *     Christian König <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <linux/dma-fence-chain.h>
+
+static bool dma_fence_chain_enable_signaling(struct dma_fence *fence);
+
+/**
+ * dma_fence_chain_get_prev - use RCU to get a reference to the previous fence
+ * @chain: chain node to get the previous node from
+ *
+ * Use dma_fence_get_rcu_safe to get a reference to the previous fence of the
+ * chain node.
+ */
+static struct dma_fence *dma_fence_chain_get_prev(struct dma_fence_chain *chain)
+{
+       struct dma_fence *prev;
+
+       rcu_read_lock();
+       prev = dma_fence_get_rcu_safe(&chain->prev);
+       rcu_read_unlock();
+       return prev;
+}
+
+/**
+ * dma_fence_chain_walk - chain walking function
+ * @fence: current chain node
+ *
+ * Walk the chain to the next node. Returns the next fence or NULL if we are at
+ * the end of the chain. Garbage collects chain nodes which are already
+ * signaled.
+ */
+struct dma_fence *dma_fence_chain_walk(struct dma_fence *fence)
+{
+       struct dma_fence_chain *chain, *prev_chain;
+       struct dma_fence *prev, *replacement, *tmp;
+
+       chain = to_dma_fence_chain(fence);
+       if (!chain) {
+               dma_fence_put(fence);
+               return NULL;
+       }
+
+       while ((prev = dma_fence_chain_get_prev(chain))) {
+
+               prev_chain = to_dma_fence_chain(prev);
+               if (prev_chain) {
+                       if (!dma_fence_is_signaled(prev_chain->fence))
+                               break;
+
+                       replacement = dma_fence_chain_get_prev(prev_chain);
+               } else {
+                       if (!dma_fence_is_signaled(prev))

drivers/dma-buf/dma-fence-chain.c line 77

Quoted 10 lines
drivers/dma-buf/dma-fence-chain.c new file +10 -0
+                               break;
+
+                       replacement = NULL;
+               }
+
+               tmp = cmpxchg(&chain->prev, prev, replacement);
+               if (tmp == prev)
+                       dma_fence_put(tmp);
+               else
+                       dma_fence_put(replacement);

if (cmpxchg(&chain->prev, prev, replacement) == prev)
dma_fence_put(prev)
else

	dma_fence_put(replacement);

would be a little easier for me to read.

drivers/dma-buf/dma-fence-chain.c line 81

Quoted 4 lines
drivers/dma-buf/dma-fence-chain.c new file +4 -0
+               dma_fence_put(prev);
+       }
+
+       dma_fence_put(fence);

Putting the caller's fence caught me by surprise.

I'd be tempted to do

drivers/dma-buf/dma-fence-chain.c line 93

Quoted 12 lines
drivers/dma-buf/dma-fence-chain.c new file +12 -0
+
+/**
+ * dma_fence_chain_for_each - iterate over all fences in chain
+ * @iter: current fence
+ * @head: starting point
+ *
+ * Iterate over all fences in the chain. We keep a reference to the current
+ * fence while inside the loop which must be dropped when breaking out.
+ */
+#define dma_fence_chain_for_each(iter, head)   \
+       for (iter = dma_fence_get(head); iter; \
+            iter = dma_fence_chain_walk(head))

dma_fence_chain_walk(head) <-- should be iter?

#define dma_fence_chain_for_each(iter, head)   \
       for (iter = dma_fence_get(head); iter; \
            ({ dma_fence_put(iter); iter = dma_fence_chain_walk(iter)))

just so that dma_fence_chain_walk() didn't look unbalanced and the put/get more clearly inside the for_each.

Quoted 7 lines
drivers/dma-buf/dma-fence-chain.c new file +6 -0
+       return prev;
+}
+EXPORT_SYMBOL(dma_fence_chain_walk);
 
+
+/**
+ * dma_fence_chain_find_seqno - find fence chain node by seqno

drivers/dma-buf/dma-fence-chain.c line 97

Quoted 10 lines
drivers/dma-buf/dma-fence-chain.c new file +10 -0
+ * @pfence: pointer to the chain node where to start
+ * @seqno: the sequence number to search for
+ *
+ * Advance the fence pointer to the chain node which will signal this sequence
+ * number. If no sequence number is provided then this is a no-op.
+ *
+ * Returns EINVAL if the fence is not a chain node or the sequence number has
+ * not yet advanced far enough.
+ */
+int dma_fence_chain_find_seqno(struct dma_fence **pfence, uint64_t seqno)

That inout parameter took me by surprise. "find" I expected to return the fence.

Not used in this patch, so I need to read on to see if its use simplifies the code or is equally surprising ;) -Chris
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#20 lore raw

PATCH 9/10 drm/syncobj: add timeline signal ioctl for syncobj v2

In reply to Chunming Zhou

v2: individually allocate chain array, since chain node is free independently.

---
 drivers/gpu/drm/drm_internal.h |  2 +
 drivers/gpu/drm/drm_ioctl.c    |  2 +
 drivers/gpu/drm/drm_syncobj.c  | 81 ++++++++++++++++++++++++++++++++++
 include/uapi/drm/drm.h         |  1 +
 4 files changed, 86 insertions(+)
drivers/gpu/drm/drm_internal.h +2 -0
index 06c2adc4950e..d7a19bd89cb2 100644
@@ -186,6 +186,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
 			    struct drm_file *file_private);
 int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
 			     struct drm_file *file_private);
+int drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
+				      struct drm_file *file_private);
 int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 			    struct drm_file *file_private);
 
drivers/gpu/drm/drm_ioctl.c +2 -0
index e9d4bed12783..a50dc62dc87b 100644
@@ -683,6 +683,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl,
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, drm_syncobj_timeline_signal_ioctl,
+		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl,
 		      DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, DRM_UNLOCKED),
drivers/gpu/drm/drm_syncobj.c +81 -0

87 lines not on this page · raw message

include/uapi/drm/drm.h +1 -0
index 4c1e2e6579fa..fe00b74268eb 100644
@@ -943,6 +943,7 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT	DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
 #define DRM_IOCTL_SYNCOBJ_QUERY		DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
 #define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
+#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
 
 /**
  * Device specific ioctls should only be in their respective headers
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

PATCH 10/10 drm/amdgpu: update version for timeline syncobj support in amdgpu

In reply to Chunming Zhou
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 8de55f7f1a3a..cafafdb1d03f 100644
@@ -71,9 +71,10 @@
  * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk).
  * - 3.26.0 - GFX9: Process AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE.
  * - 3.27.0 - Add new chunk to to AMDGPU_CS to enable BO_LIST creation.
+ * - 3.28.0 - Add syncobj timeline support to AMDGPU_CS.
  */
 #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	27
+#define KMS_DRIVER_MINOR	28
 #define KMS_DRIVER_PATCHLEVEL	0
 
 int amdgpu_vram_limit = 0;
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] dma-buf: add new dma_fence_chain container v4

In reply to Chunming Zhou
== Series Details ==

== Series Details ==

Series: series starting with [01/10] dma-buf: add new dma_fence_chain container v4
URL : https://patchwork.freedesktop.org/series/53879/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
840d7cb7e1cc dma-buf: add new dma_fence_chain container v4
-:12: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#12: 
v2: properly document dma_fence_chain_for_each, add dma_fence_chain_find_seqno,

-:31: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #31:
new file mode 100644

-:36: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #36: FILE: drivers/dma-buf/dma-fence-chain.c:1:
+/*

-:94: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #94: FILE: drivers/dma-buf/dma-fence-chain.c:59:
+ while ((prev = dma_fence_chain_get_prev(chain))) {
+

-:156: ERROR:CODE_INDENT: code indent should use tabs where possible #156: FILE: drivers/dma-buf/dma-fence-chain.c:121:
+ return "dma_fence_chain";$

-:156: WARNING:LEADING_SPACE: please, no spaces at the start of a line #156: FILE: drivers/dma-buf/dma-fence-chain.c:121:
+ return "dma_fence_chain";$

-:161: ERROR:CODE_INDENT: code indent should use tabs where possible #161: FILE: drivers/dma-buf/dma-fence-chain.c:126:
+ return "unbound";$

-:161: WARNING:LEADING_SPACE: please, no spaces at the start of a line #161: FILE: drivers/dma-buf/dma-fence-chain.c:126:
+ return "unbound";$

-:283: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #283: FILE: include/linux/dma-fence-chain.h:1:
+/*

-:318: CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment #318: FILE: include/linux/dma-fence-chain.h:36:
+ spinlock_t lock;

-:352: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'iter' - possible side-effects? #352: FILE: include/linux/dma-fence-chain.h:70:
+#define dma_fence_chain_for_each(iter, head) \
+ for (iter = dma_fence_get(head); iter; \
+ iter = dma_fence_chain_walk(head))

-:352: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'head' - possible side-effects? #352: FILE: include/linux/dma-fence-chain.h:70:
+#define dma_fence_chain_for_each(iter, head) \
+ for (iter = dma_fence_get(head); iter; \
+ iter = dma_fence_chain_walk(head))

-:363: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Christian König <[email protected]>'

total: 2 errors, 7 warnings, 4 checks, 328 lines checked 87065bf020ee drm/syncobj: remove drm_syncobj_cb and cleanup -:77: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #77: FILE: drivers/gpu/drm/drm_syncobj.c:107:
+ wait->fence = dma_fence_get(

-:217: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Christian König <[email protected]>'

total: 0 errors, 1 warnings, 1 checks, 186 lines checked
59a66b97c017 drm/syncobj: add new drm_syncobj_add_point interface v3
-:87: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Christian König <[email protected]>'

total: 0 errors, 1 warnings, 0 checks, 60 lines checked 2b8a180d5fb2 drm/syncobj: add support for timeline point wait v8 -:11: WARNING:TYPO_SPELLING: 'seperate' may be misspelled - perhaps 'separate'? #11:
add seperate ioctl for timeline point wait, otherwise break uapi.

-:54: CHECK:SPACING: spaces preferred around that '|' (ctx:VxV) #54: FILE: drivers/gpu/drm/drm_ioctl.c:679:
+ DRM_UNLOCKED|DRM_RENDER_ALLOW),
^

-:163: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!points" #163: FILE: drivers/gpu/drm/drm_syncobj.c:680:
+ if (points == NULL)

-:324: CHECK:LINE_SPACING: Please don't use multiple blank lines #324: FILE: drivers/gpu/drm/drm_syncobj.c:998:
+
+

-:356: CHECK:LINE_SPACING: Please don't use multiple blank lines #356: FILE: include/uapi/drm/drm.h:763:
+
+

total: 0 errors, 1 warnings, 4 checks, 302 lines checked baf631df82a6 drm/syncobj: add timeline payload query ioctl v4 -:44: CHECK:SPACING: spaces preferred around that '|' (ctx:VxV) #44: FILE: drivers/gpu/drm/drm_ioctl.c:685:
+ DRM_UNLOCKED|DRM_RENDER_ALLOW),
^

-:114: CHECK:LINE_SPACING: Please don't use multiple blank lines #114: FILE: include/uapi/drm/drm.h:777:
+
+

total: 0 errors, 0 warnings, 2 checks, 84 lines checked
910c349cf9d7 drm/syncobj: use the timeline point in drm_syncobj_find_fence v3
-:77: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Christian König <[email protected]>'

total: 0 errors, 1 warnings, 0 checks, 56 lines checked 0311d860d79e drm/amdgpu: add timeline support in amdgpu CS v2 -:43: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #43: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu.h:467:
+ unsigned num_post_deps;

-:121: CHECK:LINE_SPACING: Please don't use multiple blank lines #121: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1146:

+

-:126: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #126: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1151:
+ unsigned num_deps;

-:168: CHECK:LINE_SPACING: Please don't use multiple blank lines #168: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1187:
+
+

-:182: CHECK:LINE_SPACING: Please don't use multiple blank lines #182: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1201:
+
+

-:188: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #188: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:1207:
+ unsigned num_deps;

-:300: WARNING:LEADING_SPACE: please, no spaces at the start of a line #300: FILE: include/uapi/drm/amdgpu_drm.h:604:
+ __u32 handle;$

-:301: WARNING:LEADING_SPACE: please, no spaces at the start of a line #301: FILE: include/uapi/drm/amdgpu_drm.h:605:
+ __u32 flags;$

-:302: WARNING:LEADING_SPACE: please, no spaces at the start of a line #302: FILE: include/uapi/drm/amdgpu_drm.h:606:
+ __u64 point;$

total: 0 errors, 6 warnings, 3 checks, 266 lines checked 2dd3be4e6245 drm/syncobj: add transition iotcls between binary and timeline v2 -:35: CHECK:SPACING: spaces preferred around that '|' (ctx:VxV) #35: FILE: drivers/gpu/drm/drm_ioctl.c:677:
+ DRM_UNLOCKED|DRM_RENDER_ALLOW),
^

-:56: WARNING:BRACES: braces {} are not necessary for single statement blocks #56: FILE: drivers/gpu/drm/drm_syncobj.c:682:
+ if (!timeline_syncobj) {
+ return -ENOENT;
+ }

-:64: CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*chain)...) over kzalloc(sizeof(struct dma_fence_chain)...) #64: FILE: drivers/gpu/drm/drm_syncobj.c:690:
+ chain = kzalloc(sizeof(struct dma_fence_chain), GFP_KERNEL);

-:100: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #100: FILE: drivers/gpu/drm/drm_syncobj.c:726:
+}
+int

total: 0 errors, 1 warnings, 3 checks, 118 lines checked
0c1208ed2010 drm/syncobj: add timeline signal ioctl for syncobj v2
-:6: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #6:
v2: individually allocate chain array, since chain node is free independently.

-:32: CHECK:SPACING: spaces preferred around that '|' (ctx:VxV) #32: FILE: drivers/gpu/drm/drm_ioctl.c:687:
+ DRM_UNLOCKED|DRM_RENDER_ALLOW),
^

-:85: CHECK:LINE_SPACING: Please don't use multiple blank lines #85: FILE: drivers/gpu/drm/drm_syncobj.c:1217:
+
+

-:96: CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*chains[i])...) over kzalloc(sizeof(struct dma_fence_chain)...) #96: FILE: drivers/gpu/drm/drm_syncobj.c:1228:
+ chains[i] = kzalloc(sizeof(struct dma_fence_chain), GFP_KERNEL);

-:106: CHECK:BRACES: braces {} should be used on all arms of this statement #106: FILE: drivers/gpu/drm/drm_syncobj.c:1238:
+ if (points[i]) {
[...]
+ } else
[...]

-:112: CHECK:BRACES: Unbalanced braces around else statement #112: FILE: drivers/gpu/drm/drm_syncobj.c:1244:
+ } else

total: 0 errors, 1 warnings, 5 checks, 110 lines checked b2b237d605c5 drm/amdgpu: update version for timeline syncobj support in amdgpu -:8: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

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

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw

✗ Fi.CI.SPARSE: warning for series starting with [01/10] dma-buf: add new dma_fence_chain container v4

In reply to Chunming Zhou
== Series Details ==

== Series Details ==

Series: series starting with [01/10] dma-buf: add new dma_fence_chain container v4
URL : https://patchwork.freedesktop.org/series/53879/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: dma-buf: add new dma_fence_chain container v4
Okay!

Commit: drm/syncobj: remove drm_syncobj_cb and cleanup
-O:drivers/gpu/drm/drm_syncobj.c:123:6: warning: symbol 'drm_syncobj_add_callback' was not declared. Should it be static? -O:drivers/gpu/drm/drm_syncobj.c:132:6: warning: symbol 'drm_syncobj_remove_callback' was not declared. Should it be static?

Commit: drm/syncobj: add new drm_syncobj_add_point interface v3 Okay!

Commit: drm/syncobj: add support for timeline point wait v8 +./include/linux/slab.h:665:13: error: not a function <noident>

Commit: drm/syncobj: add timeline payload query ioctl v4 Okay!

Commit: drm/syncobj: use the timeline point in drm_syncobj_find_fence v3 Okay!

Commit: drm/amdgpu: add timeline support in amdgpu CS v2 +./include/linux/slab.h:665:13: error: not a function <noident>

Commit: drm/syncobj: add transition iotcls between binary and timeline v2 +./include/linux/slab.h:332:43: warning: dubious: x & !y

Commit: drm/syncobj: add timeline signal ioctl for syncobj v2 +./include/linux/slab.h:665:13: error: not a function <noident> +./include/linux/slab.h:665:13: error: not a function <noident>

Commit: drm/amdgpu: update version for timeline syncobj support in amdgpu Okay!

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw

✓ Fi.CI.BAT: success for series starting with [01/10] dma-buf: add new dma_fence_chain container v4

In reply to Chunming Zhou
== Series Details ==

== Series Details ==

Series: series starting with [01/10] dma-buf: add new dma_fence_chain container v4
URL : https://patchwork.freedesktop.org/series/53879/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5295 -> Patchwork_11064
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/53879/revisions/1/mbox/

Known issues
------------

Here are the changes found in Patchwork_11064 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_chamelium@dp-crc-fast:
- {fi-kbl-7500u}: PASS -> DMESG-FAIL [fdo#103841]

* igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy: PASS -> DMESG-WARN [fdo#102614]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362]

* {igt@runner@aborted}:
- {fi-kbl-7500u}: NOTRUN -> FAIL [fdo#103841]

#### Possible fixes ####

* igt@i915_selftest@live_coherency:
- fi-gdg-551: DMESG-FAIL [fdo#107164] -> PASS

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-cfl-8109u: INCOMPLETE [fdo#106070] / [fdo#108126] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103841]: https://bugs.freedesktop.org/show_bug.cgi?id=103841
[fdo#106070]: https://bugs.freedesktop.org/show_bug.cgi?id=106070
[fdo#107164]: https://bugs.freedesktop.org/show_bug.cgi?id=107164
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108126]: https://bugs.freedesktop.org/show_bug.cgi?id=108126

Participating hosts (49 -> 43)
------------------------------

Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-ctg-p8600 fi-pnv-d510 fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_5295 -> Patchwork_11064

CI_DRM_5295: b94537deaa09d831c7e191da57aed98cc11fd49b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4745: 3b52e8a5809a4e860350c59476a456745cd9fee0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11064: b2b237d605c56ee4e2c27ccd9c779655e2b849a7 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

b2b237d605c5 drm/amdgpu: update version for timeline syncobj support in amdgpu 0c1208ed2010 drm/syncobj: add timeline signal ioctl for syncobj v2 2dd3be4e6245 drm/syncobj: add transition iotcls between binary and timeline v2 0311d860d79e drm/amdgpu: add timeline support in amdgpu CS v2 910c349cf9d7 drm/syncobj: use the timeline point in drm_syncobj_find_fence v3 baf631df82a6 drm/syncobj: add timeline payload query ioctl v4 2b8a180d5fb2 drm/syncobj: add support for timeline point wait v8 59a66b97c017 drm/syncobj: add new drm_syncobj_add_point interface v3 87065bf020ee drm/syncobj: remove drm_syncobj_cb and cleanup 840d7cb7e1cc dma-buf: add new dma_fence_chain container v4

== Logs ==

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

#25 lore raw

✓ Fi.CI.IGT: success for series starting with [01/10] dma-buf: add new dma_fence_chain container v4

In reply to Chunming Zhou
== Series Details ==

== Series Details ==

Series: series starting with [01/10] dma-buf: add new dma_fence_chain container v4
URL : https://patchwork.freedesktop.org/series/53879/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5295_full -> Patchwork_11064_full
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with Patchwork_11064_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_11064_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_11064_full:

### IGT changes ###

#### Warnings ####

* igt@pm_rc6_residency@rc6-accuracy:
- shard-snb: SKIP -> PASS

Known issues
------------

Here are the changes found in Patchwork_11064_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_busy@extended-modeset-hang-newfb-render-b:
- {shard-iclb}: NOTRUN -> DMESG-WARN [fdo#107956]

* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#107956]
- shard-apl: PASS -> DMESG-WARN [fdo#107956]

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- {shard-iclb}: NOTRUN -> FAIL [fdo#107725]

* igt@kms_cursor_crc@cursor-64x21-sliding:
- shard-apl: PASS -> FAIL [fdo#103232] +4

* igt@kms_cursor_crc@cursor-64x64-random:
- {shard-iclb}: NOTRUN -> FAIL [fdo#103232] +1

* igt@kms_draw_crc@draw-method-xrgb2101010-blt-untiled:
- {shard-iclb}: PASS -> WARN [fdo#108336]

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-glk: PASS -> FAIL [fdo#103833] / [fdo#105681]
- shard-kbl: PASS -> FAIL [fdo#103833] / [fdo#105681]

* igt@kms_fbcon_fbt@psr-suspend:
- {shard-iclb}: NOTRUN -> FAIL [fdo#107882]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-skl: PASS -> FAIL [fdo#105363]

* igt@kms_flip_tiling@flip-changes-tiling:
- {shard-iclb}: PASS -> DMESG-WARN [fdo#107724] / [fdo#108336] +3

* igt@kms_flip_tiling@flip-changes-tiling-y:
- shard-skl: NOTRUN -> FAIL [fdo#107931] / [fdo#108303]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-onoff:
- shard-apl: PASS -> FAIL [fdo#103167] +4

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- {shard-iclb}: PASS -> FAIL [fdo#103167] +3

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-pwrite:
- shard-glk: PASS -> FAIL [fdo#103167] +1

* igt@kms_frontbuffer_tracking@fbcpsr-suspend:
- {shard-iclb}: PASS -> DMESG-FAIL [fdo#107724]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-blt:
- {shard-iclb}: NOTRUN -> FAIL [fdo#103167] +1

* igt@kms_plane@pixel-format-pipe-c-planes:
- shard-apl: PASS -> FAIL [fdo#103166] +1
- shard-skl: NOTRUN -> DMESG-WARN [fdo#106885]

* {igt@kms_plane@pixel-format-pipe-c-planes-source-clamping}:
- {shard-iclb}: NOTRUN -> FAIL [fdo#108948]

* igt@kms_plane@plane-position-covered-pipe-a-planes:
- shard-glk: PASS -> FAIL [fdo#103166]
- {shard-iclb}: NOTRUN -> FAIL [fdo#103166]

* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-glk: PASS -> FAIL [fdo#108145]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: NOTRUN -> FAIL [fdo#108145]

* igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
- {shard-iclb}: PASS -> FAIL [fdo#103166]

* {igt@kms_rotation_crc@multiplane-rotation-cropping-top}:
- shard-kbl: PASS -> DMESG-WARN [fdo#105604]
- shard-glk: PASS -> DMESG-WARN [fdo#105763] / [fdo#106538]

* igt@kms_setmode@basic:
- shard-kbl: PASS -> FAIL [fdo#99912]

* igt@pm_rpm@cursor-dpms:
- {shard-iclb}: PASS -> DMESG-WARN [fdo#107724] +7

* igt@pm_rps@min-max-config-loaded:
- {shard-iclb}: NOTRUN -> FAIL [fdo#102250]

#### Possible fixes ####

* igt@kms_color@pipe-b-ctm-negative:
- shard-skl: FAIL [fdo#107361] -> PASS

* igt@kms_cursor_legacy@basic-flip-before-cursor-legacy:
- shard-apl: DMESG-WARN [fdo#103558] / [fdo#105602] -> PASS +16

* igt@kms_draw_crc@draw-method-rgb565-pwrite-ytiled:
- shard-glk: FAIL [fdo#103184] -> PASS

* igt@kms_flip@dpms-vs-vblank-race:
- shard-skl: FAIL [fdo#103060] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-apl: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-wc:
- shard-glk: FAIL [fdo#103167] -> PASS +5

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-pwrite:
- {shard-iclb}: FAIL [fdo#103167] -> PASS +4

* igt@kms_frontbuffer_tracking@fbcpsr-stridechange:
- {shard-iclb}: FAIL [fdo#105683] -> PASS

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- {shard-iclb}: INCOMPLETE [fdo#107713] -> PASS +2

* igt@kms_plane@plane-position-covered-pipe-a-planes:
- shard-apl: FAIL [fdo#103166] -> PASS

* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
- shard-glk: FAIL [fdo#108145] -> PASS

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: FAIL [fdo#107815] / [fdo#108145] -> PASS

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: FAIL [fdo#107815] -> PASS

* igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
- shard-apl: FAIL [fdo#108145] -> PASS

* igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
- {shard-iclb}: FAIL [fdo#103166] -> PASS

* igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
- shard-glk: FAIL [fdo#103166] -> PASS +1

* igt@kms_universal_plane@universal-plane-gen9-features-pipe-a:
- shard-kbl: DMESG-WARN [fdo#103558] / [fdo#105602] -> PASS +17

* igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
- shard-skl: INCOMPLETE [fdo#104108] -> PASS

* igt@perf@blocking:
- shard-hsw: FAIL [fdo#102252] -> PASS

* igt@pm_rpm@gem-mmap-gtt:
- shard-skl: INCOMPLETE [fdo#107807] -> PASS

* igt@pm_rpm@universal-planes-dpms:
- {shard-iclb}: INCOMPLETE [fdo#107713] / [fdo#108840] -> PASS

#### Warnings ####

* igt@i915_selftest@live_contexts:
- {shard-iclb}: INCOMPLETE [fdo#108315] -> DMESG-FAIL [fdo#108569]

* igt@kms_cursor_crc@cursor-128x128-random:
- {shard-iclb}: FAIL [fdo#103232] -> DMESG-WARN [fdo#107724] / [fdo#108336]

* igt@kms_cursor_crc@cursor-64x64-sliding:
- shard-apl: DMESG-FAIL [fdo#103232] / [fdo#103558] / [fdo#105602] -> FAIL [fdo#103232]
- shard-kbl: DMESG-FAIL [fdo#103232] / [fdo#103558] / [fdo#105602] -> FAIL [fdo#103232]

* igt@kms_frontbuffer_tracking@fbc-1p-rte:
- shard-kbl: DMESG-FAIL [fdo#103167] / [fdo#103558] / [fdo#105602] -> FAIL [fdo#103167] / [fdo#105682]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-wc:
- {shard-iclb}: FAIL [fdo#103167] -> DMESG-FAIL [fdo#107724]

* {igt@kms_plane@pixel-format-pipe-a-planes-source-clamping}:
- {shard-iclb}: FAIL [fdo#108948] -> DMESG-WARN [fdo#107724] / [fdo#108336]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250
[fdo#102252]: https://bugs.freedesktop.org/show_bug.cgi?id=102252
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#103833]: https://bugs.freedesktop.org/show_bug.cgi?id=103833
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#105604]: https://bugs.freedesktop.org/show_bug.cgi?id=105604
[fdo#105681]: https://bugs.freedesktop.org/show_bug.cgi?id=105681
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#105683]: https://bugs.freedesktop.org/show_bug.cgi?id=105683
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
[fdo#106885]: https://bugs.freedesktop.org/show_bug.cgi?id=106885
[fdo#107361]: https://bugs.freedesktop.org/show_bug.cgi?id=107361
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#107725]: https://bugs.freedesktop.org/show_bug.cgi?id=107725
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
[fdo#107882]: https://bugs.freedesktop.org/show_bug.cgi?id=107882
[fdo#107931]: https://bugs.freedesktop.org/show_bug.cgi?id=107931
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108303]: https://bugs.freedesktop.org/show_bug.cgi?id=108303
[fdo#108315]: https://bugs.freedesktop.org/show_bug.cgi?id=108315
[fdo#108336]: https://bugs.freedesktop.org/show_bug.cgi?id=108336
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (7 -> 7)
------------------------------

No changes in participating hosts

Build changes
-------------

* Linux: CI_DRM_5295 -> Patchwork_11064

CI_DRM_5295: b94537deaa09d831c7e191da57aed98cc11fd49b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4745: 3b52e8a5809a4e860350c59476a456745cd9fee0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11064: b2b237d605c56ee4e2c27ccd9c779655e2b849a7 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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

#26 lore raw
In reply to Chunming Zhou

Hi Daniel and Chris,

Could you take a look on all the patches? Can we get your RB or AB on all patches including igt patch before we submit to drm-misc?

We already fix all existing issues, and also add test case in IGT as your required.

Btw, the patch set is tested by below tests:
a. vulkan cts " ./deqp-vk -n dEQP-VK. *semaphore*" b. internal vulkan timeline test
c. libdrm test "sudo ./amdgpu_test -s 9"
d. IGT test, "sudo ./syncobj_basic"
e. IGT test, "sudo ./syncobj_wait"
f. IGT test, "sudo ./syncobj_timeline"

Any other suggestion or requirement is welcome.

-David

Quoted 398 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Chunming Zhou
Sent: Tuesday, December 11, 2018 6:35 PM
To: Koenig, Christian <[email protected]>; dri- [email protected]; [email protected]; intel- [email protected]
Cc: Christian König <[email protected]>; Koenig, Christian <[email protected]>
Subject: [PATCH 01/10] dma-buf: add new dma_fence_chain container v4

From: Christian König <[email protected]>

Lockless container implementation similar to a dma_fence_array, but with only two elements per node and automatic garbage collection.

v2: properly document dma_fence_chain_for_each, add dma_fence_chain_find_seqno,
drop prev reference during garbage collection if it's not a chain fence.
v3: use head and iterator for dma_fence_chain_for_each
v4: fix reference count in dma_fence_chain_enable_signaling

---
 drivers/dma-buf/Makefile          |   3 +-
 drivers/dma-buf/dma-fence-chain.c | 241
++++++++++++++++++++++++++++++
 include/linux/dma-fence-chain.h   |  81 ++++++++++
 3 files changed, 324 insertions(+), 1 deletion(-)  create mode 100644

drivers/dma-buf/dma-fence-chain.c create mode 100644 include/linux/dma- fence-chain.h

drivers/dma-buf/Makefile index renamed from drivers/dma-buf/Makefile +0 -0

0913a6ccab5a..1f006e083eb9 100644

drivers/dma-buf/Makefile +0 -1
@@ -1,4 +1,5 @@
-obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-

fence.o

drivers/dma-buf/Makefile +2 -0
+obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
+	 reservation.o seqno-fence.o
 obj-$(CONFIG_SYNC_FILE)		+= sync_file.o
 obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)		+= udmabuf.o
drivers/dma-buf/dma- renamed from drivers/dma-buf/dma-fence-chain.c +0 -0

fence-chain.c
new file mode 100644
index 000000000000..0c5e3c902fa0

drivers/dma-buf/dma-fence-chain.c new file +16 -0
@@ -0,0 +1,241 @@
+/*
+ * fence-chain: chain fences together in a timeline
+ *
+ * Copyright (C) 2018 Advanced Micro Devices, Inc.
+ * Authors:
+ *	Christian König <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+it
+ * under the terms of the GNU General Public License version 2 as
+published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+WITHOUT
+ * ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY

drivers/dma-buf/dma-fence-chain.c new file +56 -0
+or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+License for
+ * more details.
+ */
+
+#include <linux/dma-fence-chain.h>
+
+static bool dma_fence_chain_enable_signaling(struct dma_fence *fence);
+
+/**
+ * dma_fence_chain_get_prev - use RCU to get a reference to the
+previous fence
+ * @chain: chain node to get the previous node from
+ *
+ * Use dma_fence_get_rcu_safe to get a reference to the previous fence
+of the
+ * chain node.
+ */
+static struct dma_fence *dma_fence_chain_get_prev(struct
+dma_fence_chain *chain) {
+	struct dma_fence *prev;
+
+	rcu_read_lock();
+	prev = dma_fence_get_rcu_safe(&chain->prev);
+	rcu_read_unlock();
+	return prev;
+}
+
+/**
+ * dma_fence_chain_walk - chain walking function
+ * @fence: current chain node
+ *
+ * Walk the chain to the next node. Returns the next fence or NULL if
+we are at
+ * the end of the chain. Garbage collects chain nodes which are already
+ * signaled.
+ */
+struct dma_fence *dma_fence_chain_walk(struct dma_fence *fence) {
+	struct dma_fence_chain *chain, *prev_chain;
+	struct dma_fence *prev, *replacement, *tmp;
+
+	chain = to_dma_fence_chain(fence);
+	if (!chain) {
+		dma_fence_put(fence);
+		return NULL;
+	}
+
+	while ((prev = dma_fence_chain_get_prev(chain))) {
+
+		prev_chain = to_dma_fence_chain(prev);
+		if (prev_chain) {
+			if (!dma_fence_is_signaled(prev_chain->fence))
+				break;
+
+			replacement =

dma_fence_chain_get_prev(prev_chain);

drivers/dma-buf/dma-fence-chain.c new file +92 -0
+		} else {
+			if (!dma_fence_is_signaled(prev))
+				break;
+
+			replacement = NULL;
+		}
+
+		tmp = cmpxchg(&chain->prev, prev, replacement);
+		if (tmp == prev)
+			dma_fence_put(tmp);
+		else
+			dma_fence_put(replacement);
+		dma_fence_put(prev);
+	}
+
+	dma_fence_put(fence);
+	return prev;
+}
+EXPORT_SYMBOL(dma_fence_chain_walk);
+
+/**
+ * dma_fence_chain_find_seqno - find fence chain node by seqno
+ * @pfence: pointer to the chain node where to start
+ * @seqno: the sequence number to search for
+ *
+ * Advance the fence pointer to the chain node which will signal this
+sequence
+ * number. If no sequence number is provided then this is a no-op.
+ *
+ * Returns EINVAL if the fence is not a chain node or the sequence
+number has
+ * not yet advanced far enough.
+ */
+int dma_fence_chain_find_seqno(struct dma_fence **pfence, uint64_t
+seqno) {
+	struct dma_fence_chain *chain;
+
+	if (!seqno)
+		return 0;
+
+	chain = to_dma_fence_chain(*pfence);
+	if (!chain || chain->base.seqno < seqno)
+		return -EINVAL;
+
+	dma_fence_chain_for_each(*pfence, &chain->base) {
+		if ((*pfence)->context != chain->base.context ||
+		    to_dma_fence_chain(*pfence)->prev_seqno < seqno)
+			break;
+	}
+	dma_fence_put(&chain->base);
+
+	return 0;
+}
+EXPORT_SYMBOL(dma_fence_chain_find_seqno);
+
+static const char *dma_fence_chain_get_driver_name(struct dma_fence
+*fence) {
+        return "dma_fence_chain";
+}
+
+static const char *dma_fence_chain_get_timeline_name(struct dma_fence
+*fence) {
+        return "unbound";
+}
+
+static void dma_fence_chain_irq_work(struct irq_work *work) {
+	struct dma_fence_chain *chain;
+
+	chain = container_of(work, typeof(*chain), work);
+
+	/* Try to rearm the callback */
+	if (!dma_fence_chain_enable_signaling(&chain->base))
+		/* Ok, we are done. No more unsignaled fences left */
+		dma_fence_signal(&chain->base);
+	dma_fence_put(&chain->base);
+}
+
+static void dma_fence_chain_cb(struct dma_fence *f, struct dma_fence_cb
+*cb) {
+	struct dma_fence_chain *chain;
+
+	chain = container_of(cb, typeof(*chain), cb);
+	irq_work_queue(&chain->work);
+	dma_fence_put(f);
+}
+
+static bool dma_fence_chain_enable_signaling(struct dma_fence *fence) {
+	struct dma_fence_chain *head = to_dma_fence_chain(fence);
+
+	dma_fence_get(&head->base);
+	dma_fence_chain_for_each(fence, &head->base) {
+		struct dma_fence_chain *chain =

to_dma_fence_chain(fence);

drivers/dma-buf/dma-fence-chain.c new file +4 -0
+		struct dma_fence *f = chain ? chain->fence : fence;
+
+		dma_fence_get(f);
+		if (!dma_fence_add_callback(f, &head->cb,

dma_fence_chain_cb)) {

drivers/dma-buf/dma-fence-chain.c new file +12 -0
+			dma_fence_put(fence);
+			return true;
+		}
+		dma_fence_put(f);
+	}
+	dma_fence_put(&head->base);
+	return false;
+}
+
+static bool dma_fence_chain_signaled(struct dma_fence *fence) {
+	dma_fence_chain_for_each(fence, fence) {
+		struct dma_fence_chain *chain =

to_dma_fence_chain(fence);

drivers/dma-buf/dma-fence-chain.c new file +59 -0
+		struct dma_fence *f = chain ? chain->fence : fence;
+
+		if (!dma_fence_is_signaled(f)) {
+			dma_fence_put(fence);
+			return false;
+		}
+	}
+
+	return true;
+}
+
+static void dma_fence_chain_release(struct dma_fence *fence) {
+	struct dma_fence_chain *chain = to_dma_fence_chain(fence);
+
+	dma_fence_put(chain->prev);
+	dma_fence_put(chain->fence);
+	dma_fence_free(fence);
+}
+
+const struct dma_fence_ops dma_fence_chain_ops = {
+	.get_driver_name = dma_fence_chain_get_driver_name,
+	.get_timeline_name = dma_fence_chain_get_timeline_name,
+	.enable_signaling = dma_fence_chain_enable_signaling,
+	.signaled = dma_fence_chain_signaled,
+	.release = dma_fence_chain_release,
+};
+EXPORT_SYMBOL(dma_fence_chain_ops);
+
+/**
+ * dma_fence_chain_init - initialize a fence chain
+ * @chain: the chain node to initialize
+ * @prev: the previous fence
+ * @fence: the current fence
+ *
+ * Initialize a new chain node and either start a new chain or add the
+node to
+ * the existing chain of the previous fence.
+ */
+void dma_fence_chain_init(struct dma_fence_chain *chain,
+			  struct dma_fence *prev,
+			  struct dma_fence *fence,
+			  uint64_t seqno)
+{
+	struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
+	uint64_t context;
+
+	spin_lock_init(&chain->lock);
+	chain->prev = prev;
+	chain->fence = fence;
+	chain->prev_seqno = 0;
+	init_irq_work(&chain->work, dma_fence_chain_irq_work);
+
+	/* Try to reuse the context of the previous chain node. */
+	if (prev_chain && __dma_fence_is_later(seqno, prev->seqno)) {
+		context = prev->context;
+		chain->prev_seqno = prev->seqno;
+	} else {
+		context = dma_fence_context_alloc(1);
+		/* Make sure that we always have a valid sequence number.

*/

drivers/dma-buf/dma-fence-chain.c new file +7 -0
+		if (prev_chain)
+			seqno = max(prev->seqno, seqno);
+	}
+
+	dma_fence_init(&chain->base, &dma_fence_chain_ops,
+		       &chain->lock, context, seqno); }
+EXPORT_SYMBOL(dma_fence_chain_init);
include/linux/dma-fence- renamed from include/linux/dma-fence-chain.h +0 -0

chain.h new file mode 100644 index 000000000000..a5c2e8c6915c

include/linux/dma-fence-chain.h new file +16 -0
@@ -0,0 +1,81 @@
+/*
+ * fence-chain: chain fences together in a timeline
+ *
+ * Copyright (C) 2018 Advanced Micro Devices, Inc.
+ * Authors:
+ *	Christian König <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+it
+ * under the terms of the GNU General Public License version 2 as
+published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+WITHOUT
+ * ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY

include/linux/dma-fence-chain.h new file +63 -0
+or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+License for
+ * more details.
+ */
+
+#ifndef __LINUX_DMA_FENCE_CHAIN_H
+#define __LINUX_DMA_FENCE_CHAIN_H
+
+#include <linux/dma-fence.h>
+#include <linux/irq_work.h>
+
+/**
+ * struct dma_fence_chain - fence to represent an node of a fence chain
+ * @base: fence base class
+ * @lock: spinlock for fence handling
+ * @prev: previous fence of the chain
+ * @prev_seqno: original previous seqno before garbage collection
+ * @fence: encapsulated fence
+ * @cb: callback structure for signaling
+ * @work: irq work item for signaling
+ */
+struct dma_fence_chain {
+	struct dma_fence base;
+	spinlock_t lock;
+	struct dma_fence *prev;
+	u64 prev_seqno;
+	struct dma_fence *fence;
+	struct dma_fence_cb cb;
+	struct irq_work work;
+};
+
+extern const struct dma_fence_ops dma_fence_chain_ops;
+
+/**
+ * to_dma_fence_chain - cast a fence to a dma_fence_chain
+ * @fence: fence to cast to a dma_fence_array
+ *
+ * Returns NULL if the fence is not a dma_fence_chain,
+ * or the dma_fence_chain otherwise.
+ */
+static inline struct dma_fence_chain *
+to_dma_fence_chain(struct dma_fence *fence) {
+	if (!fence || fence->ops != &dma_fence_chain_ops)
+		return NULL;
+
+	return container_of(fence, struct dma_fence_chain, base); }
+
+/**
+ * dma_fence_chain_for_each - iterate over all fences in chain
+ * @iter: current fence
+ * @head: starting point
+ *
+ * Iterate over all fences in the chain. We keep a reference to the
+current
+ * fence while inside the loop which must be dropped when breaking out.
+ */
+#define dma_fence_chain_for_each(iter, head)	\
+	for (iter = dma_fence_get(head); iter; \
+	     iter = dma_fence_chain_walk(head))
+
+struct dma_fence *dma_fence_chain_walk(struct dma_fence *fence); int
+dma_fence_chain_find_seqno(struct dma_fence **pfence, uint64_t

seqno);

include/linux/dma-fence-chain.h new file +6 -1
+void dma_fence_chain_init(struct dma_fence_chain *chain,
+			  struct dma_fence *prev,
+			  struct dma_fence *fence,
+			  uint64_t seqno);
+
+#endif /* __LINUX_DMA_FENCE_CHAIN_H */
--

2.17.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx