Skip to contentSkip to conversation

dma_resv: prime lockdep annotations

PATCH In review Daniel Vetter 9 participants 30 messages Aug 21, 2019 – Sep 18, 2019 3 messages not in the archive

Subsystems (5)
DRM drivers DRM misc nouveau DRM TTM +1 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dma_resv: prime lockdep annotations

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/dma-buf/dma-resv.c | 42 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/dma-buf/dma-resv.c +42 -0
index 42a8f3f11681..29988b1564c1 100644
@@ -34,6 +34,7 @@
 
 #include <linux/dma-resv.h>
 #include <linux/export.h>
+#include <linux/sched/mm.h>
 
 /**
  * DOC: Reservation Object Overview
@@ -95,6 +96,28 @@ static void dma_resv_list_free(struct dma_resv_list *list)
 	kfree_rcu(list, rcu);
 }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+struct lockdep_work {
+	struct work_struct work;
+	struct dma_resv obj;
+	struct mm_struct *mm;
+} lockdep_work;
+
+void lockdep_work_fn(struct work_struct *work)
+{
+	dma_resv_init(&lockdep_work.obj);
+
+	down_read(&lockdep_work.mm->mmap_sem);
+	ww_mutex_lock(&lockdep_work.obj.lock, NULL);
+	fs_reclaim_acquire(GFP_KERNEL);
+	fs_reclaim_release(GFP_KERNEL);
+	ww_mutex_unlock(&lockdep_work.obj.lock);
+	up_read(&lockdep_work.mm->mmap_sem);
+	
+	mmput(lockdep_work.mm);
+}
+#endif
+
 /**
  * dma_resv_init - initialize a reservation object
  * @obj: the reservation object
@@ -107,6 +130,25 @@ void dma_resv_init(struct dma_resv *obj)
 			&reservation_seqcount_class);
 	RCU_INIT_POINTER(obj->fence, NULL);
 	RCU_INIT_POINTER(obj->fence_excl, NULL);
+
+#if IS_ENABLED(CONFIG_LOCKDEP)
+	if (current->mm) {
+		static atomic_t lockdep_primed;
+
+		/*
+		 * This gets called from all kinds of places, launch a worker.
+		 * Usual init sections don't work for kernel threads lack an
+		 * ->mm.
+		 */
+		if (atomic_cmpxchg(&lockdep_primed, 0, 1) == 0) {
+			INIT_WORK(&lockdep_work.work, lockdep_work_fn);
+			lockdep_work.mm = current->mm;
+			mmget(lockdep_work.mm);
+
+			schedule_work(&lockdep_work.work);
+		}
+	}
+#endif
 }
 EXPORT_SYMBOL(dma_resv_init);
 
Signature · 6 lines
2.23.0.rc1

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

A message that is not in the archive (sent off-list or not yet received): 20190821215030.31660-1-daniel.vetter-/[email protected]

#2 lore raw

PATCH 2/3 drm/nouveau: slowpath for pushbuf ioctl

We can't copy_*_user while holding reservations, that will (soon even for nouveau) lead to deadlocks. And it breaks the cross-driver contract around dma_resv.

Fix this by adding a slowpath for when we need relocations, and by pushing the writeback of the new presumed offsets to the very end.

Aside from "it compiles" entirely untested unfortunately.

---
 drivers/gpu/drm/nouveau/nouveau_gem.c | 57 ++++++++++++++++++---------
 1 file changed, 38 insertions(+), 19 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +38 -19
index c77302f969e8..60309b997951 100644
@@ -482,12 +482,9 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
 
 static int
 validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
-	      struct list_head *list, struct drm_nouveau_gem_pushbuf_bo *pbbo,
-	      uint64_t user_pbbo_ptr)
+	      struct list_head *list, struct drm_nouveau_gem_pushbuf_bo *pbbo)
 {
 	struct nouveau_drm *drm = chan->drm;
-	struct drm_nouveau_gem_pushbuf_bo __user *upbbo =
-				(void __force __user *)(uintptr_t)user_pbbo_ptr;
 	struct nouveau_bo *nvbo;
 	int ret, relocs = 0;
 
@@ -531,10 +528,6 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
 			b->presumed.offset = nvbo->bo.offset;
 			b->presumed.valid = 0;
 			relocs++;
-
-			if (copy_to_user(&upbbo[nvbo->pbbo_index].presumed,
-					     &b->presumed, sizeof(b->presumed)))
-				return -EFAULT;
 		}
 	}
 
@@ -545,8 +538,8 @@ static int
 nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 			     struct drm_file *file_priv,
 			     struct drm_nouveau_gem_pushbuf_bo *pbbo,
-			     uint64_t user_buffers, int nr_buffers,
-			     struct validate_op *op, int *apply_relocs)
+			     int nr_buffers,
+			     struct validate_op *op, bool *apply_relocs)
 {
 	struct nouveau_cli *cli = nouveau_cli(file_priv);
 	int ret;
@@ -563,7 +556,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 		return ret;
 	}
 
-	ret = validate_list(chan, cli, &op->list, pbbo, user_buffers);
+	ret = validate_list(chan, cli, &op->list, pbbo);
 	if (unlikely(ret < 0)) {
 		if (ret != -ERESTARTSYS)
 			NV_PRINTK(err, cli, "validating bo list\n");
@@ -603,16 +596,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
 static int
 nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
 				struct drm_nouveau_gem_pushbuf *req,
+				struct drm_nouveau_gem_pushbuf_reloc *reloc,
 				struct drm_nouveau_gem_pushbuf_bo *bo)
 {
-	struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL;
 	int ret = 0;
 	unsigned i;
 
-	reloc = u_memcpya(req->relocs, req->nr_relocs, sizeof(*reloc));
-	if (IS_ERR(reloc))
-		return PTR_ERR(reloc);
-
 	for (i = 0; i < req->nr_relocs; i++) {
 		struct drm_nouveau_gem_pushbuf_reloc *r = &reloc[i];
 		struct drm_nouveau_gem_pushbuf_bo *b;
@@ -691,11 +680,13 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct drm_nouveau_gem_pushbuf *req = data;
 	struct drm_nouveau_gem_pushbuf_push *push;
+	struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL;
 	struct drm_nouveau_gem_pushbuf_bo *bo;
 	struct nouveau_channel *chan = NULL;
 	struct validate_op op;
 	struct nouveau_fence *fence = NULL;
-	int i, j, ret = 0, do_reloc = 0;
+	int i, j, ret = 0;
+	bool do_reloc = false;
 
 	if (unlikely(!abi16))
 		return -ENOMEM;
@@ -753,7 +744,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	}
 
 	/* Validate buffer list */
-	ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo, req->buffers,
+revalidate:
+	ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo,
 					   req->nr_buffers, &op, &do_reloc);
 	if (ret) {
 		if (ret != -ERESTARTSYS)
@@ -763,7 +755,18 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 
 	/* Apply any relocations that are required */
 	if (do_reloc) {
-		ret = nouveau_gem_pushbuf_reloc_apply(cli, req, bo);
+		if (!reloc) {
+			validate_fini(&op, chan, NULL, bo);
+			reloc = u_memcpya(req->relocs, req->nr_relocs, sizeof(*reloc));
+			if (IS_ERR(reloc)) {
+				ret = PTR_ERR(reloc);
+				goto out_prevalid;
+			}
+
+			goto revalidate;
+		}
+
+		ret = nouveau_gem_pushbuf_reloc_apply(cli, req, reloc, bo);
 		if (ret) {
 			NV_PRINTK(err, cli, "reloc apply: %d\n", ret);
 			goto out;
@@ -849,6 +852,22 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	validate_fini(&op, chan, fence, bo);
 	nouveau_fence_unref(&fence);
 
+	if (do_reloc) {
+		struct drm_nouveau_gem_pushbuf_bo __user *upbbo =
+			u64_to_user_ptr(req->buffers);
+
+		for (i = 0; i < req->nr_buffers; i++) {
+			if (bo[i].presumed.valid)
+				continue;
+
+			if (copy_to_user(&upbbo[i].presumed, &bo[i].presumed,
+					 sizeof(bo[i].presumed))) {
+				ret = -EFAULT;
+				break;
+			}
+		}
+		u_free(reloc);
+	}
 out_prevalid:
 	u_free(bo);
 	u_free(push);
Signature · 6 lines
2.23.0.rc1

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20190821215030.31660-2-daniel.vetter-/[email protected]

#4 lore raw

Re: [PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl

Quoted 4 lines · Daniel Vetter

We can't copy_*_user while holding reservations, that will (soon even for nouveau) lead to deadlocks. And it breaks the cross-driver contract around dma_resv.

Quoted 8 lines

Fix this by adding a slowpath for when we need relocations, and by pushing the writeback of the new presumed offsets to the very end.

Aside from "it compiles" entirely untested unfortunately.

Ping for some review/testing (apparently needs pre-nv50). I'd really like to land this series here, it should help a lot in making sure everyone uses dma_resv in a compatible way across drivers.

Thanks, Daniel

Quoted 142 lines
---
 drivers/gpu/drm/nouveau/nouveau_gem.c | 57 ++++++++++++++++++---------
 1 file changed, 38 insertions(+), 19 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +38 -19
index c77302f969e8..60309b997951 100644
@@ -482,12 +482,9 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
 
 static int
 validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
-	      struct list_head *list, struct drm_nouveau_gem_pushbuf_bo *pbbo,
-	      uint64_t user_pbbo_ptr)
+	      struct list_head *list, struct drm_nouveau_gem_pushbuf_bo *pbbo)
 {
 	struct nouveau_drm *drm = chan->drm;
-	struct drm_nouveau_gem_pushbuf_bo __user *upbbo =
-				(void __force __user *)(uintptr_t)user_pbbo_ptr;
 	struct nouveau_bo *nvbo;
 	int ret, relocs = 0;
 
@@ -531,10 +528,6 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
 			b->presumed.offset = nvbo->bo.offset;
 			b->presumed.valid = 0;
 			relocs++;
-
-			if (copy_to_user(&upbbo[nvbo->pbbo_index].presumed,
-					     &b->presumed, sizeof(b->presumed)))
-				return -EFAULT;
 		}
 	}
 
@@ -545,8 +538,8 @@ static int
 nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 			     struct drm_file *file_priv,
 			     struct drm_nouveau_gem_pushbuf_bo *pbbo,
-			     uint64_t user_buffers, int nr_buffers,
-			     struct validate_op *op, int *apply_relocs)
+			     int nr_buffers,
+			     struct validate_op *op, bool *apply_relocs)
 {
 	struct nouveau_cli *cli = nouveau_cli(file_priv);
 	int ret;
@@ -563,7 +556,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 		return ret;
 	}
 
-	ret = validate_list(chan, cli, &op->list, pbbo, user_buffers);
+	ret = validate_list(chan, cli, &op->list, pbbo);
 	if (unlikely(ret < 0)) {
 		if (ret != -ERESTARTSYS)
 			NV_PRINTK(err, cli, "validating bo list\n");
@@ -603,16 +596,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
 static int
 nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
 				struct drm_nouveau_gem_pushbuf *req,
+				struct drm_nouveau_gem_pushbuf_reloc *reloc,
 				struct drm_nouveau_gem_pushbuf_bo *bo)
 {
-	struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL;
 	int ret = 0;
 	unsigned i;
 
-	reloc = u_memcpya(req->relocs, req->nr_relocs, sizeof(*reloc));
-	if (IS_ERR(reloc))
-		return PTR_ERR(reloc);
-
 	for (i = 0; i < req->nr_relocs; i++) {
 		struct drm_nouveau_gem_pushbuf_reloc *r = &reloc[i];
 		struct drm_nouveau_gem_pushbuf_bo *b;
@@ -691,11 +680,13 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct drm_nouveau_gem_pushbuf *req = data;
 	struct drm_nouveau_gem_pushbuf_push *push;
+	struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL;
 	struct drm_nouveau_gem_pushbuf_bo *bo;
 	struct nouveau_channel *chan = NULL;
 	struct validate_op op;
 	struct nouveau_fence *fence = NULL;
-	int i, j, ret = 0, do_reloc = 0;
+	int i, j, ret = 0;
+	bool do_reloc = false;
 
 	if (unlikely(!abi16))
 		return -ENOMEM;
@@ -753,7 +744,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	}
 
 	/* Validate buffer list */
-	ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo, req->buffers,
+revalidate:
+	ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo,
 					   req->nr_buffers, &op, &do_reloc);
 	if (ret) {
 		if (ret != -ERESTARTSYS)
@@ -763,7 +755,18 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 
 	/* Apply any relocations that are required */
 	if (do_reloc) {
-		ret = nouveau_gem_pushbuf_reloc_apply(cli, req, bo);
+		if (!reloc) {
+			validate_fini(&op, chan, NULL, bo);
+			reloc = u_memcpya(req->relocs, req->nr_relocs, sizeof(*reloc));
+			if (IS_ERR(reloc)) {
+				ret = PTR_ERR(reloc);
+				goto out_prevalid;
+			}
+
+			goto revalidate;
+		}
+
+		ret = nouveau_gem_pushbuf_reloc_apply(cli, req, reloc, bo);
 		if (ret) {
 			NV_PRINTK(err, cli, "reloc apply: %d\n", ret);
 			goto out;
@@ -849,6 +852,22 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	validate_fini(&op, chan, fence, bo);
 	nouveau_fence_unref(&fence);
 
+	if (do_reloc) {
+		struct drm_nouveau_gem_pushbuf_bo __user *upbbo =
+			u64_to_user_ptr(req->buffers);
+
+		for (i = 0; i < req->nr_buffers; i++) {
+			if (bo[i].presumed.valid)
+				continue;
+
+			if (copy_to_user(&upbbo[i].presumed, &bo[i].presumed,
+					 sizeof(bo[i].presumed))) {
+				ret = -EFAULT;
+				break;
+			}
+		}
+		u_free(reloc);
+	}
 out_prevalid:
 	u_free(bo);
 	u_free(push);
Signature · 1 line
2.23.0.rc1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

#6 lore raw

Re: [PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl

Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Daniel Vetter

We can't copy_*_user while holding reservations, that will (soon even for nouveau) lead to deadlocks. And it breaks the cross-driver contract around dma_resv.

Fix this by adding a slowpath for when we need relocations, and by pushing the writeback of the new presumed offsets to the very end.

Aside from "it compiles" entirely untested unfortunately.

Quoted 7 lines
Quoted 3 lines

Ping for some review/testing (apparently needs pre-nv50). I'd really like to land this series here, it should help a lot in making sure everyone uses dma_resv in a compatible way across drivers.

Now that the gem/ttm fallout is fixed, ping for testing on this one here ... Also need some r-b to get this landed.

Thanks, Daniel

Quoted 147 lines
Quoted 142 lines
---
 drivers/gpu/drm/nouveau/nouveau_gem.c | 57 ++++++++++++++++++---------
 1 file changed, 38 insertions(+), 19 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +38 -19
index c77302f969e8..60309b997951 100644
@@ -482,12 +482,9 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
 
 static int
 validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
-	      struct list_head *list, struct drm_nouveau_gem_pushbuf_bo *pbbo,
-	      uint64_t user_pbbo_ptr)
+	      struct list_head *list, struct drm_nouveau_gem_pushbuf_bo *pbbo)
 {
 	struct nouveau_drm *drm = chan->drm;
-	struct drm_nouveau_gem_pushbuf_bo __user *upbbo =
-				(void __force __user *)(uintptr_t)user_pbbo_ptr;
 	struct nouveau_bo *nvbo;
 	int ret, relocs = 0;
 
@@ -531,10 +528,6 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
 			b->presumed.offset = nvbo->bo.offset;
 			b->presumed.valid = 0;
 			relocs++;
-
-			if (copy_to_user(&upbbo[nvbo->pbbo_index].presumed,
-					     &b->presumed, sizeof(b->presumed)))
-				return -EFAULT;
 		}
 	}
 
@@ -545,8 +538,8 @@ static int
 nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 			     struct drm_file *file_priv,
 			     struct drm_nouveau_gem_pushbuf_bo *pbbo,
-			     uint64_t user_buffers, int nr_buffers,
-			     struct validate_op *op, int *apply_relocs)
+			     int nr_buffers,
+			     struct validate_op *op, bool *apply_relocs)
 {
 	struct nouveau_cli *cli = nouveau_cli(file_priv);
 	int ret;
@@ -563,7 +556,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
 		return ret;
 	}
 
-	ret = validate_list(chan, cli, &op->list, pbbo, user_buffers);
+	ret = validate_list(chan, cli, &op->list, pbbo);
 	if (unlikely(ret < 0)) {
 		if (ret != -ERESTARTSYS)
 			NV_PRINTK(err, cli, "validating bo list\n");
@@ -603,16 +596,12 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
 static int
 nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli,
 				struct drm_nouveau_gem_pushbuf *req,
+				struct drm_nouveau_gem_pushbuf_reloc *reloc,
 				struct drm_nouveau_gem_pushbuf_bo *bo)
 {
-	struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL;
 	int ret = 0;
 	unsigned i;
 
-	reloc = u_memcpya(req->relocs, req->nr_relocs, sizeof(*reloc));
-	if (IS_ERR(reloc))
-		return PTR_ERR(reloc);
-
 	for (i = 0; i < req->nr_relocs; i++) {
 		struct drm_nouveau_gem_pushbuf_reloc *r = &reloc[i];
 		struct drm_nouveau_gem_pushbuf_bo *b;
@@ -691,11 +680,13 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	struct nouveau_drm *drm = nouveau_drm(dev);
 	struct drm_nouveau_gem_pushbuf *req = data;
 	struct drm_nouveau_gem_pushbuf_push *push;
+	struct drm_nouveau_gem_pushbuf_reloc *reloc = NULL;
 	struct drm_nouveau_gem_pushbuf_bo *bo;
 	struct nouveau_channel *chan = NULL;
 	struct validate_op op;
 	struct nouveau_fence *fence = NULL;
-	int i, j, ret = 0, do_reloc = 0;
+	int i, j, ret = 0;
+	bool do_reloc = false;
 
 	if (unlikely(!abi16))
 		return -ENOMEM;
@@ -753,7 +744,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	}
 
 	/* Validate buffer list */
-	ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo, req->buffers,
+revalidate:
+	ret = nouveau_gem_pushbuf_validate(chan, file_priv, bo,
 					   req->nr_buffers, &op, &do_reloc);
 	if (ret) {
 		if (ret != -ERESTARTSYS)
@@ -763,7 +755,18 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 
 	/* Apply any relocations that are required */
 	if (do_reloc) {
-		ret = nouveau_gem_pushbuf_reloc_apply(cli, req, bo);
+		if (!reloc) {
+			validate_fini(&op, chan, NULL, bo);
+			reloc = u_memcpya(req->relocs, req->nr_relocs, sizeof(*reloc));
+			if (IS_ERR(reloc)) {
+				ret = PTR_ERR(reloc);
+				goto out_prevalid;
+			}
+
+			goto revalidate;
+		}
+
+		ret = nouveau_gem_pushbuf_reloc_apply(cli, req, reloc, bo);
 		if (ret) {
 			NV_PRINTK(err, cli, "reloc apply: %d\n", ret);
 			goto out;
@@ -849,6 +852,22 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
 	validate_fini(&op, chan, fence, bo);
 	nouveau_fence_unref(&fence);
 
+	if (do_reloc) {
+		struct drm_nouveau_gem_pushbuf_bo __user *upbbo =
+			u64_to_user_ptr(req->buffers);
+
+		for (i = 0; i < req->nr_buffers; i++) {
+			if (bo[i].presumed.valid)
+				continue;
+
+			if (copy_to_user(&upbbo[i].presumed, &bo[i].presumed,
+					 sizeof(bo[i].presumed))) {
+				ret = -EFAULT;
+				break;
+			}
+		}
+		u_free(reloc);
+	}
 out_prevalid:
 	u_free(bo);
 	u_free(push);
Signature · 1 line
2.23.0.rc1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#7 lore raw

PATCH 3/3 drm/ttm: remove ttm_bo_wait_unreserved

In reply to Daniel Vetter

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
 drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
 drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
 include/drm/ttm/ttm_bo_api.h      |  4 ----
 4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
 	dma_fence_put(bo->moving);
 	if (!ttm_bo_uses_embedded_gem_object(bo))
 		dma_resv_fini(&bo->base._resv);
-	mutex_destroy(&bo->wu_mutex);
 	bo->destroy(bo);
 	ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
 }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
 	INIT_LIST_HEAD(&bo->ddestroy);
 	INIT_LIST_HEAD(&bo->swap);
 	INIT_LIST_HEAD(&bo->io_reserve_lru);
-	mutex_init(&bo->wu_mutex);
 	bo->bdev = bdev;
 	bo->type = type;
 	bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
 		;
 }
 EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-	int ret;
-
-	/*
-	 * In the absense of a wait_unlocked API,
-	 * Use the bo::wu_mutex to avoid triggering livelocks due to
-	 * concurrent use of this function. Note that this use of
-	 * bo::wu_mutex can go away if we change locking order to
-	 * mmap_sem -> bo::reserve.
-	 */
-	ret = mutex_lock_interruptible(&bo->wu_mutex);
-	if (unlikely(ret != 0))
-		return -ERESTARTSYS;
-	if (!dma_resv_is_locked(bo->base.resv))
-		goto out_unlock;
-	ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-	if (ret == -EINTR)
-		ret = -ERESTARTSYS;
-	if (unlikely(ret != 0))
-		goto out_unlock;
-	dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-	mutex_unlock(&bo->wu_mutex);
-	return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 	INIT_LIST_HEAD(&fbo->base.lru);
 	INIT_LIST_HEAD(&fbo->base.swap);
 	INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-	mutex_init(&fbo->base.wu_mutex);
 	fbo->base.moving = NULL;
 	drm_vma_node_reset(&fbo->base.base.vma_node);
 	atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -13
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
 		&bdev->man[bo->mem.mem_type];
 	struct vm_area_struct cvma;
 
-	/*
-	 * Work around locking order reversal in fault / nopfn
-	 * between mmap_sem and bo_reserve: Perform a trylock operation
-	 * for reserve, and if it fails, retry the fault after waiting
-	 * for the buffer to become unreserved.
-	 */
 	if (unlikely(!dma_resv_trylock(bo->base.resv))) {
 		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
 			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
 				ttm_bo_get(bo);
 				up_read(&vmf->vma->vm_mm->mmap_sem);
-				(void) ttm_bo_wait_unreserved(bo);
+				if (!dma_resv_lock_interruptible(bo->base.resv,
+								 NULL))
+					dma_resv_unlock(bo->base.resv);
 				ttm_bo_put(bo);
 			}
 
 			return VM_FAULT_RETRY;
 		}
 
-		/*
-		 * If we'd want to change locking order to
-		 * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-		 * instead of retrying the fault...
-		 */
-		return VM_FAULT_NOPAGE;
+		if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+			return VM_FAULT_NOPAGE;
 	}
 
 	/*
include/drm/ttm/ttm_bo_api.h +0 -4
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
  * @offset: The current GPU offset, which can have different meanings
  * depending on the memory type. For SYSTEM type memory, it should be 0.
  * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
  *
  * Base class for TTM buffer object, that deals with data placement and CPU
  * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
 	uint64_t offset; /* GPU address space is independent of CPU word size */
 
 	struct sg_table *sg;
-
-	struct mutex wu_mutex;
 };
 
 /**
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
 int ttm_bo_swapout(struct ttm_bo_global *glob,
 			struct ttm_operation_ctx *ctx);
 void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
 /**
  * ttm_bo_uses_embedded_gem_object - check if the given bo uses the
Signature · 6 lines
2.23.0.rc1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
In reply to Daniel Vetter

Quoting Daniel Vetter (2019-08-21 22:50:28)

Quoted 102 lines

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/dma-buf/dma-resv.c | 42 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/dma-buf/dma-resv.c +12 -0
index 42a8f3f11681..29988b1564c1 100644
@@ -34,6 +34,7 @@
 
 #include <linux/dma-resv.h>
 #include <linux/export.h>
+#include <linux/sched/mm.h>
 
 /**
  * DOC: Reservation Object Overview
@@ -95,6 +96,28 @@ static void dma_resv_list_free(struct dma_resv_list *list)
        kfree_rcu(list, rcu);
 }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+struct lockdep_work {
+       struct work_struct work;
+       struct dma_resv obj;
+       struct mm_struct *mm;
+} lockdep_work;
+
+void lockdep_work_fn(struct work_struct *work)
+{
+       dma_resv_init(&lockdep_work.obj);
+

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 119

Quoted 10 lines
drivers/dma-buf/dma-resv.c +10 -0
+       down_read(&lockdep_work.mm->mmap_sem);
+       ww_mutex_lock(&lockdep_work.obj.lock, NULL);
+       fs_reclaim_acquire(GFP_KERNEL);
+       fs_reclaim_release(GFP_KERNEL);
+       ww_mutex_unlock(&lockdep_work.obj.lock);
+       up_read(&lockdep_work.mm->mmap_sem);
+       
+       mmput(lockdep_work.mm);
+}
+#endif

#if IS_ENABLED(CONFIG_LOCKDEP)
static void dma_resv_lockmap(void)

{
	struct mm_struct *mm = alloc_mm();
	struct dma_resv obj;

	dma_resv_init(&obj);

	down_read(&mm->mmap_sem);
	ww_mutex_lock(&obj.lock, NULL);
	fs_reclaim_acquire(GFP_KERNEL);
	fs_reclaim_release(GFP_KERNEL);
	ww_mutex_unlock(&obj.lock);
	up_read(&mm->mmap_sem);

	mmput(mm);
}

core_initcall(dma_resv_lockmap);
#endif

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

#9 lore raw

✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] dma_resv: prime lockdep annotations

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: series starting with [1/3] dma_resv: prime lockdep annotations
URL : https://patchwork.freedesktop.org/series/65575/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
27b2890c9980 dma_resv: prime lockdep annotations
-:77: WARNING:BAD_SIGN_OFF: email address '"VMware Graphics" <[email protected]>' might be better as 'VMware Graphics <[email protected]>'
#77: 
Cc: "VMware Graphics" <[email protected]>

-:114: ERROR:TRAILING_WHITESPACE: trailing whitespace #114: FILE: drivers/dma-buf/dma-resv.c:116:
+^I$

-:147: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <[email protected]>'

total: 1 errors, 2 warnings, 0 checks, 60 lines checked
b036ba3d6038 drm/nouveau: slowpath for pushbuf ioctl
-:153: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <[email protected]>'

total: 0 errors, 1 warnings, 0 checks, 122 lines checked
95bae0c804e9 drm/ttm: remove ttm_bo_wait_unreserved
-:24: WARNING:BAD_SIGN_OFF: email address '"VMware Graphics" <[email protected]>' might be better as 'VMware Graphics <[email protected]>' #24:
Cc: "VMware Graphics" <[email protected]>

-:165: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <[email protected]>'

total: 0 errors, 2 warnings, 0 checks, 81 lines checked

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

#10 lore raw

✓ Fi.CI.BAT: success for series starting with [1/3] dma_resv: prime lockdep annotations

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: series starting with [1/3] dma_resv: prime lockdep annotations
URL : https://patchwork.freedesktop.org/series/65575/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6759 -> Patchwork_14132
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_mmap_gtt@basic-write-read-distinct:
- fi-icl-u3: [PASS][1] -> [DMESG-WARN][2] ([fdo#107724])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-icl-u3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-icl-u3/igt@[email protected]

* igt@i915_selftest@live_execlists:
- fi-skl-gvtdvm: [PASS][3] -> [DMESG-FAIL][4] ([fdo#111108])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-skl-gvtdvm/igt@i915_selftest@live_execlists.html

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-kbl-7567u: [PASS][5] -> [DMESG-FAIL][6] ([fdo#102505] / [fdo#105079])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@[email protected]

* igt@kms_force_connector_basic@force-connector-state:
- fi-ilk-650: [PASS][7] -> [DMESG-WARN][8] ([fdo#106387])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-ilk-650/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-ilk-650/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-pipe-c:
- fi-kbl-7567u: [PASS][9] -> [SKIP][10] ([fdo#109271]) +19 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@[email protected]

#### Possible fixes ####

* igt@debugfs_test@read_all_entries:
- fi-kbl-7567u: [DMESG-WARN][11] ([fdo#103558] / [fdo#105602]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@debugfs_test@read_all_entries.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@debugfs_test@read_all_entries.html

* igt@gem_exec_suspend@basic-s3:
- fi-kbl-7567u: [DMESG-WARN][13] ([fdo#103558] / [fdo#105079] / [fdo#105602]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@[email protected]

* igt@kms_busy@basic-flip-a:
- fi-kbl-7567u: [SKIP][15] ([fdo#109271] / [fdo#109278]) -> [PASS][16] +2 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@[email protected]

* igt@kms_chamelium@hdmi-edid-read:
- fi-kbl-7567u: [FAIL][17] ([fdo#109569]) -> [PASS][18] +1 similar issue
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@[email protected]

#### Warnings ####

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: [FAIL][19] ([fdo#109483]) -> [FAIL][20] ([fdo#111407])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-icl-u2/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-icl-u2/igt@[email protected]
- fi-kbl-7567u: [FAIL][21] ([fdo#109800]) -> [FAIL][22] ([fdo#111407])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-kbl-7567u: [DMESG-FAIL][23] ([fdo#105079]) -> [SKIP][24] ([fdo#109271])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/fi-kbl-7567u/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/fi-kbl-7567u/igt@[email protected]

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

[fdo#102505]: https://bugs.freedesktop.org/show_bug.cgi?id=102505
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#105079]: https://bugs.freedesktop.org/show_bug.cgi?id=105079
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#106387]: https://bugs.freedesktop.org/show_bug.cgi?id=106387
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
[fdo#109569]: https://bugs.freedesktop.org/show_bug.cgi?id=109569
[fdo#109800]: https://bugs.freedesktop.org/show_bug.cgi?id=109800
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111108]: https://bugs.freedesktop.org/show_bug.cgi?id=111108
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407

Participating hosts (56 -> 47)
------------------------------

Missing (9): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-gdg-551 fi-icl-y fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6759 -> Patchwork_14132

CI-20190529: 20190529
CI_DRM_6759: ef8503f9bd35e778de52953fe627fd50f316d712 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5146: 357dbe1869d88a2f08bcee4eebceff4ee9014424 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14132: 95bae0c804e91ea50401859c0f59635eed746891 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

95bae0c804e9 drm/ttm: remove ttm_bo_wait_unreserved b036ba3d6038 drm/nouveau: slowpath for pushbuf ioctl 27b2890c9980 dma_resv: prime lockdep annotations

== Logs ==

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

#11 lore raw

PATCH 1/1 drm/ttm: remove ttm_bo_wait_unreserved

In reply to Daniel Vetter

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
 drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
 drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
 include/drm/ttm/ttm_bo_api.h      |  4 ----
 4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
 	dma_fence_put(bo->moving);
 	if (!ttm_bo_uses_embedded_gem_object(bo))
 		dma_resv_fini(&bo->base._resv);
-	mutex_destroy(&bo->wu_mutex);
 	bo->destroy(bo);
 	ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
 }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
 	INIT_LIST_HEAD(&bo->ddestroy);
 	INIT_LIST_HEAD(&bo->swap);
 	INIT_LIST_HEAD(&bo->io_reserve_lru);
-	mutex_init(&bo->wu_mutex);
 	bo->bdev = bdev;
 	bo->type = type;
 	bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
 		;
 }
 EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-	int ret;
-
-	/*
-	 * In the absense of a wait_unlocked API,
-	 * Use the bo::wu_mutex to avoid triggering livelocks due to
-	 * concurrent use of this function. Note that this use of
-	 * bo::wu_mutex can go away if we change locking order to
-	 * mmap_sem -> bo::reserve.
-	 */
-	ret = mutex_lock_interruptible(&bo->wu_mutex);
-	if (unlikely(ret != 0))
-		return -ERESTARTSYS;
-	if (!dma_resv_is_locked(bo->base.resv))
-		goto out_unlock;
-	ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-	if (ret == -EINTR)
-		ret = -ERESTARTSYS;
-	if (unlikely(ret != 0))
-		goto out_unlock;
-	dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-	mutex_unlock(&bo->wu_mutex);
-	return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
 	INIT_LIST_HEAD(&fbo->base.lru);
 	INIT_LIST_HEAD(&fbo->base.swap);
 	INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-	mutex_init(&fbo->base.wu_mutex);
 	fbo->base.moving = NULL;
 	drm_vma_node_reset(&fbo->base.base.vma_node);
 	atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -13
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
 		&bdev->man[bo->mem.mem_type];
 	struct vm_area_struct cvma;
 
-	/*
-	 * Work around locking order reversal in fault / nopfn
-	 * between mmap_sem and bo_reserve: Perform a trylock operation
-	 * for reserve, and if it fails, retry the fault after waiting
-	 * for the buffer to become unreserved.
-	 */
 	if (unlikely(!dma_resv_trylock(bo->base.resv))) {
 		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
 			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
 				ttm_bo_get(bo);
 				up_read(&vmf->vma->vm_mm->mmap_sem);
-				(void) ttm_bo_wait_unreserved(bo);
+				if (!dma_resv_lock_interruptible(bo->base.resv,
+								 NULL))
+					dma_resv_unlock(bo->base.resv);
 				ttm_bo_put(bo);
 			}
 
 			return VM_FAULT_RETRY;
 		}
 
-		/*
-		 * If we'd want to change locking order to
-		 * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-		 * instead of retrying the fault...
-		 */
-		return VM_FAULT_NOPAGE;
+		if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+			return VM_FAULT_NOPAGE;
 	}
 
 	/*
include/drm/ttm/ttm_bo_api.h +0 -4
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
  * @offset: The current GPU offset, which can have different meanings
  * depending on the memory type. For SYSTEM type memory, it should be 0.
  * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
  *
  * Base class for TTM buffer object, that deals with data placement and CPU
  * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
 	uint64_t offset; /* GPU address space is independent of CPU word size */
 
 	struct sg_table *sg;
-
-	struct mutex wu_mutex;
 };
 
 /**
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
 int ttm_bo_swapout(struct ttm_bo_global *glob,
 			struct ttm_operation_ctx *ctx);
 void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
 /**
  * ttm_bo_uses_embedded_gem_object - check if the given bo uses the
Signature · 6 lines
2.23.0.rc1

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

Re: [PATCH] drm/ttm: remove ttm_bo_wait_unreserved

Am 22.08.19 um 08:49 schrieb Daniel Vetter:

Quoted 101 lines

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
  drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
  drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
  drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
  include/drm/ttm/ttm_bo_api.h      |  4 ----
  4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
  	dma_fence_put(bo->moving);
  	if (!ttm_bo_uses_embedded_gem_object(bo))
  		dma_resv_fini(&bo->base._resv);
-	mutex_destroy(&bo->wu_mutex);
  	bo->destroy(bo);
  	ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
  }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
  	INIT_LIST_HEAD(&bo->ddestroy);
  	INIT_LIST_HEAD(&bo->swap);
  	INIT_LIST_HEAD(&bo->io_reserve_lru);
-	mutex_init(&bo->wu_mutex);
  	bo->bdev = bdev;
  	bo->type = type;
  	bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
  		;
  }
  EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-	int ret;
-
-	/*
-	 * In the absense of a wait_unlocked API,
-	 * Use the bo::wu_mutex to avoid triggering livelocks due to
-	 * concurrent use of this function. Note that this use of
-	 * bo::wu_mutex can go away if we change locking order to
-	 * mmap_sem -> bo::reserve.
-	 */
-	ret = mutex_lock_interruptible(&bo->wu_mutex);
-	if (unlikely(ret != 0))
-		return -ERESTARTSYS;
-	if (!dma_resv_is_locked(bo->base.resv))
-		goto out_unlock;
-	ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-	if (ret == -EINTR)
-		ret = -ERESTARTSYS;
-	if (unlikely(ret != 0))
-		goto out_unlock;
-	dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-	mutex_unlock(&bo->wu_mutex);
-	return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
  	INIT_LIST_HEAD(&fbo->base.lru);
  	INIT_LIST_HEAD(&fbo->base.swap);
  	INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-	mutex_init(&fbo->base.wu_mutex);
  	fbo->base.moving = NULL;
  	drm_vma_node_reset(&fbo->base.base.vma_node);
  	atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -0
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
  		&bdev->man[bo->mem.mem_type];
  	struct vm_area_struct cvma;

drivers/gpu/drm/ttm/ttm_bo_vm.c static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · line 130

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -6
 
-	/*
-	 * Work around locking order reversal in fault / nopfn
-	 * between mmap_sem and bo_reserve: Perform a trylock operation
-	 * for reserve, and if it fails, retry the fault after waiting
-	 * for the buffer to become unreserved.
-	 */
  	if (unlikely(!dma_resv_trylock(bo->base.resv))) {
  		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
  			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {

Not an expert on fault handling, but shouldn't this now be one if?

E.g. if FAULT_FLAG_RETRY_NOWAIT is set we should return VM_FAULT_NOPAGE instead of VM_FAULT_RETRY.

But really take that with a grain of salt,
Christian.

Quoted 45 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -7
  				ttm_bo_get(bo);
  				up_read(&vmf->vma->vm_mm->mmap_sem);
-				(void) ttm_bo_wait_unreserved(bo);
+				if (!dma_resv_lock_interruptible(bo->base.resv,
+								 NULL))
+					dma_resv_unlock(bo->base.resv);
  				ttm_bo_put(bo);
  			}
 
  			return VM_FAULT_RETRY;
  		}
 
-		/*
-		 * If we'd want to change locking order to
-		 * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-		 * instead of retrying the fault...
-		 */
-		return VM_FAULT_NOPAGE;
+		if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+			return VM_FAULT_NOPAGE;
  	}
 
  	/*
include/drm/ttm/ttm_bo_api.h +0 -3
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
   * @offset: The current GPU offset, which can have different meanings
   * depending on the memory type. For SYSTEM type memory, it should be 0.
   * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
   *
   * Base class for TTM buffer object, that deals with data placement and CPU
   * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
  	uint64_t offset; /* GPU address space is independent of CPU word size */
 
  	struct sg_table *sg;
-
-	struct mutex wu_mutex;
  };
 
  /**

include/drm/ttm/ttm_bo_api.h ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, · line 767

Quoted 7 lines
include/drm/ttm/ttm_bo_api.h +0 -1
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
  int ttm_bo_swapout(struct ttm_bo_global *glob,
  			struct ttm_operation_ctx *ctx);
  void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
  /**
   * ttm_bo_uses_embedded_gem_object - check if the given bo uses the

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

#13 lore raw

Re: [PATCH] drm/ttm: remove ttm_bo_wait_unreserved

Quoted 115 lines · Christian

Am 22.08.19 um 08:49 schrieb Daniel Vetter:

Quoted 101 lines

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
  drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
  drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
  drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
  include/drm/ttm/ttm_bo_api.h      |  4 ----
  4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
      dma_fence_put(bo->moving);
      if (!ttm_bo_uses_embedded_gem_object(bo))
              dma_resv_fini(&bo->base._resv);
-     mutex_destroy(&bo->wu_mutex);
      bo->destroy(bo);
      ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
  }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
      INIT_LIST_HEAD(&bo->ddestroy);
      INIT_LIST_HEAD(&bo->swap);
      INIT_LIST_HEAD(&bo->io_reserve_lru);
-     mutex_init(&bo->wu_mutex);
      bo->bdev = bdev;
      bo->type = type;
      bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
              ;
  }
  EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-     int ret;
-
-     /*
-      * In the absense of a wait_unlocked API,
-      * Use the bo::wu_mutex to avoid triggering livelocks due to
-      * concurrent use of this function. Note that this use of
-      * bo::wu_mutex can go away if we change locking order to
-      * mmap_sem -> bo::reserve.
-      */
-     ret = mutex_lock_interruptible(&bo->wu_mutex);
-     if (unlikely(ret != 0))
-             return -ERESTARTSYS;
-     if (!dma_resv_is_locked(bo->base.resv))
-             goto out_unlock;
-     ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-     if (ret == -EINTR)
-             ret = -ERESTARTSYS;
-     if (unlikely(ret != 0))
-             goto out_unlock;
-     dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-     mutex_unlock(&bo->wu_mutex);
-     return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
      INIT_LIST_HEAD(&fbo->base.lru);
      INIT_LIST_HEAD(&fbo->base.swap);
      INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-     mutex_init(&fbo->base.wu_mutex);
      fbo->base.moving = NULL;
      drm_vma_node_reset(&fbo->base.base.vma_node);
      atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -0
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
              &bdev->man[bo->mem.mem_type];
      struct vm_area_struct cvma;

drivers/gpu/drm/ttm/ttm_bo_vm.c static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · line 130

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -6
 
-     /*
-      * Work around locking order reversal in fault / nopfn
-      * between mmap_sem and bo_reserve: Perform a trylock operation
-      * for reserve, and if it fails, retry the fault after waiting
-      * for the buffer to become unreserved.
-      */
      if (unlikely(!dma_resv_trylock(bo->base.resv))) {
              if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
                      if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {

Not an expert on fault handling, but shouldn't this now be one if?

Quoted 2 lines

E.g. if FAULT_FLAG_RETRY_NOWAIT is set we should return VM_FAULT_NOPAGE instead of VM_FAULT_RETRY.

Honestly I have no idea at all about this stuff. I just learned about the mmap_sem less retry now that Thomas pointed it out, and I have no idea how anything else here works. My approach has always been to just throw ridiculous amounts of really nasty tests at fault handling (including handling our own gtt mmaps to copy*user in relocs or gup for userptr and all that), and leave it at that :-)

Quoted 1 line

But really take that with a grain of salt,

No idea either. It should be functionally equivalent to what was there before, except we now have the full blocking wait for the mutex instead of busy-spinning on NO_PAGE (with the wait_unreserved mixed in every odd fault I guess?). All over my head I'd say ...

Cheers, Daniel

Quoted 55 lines

Christian.

Quoted 52 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -7
                              ttm_bo_get(bo);
                              up_read(&vmf->vma->vm_mm->mmap_sem);
-                             (void) ttm_bo_wait_unreserved(bo);
+                             if (!dma_resv_lock_interruptible(bo->base.resv,
+                                                              NULL))
+                                     dma_resv_unlock(bo->base.resv);
                              ttm_bo_put(bo);
                      }
 
                      return VM_FAULT_RETRY;
              }
 
-             /*
-              * If we'd want to change locking order to
-              * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-              * instead of retrying the fault...
-              */
-             return VM_FAULT_NOPAGE;
+             if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+                     return VM_FAULT_NOPAGE;
      }
 
      /*
include/drm/ttm/ttm_bo_api.h +0 -4
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
   * @offset: The current GPU offset, which can have different meanings
   * depending on the memory type. For SYSTEM type memory, it should be 0.
   * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
   *
   * Base class for TTM buffer object, that deals with data placement and CPU
   * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
      uint64_t offset; /* GPU address space is independent of CPU word size */
 
      struct sg_table *sg;
-
-     struct mutex wu_mutex;
  };
 
  /**
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
  int ttm_bo_swapout(struct ttm_bo_global *glob,
                      struct ttm_operation_ctx *ctx);
  void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
  /**
   * ttm_bo_uses_embedded_gem_object - check if the given bo uses the
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [PATCH] drm/ttm: remove ttm_bo_wait_unreserved

Quoted 125 lines · Daniel Vetter
Quoted 114 lines · Christian

Am 22.08.19 um 08:49 schrieb Daniel Vetter:

Quoted 101 lines

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
   drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
   drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
   drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
   include/drm/ttm/ttm_bo_api.h      |  4 ----
   4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
       dma_fence_put(bo->moving);
       if (!ttm_bo_uses_embedded_gem_object(bo))
               dma_resv_fini(&bo->base._resv);
-     mutex_destroy(&bo->wu_mutex);
       bo->destroy(bo);
       ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
   }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
       INIT_LIST_HEAD(&bo->ddestroy);
       INIT_LIST_HEAD(&bo->swap);
       INIT_LIST_HEAD(&bo->io_reserve_lru);
-     mutex_init(&bo->wu_mutex);
       bo->bdev = bdev;
       bo->type = type;
       bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
               ;
   }
   EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-     int ret;
-
-     /*
-      * In the absense of a wait_unlocked API,
-      * Use the bo::wu_mutex to avoid triggering livelocks due to
-      * concurrent use of this function. Note that this use of
-      * bo::wu_mutex can go away if we change locking order to
-      * mmap_sem -> bo::reserve.
-      */
-     ret = mutex_lock_interruptible(&bo->wu_mutex);
-     if (unlikely(ret != 0))
-             return -ERESTARTSYS;
-     if (!dma_resv_is_locked(bo->base.resv))
-             goto out_unlock;
-     ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-     if (ret == -EINTR)
-             ret = -ERESTARTSYS;
-     if (unlikely(ret != 0))
-             goto out_unlock;
-     dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-     mutex_unlock(&bo->wu_mutex);
-     return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
       INIT_LIST_HEAD(&fbo->base.lru);
       INIT_LIST_HEAD(&fbo->base.swap);
       INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-     mutex_init(&fbo->base.wu_mutex);
       fbo->base.moving = NULL;
       drm_vma_node_reset(&fbo->base.base.vma_node);
       atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -0
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
               &bdev->man[bo->mem.mem_type];
       struct vm_area_struct cvma;

drivers/gpu/drm/ttm/ttm_bo_vm.c static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · line 130

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -6
 
-     /*
-      * Work around locking order reversal in fault / nopfn
-      * between mmap_sem and bo_reserve: Perform a trylock operation
-      * for reserve, and if it fails, retry the fault after waiting
-      * for the buffer to become unreserved.
-      */
       if (unlikely(!dma_resv_trylock(bo->base.resv))) {
               if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
                       if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {

Not an expert on fault handling, but shouldn't this now be one if?

Quoted 2 lines

E.g. if FAULT_FLAG_RETRY_NOWAIT is set we should return VM_FAULT_NOPAGE instead of VM_FAULT_RETRY.

Honestly I have no idea at all about this stuff. I just learned about the mmap_sem less retry now that Thomas pointed it out, and I have no idea how anything else here works. My approach has always been to just throw ridiculous amounts of really nasty tests at fault handling (including handling our own gtt mmaps to copy*user in relocs or gup for userptr and all that), and leave it at that :-)

Quoted 5 lines
Quoted 1 line

But really take that with a grain of salt,

No idea either. It should be functionally equivalent to what was there before, except we now have the full blocking wait for the mutex instead of busy-spinning on NO_PAGE (with the wait_unreserved mixed in every odd fault I guess?). All over my head I'd say ...

To be honest I don't remember the difference about VM_FAULT_RETRY with !FAULT_FLAG_RETRY_NOWAIT and just returning VM_FAULT_NOPAGE. It appears most users and TTM use the former, while shmem uses the latter.

The detailed FAULT_RETRY semantics are pretty undocumented and requires diving into the mm system to get the full picture.

BTW it looks to me like vgem and vmks has got VM_FAULT_RETRY wrong, since they might return it without ALLOW_RETRY, and if FAULT_FLAG_RETRY_NOWAIT is true they, should drop the mmap_sem, otherwise things will go really bad.

/Thomas

Quoted 55 lines

Cheers, Daniel

Quoted 52 lines

Christian.

Quoted 50 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -7
                               ttm_bo_get(bo);
                               up_read(&vmf->vma->vm_mm->mmap_sem);
-                             (void) ttm_bo_wait_unreserved(bo);
+                             if (!dma_resv_lock_interruptible(bo->base.resv,
+                                                              NULL))
+                                     dma_resv_unlock(bo->base.resv);
                               ttm_bo_put(bo);
                       }
 
                       return VM_FAULT_RETRY;
               }
 
-             /*
-              * If we'd want to change locking order to
-              * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-              * instead of retrying the fault...
-              */
-             return VM_FAULT_NOPAGE;
+             if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+                     return VM_FAULT_NOPAGE;
       }
 
       /*
include/drm/ttm/ttm_bo_api.h +0 -4
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
    * @offset: The current GPU offset, which can have different meanings
    * depending on the memory type. For SYSTEM type memory, it should be 0.
    * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
    *
    * Base class for TTM buffer object, that deals with data placement and CPU
    * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
       uint64_t offset; /* GPU address space is independent of CPU word size */
 
       struct sg_table *sg;
-
-     struct mutex wu_mutex;
   };
 
   /**
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
   int ttm_bo_swapout(struct ttm_bo_global *glob,
                       struct ttm_operation_ctx *ctx);
   void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
Quoted 3 lines
Quoted 2 lines

include/drm/ttm/ttm_bo_api.h ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, · line 767

Quoted 2 lines
include/drm/ttm/ttm_bo_api.h +0 -0
   /**
    * ttm_bo_uses_embedded_gem_object - check if the given bo uses the

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

#15 lore raw

Re: [PATCH] drm/ttm: remove ttm_bo_wait_unreserved

In reply to Koenig, Christian
Quoted 12 lines · Christian

Am 22.08.19 um 08:49 schrieb Daniel Vetter:

Quoted 11 lines

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

btw I realized I didn't remove your r-b, since v1 was broken.

For formality, can you pls reaffirm, or still something broken?

Also from the other thread: Reviewed-by: Thomas Hellström <[email protected]>

Thanks, Daniel

Quoted 162 lines
Quoted 90 lines
Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
  drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
  drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
  drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
  include/drm/ttm/ttm_bo_api.h      |  4 ----
  4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
  	dma_fence_put(bo->moving);
  	if (!ttm_bo_uses_embedded_gem_object(bo))
  		dma_resv_fini(&bo->base._resv);
-	mutex_destroy(&bo->wu_mutex);
  	bo->destroy(bo);
  	ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
  }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
  	INIT_LIST_HEAD(&bo->ddestroy);
  	INIT_LIST_HEAD(&bo->swap);
  	INIT_LIST_HEAD(&bo->io_reserve_lru);
-	mutex_init(&bo->wu_mutex);
  	bo->bdev = bdev;
  	bo->type = type;
  	bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
  		;
  }
  EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-	int ret;
-
-	/*
-	 * In the absense of a wait_unlocked API,
-	 * Use the bo::wu_mutex to avoid triggering livelocks due to
-	 * concurrent use of this function. Note that this use of
-	 * bo::wu_mutex can go away if we change locking order to
-	 * mmap_sem -> bo::reserve.
-	 */
-	ret = mutex_lock_interruptible(&bo->wu_mutex);
-	if (unlikely(ret != 0))
-		return -ERESTARTSYS;
-	if (!dma_resv_is_locked(bo->base.resv))
-		goto out_unlock;
-	ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-	if (ret == -EINTR)
-		ret = -ERESTARTSYS;
-	if (unlikely(ret != 0))
-		goto out_unlock;
-	dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-	mutex_unlock(&bo->wu_mutex);
-	return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
  	INIT_LIST_HEAD(&fbo->base.lru);
  	INIT_LIST_HEAD(&fbo->base.swap);
  	INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-	mutex_init(&fbo->base.wu_mutex);
  	fbo->base.moving = NULL;
  	drm_vma_node_reset(&fbo->base.base.vma_node);
  	atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -0
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
  		&bdev->man[bo->mem.mem_type];
  	struct vm_area_struct cvma;

drivers/gpu/drm/ttm/ttm_bo_vm.c static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · line 130

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -6
 
-	/*
-	 * Work around locking order reversal in fault / nopfn
-	 * between mmap_sem and bo_reserve: Perform a trylock operation
-	 * for reserve, and if it fails, retry the fault after waiting
-	 * for the buffer to become unreserved.
-	 */
  	if (unlikely(!dma_resv_trylock(bo->base.resv))) {
  		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
  			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {

Not an expert on fault handling, but shouldn't this now be one if?

E.g. if FAULT_FLAG_RETRY_NOWAIT is set we should return VM_FAULT_NOPAGE instead of VM_FAULT_RETRY.

But really take that with a grain of salt,
Christian.

Quoted 52 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -7
  				ttm_bo_get(bo);
  				up_read(&vmf->vma->vm_mm->mmap_sem);
-				(void) ttm_bo_wait_unreserved(bo);
+				if (!dma_resv_lock_interruptible(bo->base.resv,
+								 NULL))
+					dma_resv_unlock(bo->base.resv);
  				ttm_bo_put(bo);
  			}
 
  			return VM_FAULT_RETRY;
  		}
 
-		/*
-		 * If we'd want to change locking order to
-		 * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-		 * instead of retrying the fault...
-		 */
-		return VM_FAULT_NOPAGE;
+		if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+			return VM_FAULT_NOPAGE;
  	}
 
  	/*
include/drm/ttm/ttm_bo_api.h +0 -4
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
   * @offset: The current GPU offset, which can have different meanings
   * depending on the memory type. For SYSTEM type memory, it should be 0.
   * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
   *
   * Base class for TTM buffer object, that deals with data placement and CPU
   * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
  	uint64_t offset; /* GPU address space is independent of CPU word size */
 
  	struct sg_table *sg;
-
-	struct mutex wu_mutex;
  };
 
  /**
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
  int ttm_bo_swapout(struct ttm_bo_global *glob,
  			struct ttm_operation_ctx *ctx);
  void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
  /**
   * ttm_bo_uses_embedded_gem_object - check if the given bo uses the
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

Re: [PATCH] drm/ttm: remove ttm_bo_wait_unreserved

Am 22.08.19 um 15:06 schrieb Daniel Vetter:

Quoted 12 lines · Christian
Quoted 11 lines

Am 22.08.19 um 08:49 schrieb Daniel Vetter:

Quoted 10 lines

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

Quoted 4 lines
Quoted 1 line
Quoted 1 line

btw I realized I didn't remove your r-b, since v1 was broken.

For formality, can you pls reaffirm, or still something broken?

My r-b is still valid.

Only problem I see is that neither of us seems to have a good idea about the different VM_FAULT_* replies.

But that worked before so it should still work now, Christian.

Quoted 163 lines

Also from the other thread: Reviewed-by: Thomas Hellström <[email protected]>

Thanks, Daniel

Quoted 158 lines
Quoted 90 lines
Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
   drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
   drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
   drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
   include/drm/ttm/ttm_bo_api.h      |  4 ----
   4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
   	dma_fence_put(bo->moving);
   	if (!ttm_bo_uses_embedded_gem_object(bo))
   		dma_resv_fini(&bo->base._resv);
-	mutex_destroy(&bo->wu_mutex);
   	bo->destroy(bo);
   	ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
   }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
   	INIT_LIST_HEAD(&bo->ddestroy);
   	INIT_LIST_HEAD(&bo->swap);
   	INIT_LIST_HEAD(&bo->io_reserve_lru);
-	mutex_init(&bo->wu_mutex);
   	bo->bdev = bdev;
   	bo->type = type;
   	bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
   		;
   }
   EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-	int ret;
-
-	/*
-	 * In the absense of a wait_unlocked API,
-	 * Use the bo::wu_mutex to avoid triggering livelocks due to
-	 * concurrent use of this function. Note that this use of
-	 * bo::wu_mutex can go away if we change locking order to
-	 * mmap_sem -> bo::reserve.
-	 */
-	ret = mutex_lock_interruptible(&bo->wu_mutex);
-	if (unlikely(ret != 0))
-		return -ERESTARTSYS;
-	if (!dma_resv_is_locked(bo->base.resv))
-		goto out_unlock;
-	ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-	if (ret == -EINTR)
-		ret = -ERESTARTSYS;
-	if (unlikely(ret != 0))
-		goto out_unlock;
-	dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-	mutex_unlock(&bo->wu_mutex);
-	return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
   	INIT_LIST_HEAD(&fbo->base.lru);
   	INIT_LIST_HEAD(&fbo->base.swap);
   	INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-	mutex_init(&fbo->base.wu_mutex);
   	fbo->base.moving = NULL;
   	drm_vma_node_reset(&fbo->base.base.vma_node);
   	atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -0
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
   		&bdev->man[bo->mem.mem_type];
   	struct vm_area_struct cvma;

drivers/gpu/drm/ttm/ttm_bo_vm.c static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · line 130

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -6
 
-	/*
-	 * Work around locking order reversal in fault / nopfn
-	 * between mmap_sem and bo_reserve: Perform a trylock operation
-	 * for reserve, and if it fails, retry the fault after waiting
-	 * for the buffer to become unreserved.
-	 */
   	if (unlikely(!dma_resv_trylock(bo->base.resv))) {
   		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
   			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {

Not an expert on fault handling, but shouldn't this now be one if?

E.g. if FAULT_FLAG_RETRY_NOWAIT is set we should return VM_FAULT_NOPAGE instead of VM_FAULT_RETRY.

But really take that with a grain of salt,
Christian.

Quoted 50 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -7
   				ttm_bo_get(bo);
   				up_read(&vmf->vma->vm_mm->mmap_sem);
-				(void) ttm_bo_wait_unreserved(bo);
+				if (!dma_resv_lock_interruptible(bo->base.resv,
+								 NULL))
+					dma_resv_unlock(bo->base.resv);
   				ttm_bo_put(bo);
   			}
 
   			return VM_FAULT_RETRY;
   		}
 
-		/*
-		 * If we'd want to change locking order to
-		 * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-		 * instead of retrying the fault...
-		 */
-		return VM_FAULT_NOPAGE;
+		if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+			return VM_FAULT_NOPAGE;
   	}
 
   	/*
include/drm/ttm/ttm_bo_api.h +0 -4
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
    * @offset: The current GPU offset, which can have different meanings
    * depending on the memory type. For SYSTEM type memory, it should be 0.
    * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
    *
    * Base class for TTM buffer object, that deals with data placement and CPU
    * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
   	uint64_t offset; /* GPU address space is independent of CPU word size */
 
   	struct sg_table *sg;
-
-	struct mutex wu_mutex;
   };
 
   /**
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
   int ttm_bo_swapout(struct ttm_bo_global *glob,
   			struct ttm_operation_ctx *ctx);
   void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
Quoted 2 lines
Quoted 2 lines

include/drm/ttm/ttm_bo_api.h ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, · line 767

Quoted 2 lines
include/drm/ttm/ttm_bo_api.h +0 -0
   /**
    * ttm_bo_uses_embedded_gem_object - check if the given bo uses the

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

#17 lore raw

Re: [PATCH] drm/ttm: remove ttm_bo_wait_unreserved

Quoted 13 lines · Christian

Am 22.08.19 um 15:06 schrieb Daniel Vetter:

Quoted 12 lines · Christian
Quoted 11 lines

Am 22.08.19 um 08:49 schrieb Daniel Vetter:

Quoted 10 lines

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

btw I realized I didn't remove your r-b, since v1 was broken.

For formality, can you pls reaffirm, or still something broken?

My r-b is still valid.

Only problem I see is that neither of us seems to have a good idea about the different VM_FAULT_* replies.

I took a look in mm/gup.c. It seems like when using get_user_pages, VM_FAULT_RETRY will retry to a requesting caller telling it that a long wait was expected and not performed, whereas VM_FAULT_NOPAGE will just keep get_user_pages to spin. So the proposed patch should be correct from my understanding.

If the fault originates from user-space, I guess either is fine.

/Thomas

Quoted 166 lines

But that worked before so it should still work now, Christian.

Quoted 162 lines

Also from the other thread: Reviewed-by: Thomas Hellström <[email protected]>

Thanks, Daniel

Quoted 158 lines
Quoted 90 lines
Cc Christian Koenig <[email protected]>
Cc Huang Rui <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
    drivers/gpu/drm/ttm/ttm_bo.c      | 36 -------------------------------
    drivers/gpu/drm/ttm/ttm_bo_util.c |  1 -
    drivers/gpu/drm/ttm/ttm_bo_vm.c   | 18 +++++-----------
    include/drm/ttm/ttm_bo_api.h      |  4 ----
    4 files changed, 5 insertions(+), 54 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -36
index 20ff56f27aa4..d1ce5d315d5b 100644
@@ -162,7 +162,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
    	dma_fence_put(bo->moving);
    	if (!ttm_bo_uses_embedded_gem_object(bo))
    		dma_resv_fini(&bo->base._resv);
-	mutex_destroy(&bo->wu_mutex);
    	bo->destroy(bo);
    	ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
    }
@@ -1319,7 +1318,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
    	INIT_LIST_HEAD(&bo->ddestroy);
    	INIT_LIST_HEAD(&bo->swap);
    	INIT_LIST_HEAD(&bo->io_reserve_lru);
-	mutex_init(&bo->wu_mutex);
    	bo->bdev = bdev;
    	bo->type = type;
    	bo->num_pages = num_pages;
@@ -1954,37 +1952,3 @@ void ttm_bo_swapout_all(struct ttm_bo_device *bdev)
    		;
    }
    EXPORT_SYMBOL(ttm_bo_swapout_all);
-
-/**
- * ttm_bo_wait_unreserved - interruptible wait for a buffer object to become
- * unreserved
- *
- * @bo: Pointer to buffer
- */
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
-{
-	int ret;
-
-	/*
-	 * In the absense of a wait_unlocked API,
-	 * Use the bo::wu_mutex to avoid triggering livelocks due to
-	 * concurrent use of this function. Note that this use of
-	 * bo::wu_mutex can go away if we change locking order to
-	 * mmap_sem -> bo::reserve.
-	 */
-	ret = mutex_lock_interruptible(&bo->wu_mutex);
-	if (unlikely(ret != 0))
-		return -ERESTARTSYS;
-	if (!dma_resv_is_locked(bo->base.resv))
-		goto out_unlock;
-	ret = dma_resv_lock_interruptible(bo->base.resv, NULL);
-	if (ret == -EINTR)
-		ret = -ERESTARTSYS;
-	if (unlikely(ret != 0))
-		goto out_unlock;
-	dma_resv_unlock(bo->base.resv);
-
-out_unlock:
-	mutex_unlock(&bo->wu_mutex);
-	return ret;
-}
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -1
index fe81c565e7ef..82ea26a49959 100644
@@ -508,7 +508,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
    	INIT_LIST_HEAD(&fbo->base.lru);
    	INIT_LIST_HEAD(&fbo->base.swap);
    	INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
-	mutex_init(&fbo->base.wu_mutex);
    	fbo->base.moving = NULL;
    	drm_vma_node_reset(&fbo->base.base.vma_node);
    	atomic_set(&fbo->base.cpu_writers, 0);
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -0
index 76eedb963693..a61a35e57d1c 100644
@@ -125,30 +125,22 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)
    		&bdev->man[bo->mem.mem_type];
    	struct vm_area_struct cvma;

drivers/gpu/drm/ttm/ttm_bo_vm.c static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · line 130

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -6
 
-	/*
-	 * Work around locking order reversal in fault / nopfn
-	 * between mmap_sem and bo_reserve: Perform a trylock operation
-	 * for reserve, and if it fails, retry the fault after waiting
-	 * for the buffer to become unreserved.
-	 */
    	if (unlikely(!dma_resv_trylock(bo->base.resv))) {
    		if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
    			if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {

Not an expert on fault handling, but shouldn't this now be one if?

E.g. if FAULT_FLAG_RETRY_NOWAIT is set we should return VM_FAULT_NOPAGE instead of VM_FAULT_RETRY.

But really take that with a grain of salt,
Christian.

Quoted 50 lines
drivers/gpu/drm/ttm/ttm_bo_vm.c +5 -7
    				ttm_bo_get(bo);
    				up_read(&vmf->vma->vm_mm->mmap_sem);
-				(void) ttm_bo_wait_unreserved(bo);
+				if (!dma_resv_lock_interruptible(bo->base.resv,
+								 NULL))
+					dma_resv_unlock(bo->base.resv);
    				ttm_bo_put(bo);
    			}
 
    			return VM_FAULT_RETRY;
    		}
 
-		/*
-		 * If we'd want to change locking order to
-		 * mmap_sem -> bo::reserve, we'd use a blocking reserve here
-		 * instead of retrying the fault...
-		 */
-		return VM_FAULT_NOPAGE;
+		if (dma_resv_lock_interruptible(bo->base.resv, NULL))
+			return VM_FAULT_NOPAGE;
    	}
 
    	/*
include/drm/ttm/ttm_bo_api.h +0 -4
index 43c4929a2171..21c7d0d28757 100644
@@ -155,7 +155,6 @@ struct ttm_tt;
     * @offset: The current GPU offset, which can have different meanings
     * depending on the memory type. For SYSTEM type memory, it should be 0.
     * @cur_placement: Hint of current placement.
- * @wu_mutex: Wait unreserved mutex.
     *
     * Base class for TTM buffer object, that deals with data placement and CPU
     * mappings. GPU mappings are really up to the driver, but for simpler GPUs
@@ -229,8 +228,6 @@ struct ttm_buffer_object {
    	uint64_t offset; /* GPU address space is independent of CPU word size */
 
    	struct sg_table *sg;
-
-	struct mutex wu_mutex;
    };
 
    /**
@@ -765,7 +762,6 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
    int ttm_bo_swapout(struct ttm_bo_global *glob,
    			struct ttm_operation_ctx *ctx);
    void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
-int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo);
 
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

include/drm/ttm/ttm_bo_api.h ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, · line 767

Quoted 2 lines
include/drm/ttm/ttm_bo_api.h +0 -0
    /**
     * ttm_bo_uses_embedded_gem_object - check if the given bo uses the

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

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

#18 lore raw

Re: [PATCH] drm/ttm: remove ttm_bo_wait_unreserved

Quoted 17 lines · Thomas Hellström (VMware)
Quoted 16 lines · Christian

Am 22.08.19 um 15:06 schrieb Daniel Vetter:

Quoted 15 lines · Christian
Quoted 12 lines

Am 22.08.19 um 08:49 schrieb Daniel Vetter:

Quoted 11 lines

With nouveau fixed all ttm-using drives have the correct nesting of mmap_sem vs dma_resv, and we can just lock the buffer.

Assuming I didn't screw up anything with my audit of course.

v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)

btw I realized I didn't remove your r-b, since v1 was broken.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

For formality, can you pls reaffirm, or still something broken?

My r-b is still valid.

Only problem I see is that neither of us seems to have a good idea about the different VM_FAULT_* replies.

I took a look in mm/gup.c. It seems like when using get_user_pages, VM_FAULT_RETRY will retry

s/retry/return/

Quoted 5 lines

to a requesting caller telling it that a long wait was expected and not performed, whereas VM_FAULT_NOPAGE will just keep get_user_pages to spin. So the proposed patch should be correct from my understanding.

If the fault originates from user-space, I guess either is fine.

/Thomas

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

#19 lore raw

PATCH 1/1 dma_resv: prime lockdep annotations

In reply to Daniel Vetter

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +24 -0
index 42a8f3f11681..d233ef4cf0d7 100644
@@ -34,6 +34,7 @@
 
 #include <linux/dma-resv.h>
 #include <linux/export.h>
+#include <linux/sched/mm.h>
 
 /**
  * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
 	kfree_rcu(list, rcu);
 }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void dma_resv_lockdep(void)
+{
+	struct mm_struct *mm = mm_alloc();
+	struct dma_resv obj;
+
+	if (!mm)
+		return;
+
+	dma_resv_init(&obj);
+
+	down_read(&mm->mmap_sem);
+	ww_mutex_lock(&obj.lock, NULL);
+	fs_reclaim_acquire(GFP_KERNEL);
+	fs_reclaim_release(GFP_KERNEL);
+	ww_mutex_unlock(&obj.lock);
+	up_read(&mm->mmap_sem);
+	
+	mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
 /**
  * dma_resv_init - initialize a reservation object
  * @obj: the reservation object
Signature · 6 lines
2.23.0.rc1

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

Quoting Daniel Vetter (2019-08-22 07:54:57)

Quoted 12 lines
drivers/dma-buf/dma-resv.c +12 -0
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void dma_resv_lockdep(void)
+{
+       struct mm_struct *mm = mm_alloc();
+       struct dma_resv obj;
+
+       if (!mm)
+               return;
+
+       dma_resv_init(&obj);
+
+       down_read(&mm->mmap_sem);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 120

Quoted 10 lines
drivers/dma-buf/dma-resv.c +10 -0
+       ww_mutex_lock(&obj.lock, NULL);
+       fs_reclaim_acquire(GFP_KERNEL);
+       fs_reclaim_release(GFP_KERNEL);
+       ww_mutex_unlock(&obj.lock);
+       up_read(&mm->mmap_sem);
+       
+       mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif

Adding a

	dma_resv_lock();
	might_lock(&i915->drm.struct_mutex);
	dma_resv_unlock();

yielded

[   18.513633] ======================================================
[   18.513636] WARNING: possible circular locking dependency detected
[   18.513639] 5.3.0-rc5+ #76 Not tainted
[   18.513640] ------------------------------------------------------
[   18.513643] insmod/655 is trying to acquire lock:
[   18.513645] 00000000877909e7 (&dev->struct_mutex){+.+.}, at: i915_driver_probe+0x89c/0x1470 [i915]
[   18.513671] 
[   18.513671] but task is already holding lock:
[   18.513673] 00000000a85ba8ec (reservation_ww_class_mutex){+.+.}, at: i915_driver_probe+0x8e1/0x1470 [i915]
[   18.513698] 
[   18.513698] which lock already depends on the new lock.
[   18.513698] 
[   18.513701] 
[   18.513701] the existing dependency chain (in reverse order) is:
[   18.513703] 
[   18.513703] -> #1 (reservation_ww_class_mutex){+.+.}:
[   18.513708]        __ww_mutex_lock.constprop.17+0xbc/0xf90
[   18.513739]        i915_gem_init+0x518/0x750 [i915]
[   18.513762]        i915_driver_probe+0x891/0x1470 [i915]
[   18.513785]        i915_pci_probe+0x2f/0x110 [i915]
[   18.513789]        pci_device_probe+0x99/0x110
[   18.513792]        really_probe+0xd1/0x360
[   18.513794]        driver_probe_device+0xaf/0xf0
[   18.513796]        device_driver_attach+0x4a/0x50
[   18.513799]        __driver_attach+0x80/0x140
[   18.513801]        bus_for_each_dev+0x5e/0x90
[   18.513804]        bus_add_driver+0x148/0x1e0
[   18.513806]        driver_register+0x66/0xb0
[   18.513809]        do_one_initcall+0x45/0x29f
[   18.513812]        do_init_module+0x55/0x200
[   18.513814]        load_module+0x2519/0x2690
[   18.513816]        __do_sys_finit_module+0x8f/0xd0
[   18.513818]        do_syscall_64+0x4f/0x220
[   18.513822]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   18.513824] 
[   18.513824] -> #0 (&dev->struct_mutex){+.+.}:
[   18.513828]        __lock_acquire+0xcb9/0x1520
[   18.513831]        lock_acquire+0x90/0x170
[   18.513853]        i915_driver_probe+0x8fd/0x1470 [i915]
[   18.513876]        i915_pci_probe+0x2f/0x110 [i915]
[   18.513879]        pci_device_probe+0x99/0x110
[   18.513881]        really_probe+0xd1/0x360
[   18.513883]        driver_probe_device+0xaf/0xf0
[   18.513886]        device_driver_attach+0x4a/0x50
[   18.513888]        __driver_attach+0x80/0x140
[   18.513891]        bus_for_each_dev+0x5e/0x90
[   18.513893]        bus_add_driver+0x148/0x1e0
[   18.513895]        driver_register+0x66/0xb0
[   18.513897]        do_one_initcall+0x45/0x29f
[   18.513899]        do_init_module+0x55/0x200
[   18.513902]        load_module+0x2519/0x2690
[   18.513904]        __do_sys_finit_module+0x8f/0xd0
[   18.513906]        do_syscall_64+0x4f/0x220
[   18.513909]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   18.513911] 
[   18.513911] other info that might help us debug this:
[   18.513911] 
[   18.513914]  Possible unsafe locking scenario:
[   18.513914] 
[   18.513916]        CPU0                    CPU1
[   18.513918]        ----                    ----
[   18.513920]   lock(reservation_ww_class_mutex);
[   18.513922]                                lock(&dev->struct_mutex);
[   18.513924]                                lock(reservation_ww_class_mutex);
[   18.513927]   lock(&dev->struct_mutex);
[   18.513929] 
[   18.513929]  *** DEADLOCK ***
[   18.513929] 
[   18.513932] 3 locks held by insmod/655:
[   18.513933]  #0: 000000004dccb591 (&dev->mutex){....}, at: device_driver_attach+0x18/0x50
[   18.513938]  #1: 000000009118ecae (&mm->mmap_sem#2){++++}, at: i915_driver_probe+0x8c8/0x1470 [i915]
[   18.513962]  #2: 00000000a85ba8ec (reservation_ww_class_mutex){+.+.}, at: i915_driver_probe+0x8e1/0x1470 [i915]

so

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

maintainer Reviewed-by on v1 1/1
#21 lore raw
In reply to Daniel Vetter

Am 22.08.19 um 08:54 schrieb Daniel Vetter:

Quoted 61 lines

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

Quoted 13 lines
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 36 lines
---
  drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +17 -0
index 42a8f3f11681..d233ef4cf0d7 100644
@@ -34,6 +34,7 @@
 
  #include <linux/dma-resv.h>
  #include <linux/export.h>
+#include <linux/sched/mm.h>
 
  /**
   * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
  	kfree_rcu(list, rcu);
  }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void dma_resv_lockdep(void)
+{
+	struct mm_struct *mm = mm_alloc();
+	struct dma_resv obj;
+
+	if (!mm)
+		return;
+
+	dma_resv_init(&obj);
+
+	down_read(&mm->mmap_sem);
+	ww_mutex_lock(&obj.lock, NULL);
+	fs_reclaim_acquire(GFP_KERNEL);
+	fs_reclaim_release(GFP_KERNEL);
+	ww_mutex_unlock(&obj.lock);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 124

Quoted 10 lines
drivers/dma-buf/dma-resv.c +7 -0
+	up_read(&mm->mmap_sem);
+	
+	mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
  /**
   * dma_resv_init - initialize a reservation object
   * @obj: the reservation object

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

#22 lore raw
Quoted 76 lines · Christian

Am 22.08.19 um 08:54 schrieb Daniel Vetter:

Quoted 61 lines

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

Quoted 13 lines
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 1 line

Did you get a chance to give this a spin on the amd CI? -Daniel

Quoted 48 lines
Quoted 47 lines
---
  drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +24 -0
index 42a8f3f11681..d233ef4cf0d7 100644
@@ -34,6 +34,7 @@
 
  #include <linux/dma-resv.h>
  #include <linux/export.h>
+#include <linux/sched/mm.h>
 
  /**
   * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
  	kfree_rcu(list, rcu);
  }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void dma_resv_lockdep(void)
+{
+	struct mm_struct *mm = mm_alloc();
+	struct dma_resv obj;
+
+	if (!mm)
+		return;
+
+	dma_resv_init(&obj);
+
+	down_read(&mm->mmap_sem);
+	ww_mutex_lock(&obj.lock, NULL);
+	fs_reclaim_acquire(GFP_KERNEL);
+	fs_reclaim_release(GFP_KERNEL);
+	ww_mutex_unlock(&obj.lock);
+	up_read(&mm->mmap_sem);
+	
+	mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
  /**
   * dma_resv_init - initialize a reservation object
   * @obj: the reservation object
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
#23 lore raw

Am 03.09.19 um 10:16 schrieb Daniel Vetter:

Quoted 76 lines · Christian
Quoted 75 lines

Am 22.08.19 um 08:54 schrieb Daniel Vetter:

Quoted 74 lines

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Quoted 2 lines
Quoted 1 line

Did you get a chance to give this a spin on the amd CI?

No and sorry totally forgot to ask about that.

Going to try to bring this up tomorrow once more, but don't expect that I can get this tested anytime soon.

Christian.

Quoted 40 lines

-Daniel

Quoted 38 lines
Quoted 38 lines
---
   drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
   1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +19 -0
index 42a8f3f11681..d233ef4cf0d7 100644
@@ -34,6 +34,7 @@
 
   #include <linux/dma-resv.h>
   #include <linux/export.h>
+#include <linux/sched/mm.h>
 
   /**
    * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
   	kfree_rcu(list, rcu);
   }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void dma_resv_lockdep(void)
+{
+	struct mm_struct *mm = mm_alloc();
+	struct dma_resv obj;
+
+	if (!mm)
+		return;
+
+	dma_resv_init(&obj);
+
+	down_read(&mm->mmap_sem);
+	ww_mutex_lock(&obj.lock, NULL);
+	fs_reclaim_acquire(GFP_KERNEL);
+	fs_reclaim_release(GFP_KERNEL);
+	ww_mutex_unlock(&obj.lock);
+	up_read(&mm->mmap_sem);
+	
Quoted 8 lines
Quoted 8 lines

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 124

Quoted 8 lines
drivers/dma-buf/dma-resv.c +5 -0
+	mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
   /**
    * dma_resv_init - initialize a reservation object
    * @obj: the reservation object

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

#24 lore raw
In reply to Daniel Vetter
Quoted 92 lines · Daniel Vetter

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +1 -0
index 42a8f3f11681..d233ef4cf0d7 100644
@@ -34,6 +34,7 @@
 
 #include <linux/dma-resv.h>
 #include <linux/export.h>
+#include <linux/sched/mm.h>
 
 /**
  * DOC: Reservation Object Overview

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 100

Quoted 5 lines
drivers/dma-buf/dma-resv.c +2 -0
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
        kfree_rcu(list, rcu);
 }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void dma_resv_lockdep(void)

__init

Quoted 25 lines
drivers/dma-buf/dma-resv.c +21 -1
+{
+       struct mm_struct *mm = mm_alloc();
+       struct dma_resv obj;
+
+       if (!mm)
+               return;
+
+       dma_resv_init(&obj);
+
+       down_read(&mm->mmap_sem);
+       ww_mutex_lock(&obj.lock, NULL);
+       fs_reclaim_acquire(GFP_KERNEL);
+       fs_reclaim_release(GFP_KERNEL);
+       ww_mutex_unlock(&obj.lock);
+       up_read(&mm->mmap_sem);
+
+       mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
 /**
  * dma_resv_init - initialize a reservation object
  * @obj: the reservation object
--
Quoted 2 lines

2.23.0.rc1

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

#25 lore raw

✗ Fi.CI.CHECKPATCH: warning for series starting with dma_resv: prime lockdep annotations (rev3)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: series starting with dma_resv: prime lockdep annotations (rev3)
URL : https://patchwork.freedesktop.org/series/65575/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
e2a9273511d1 dma_resv: prime lockdep annotations
-:80: WARNING:BAD_SIGN_OFF: email address '"VMware Graphics" <[email protected]>' might be better as 'VMware Graphics <[email protected]>'
#80: 
Cc: "VMware Graphics" <[email protected]>

-:120: ERROR:TRAILING_WHITESPACE: trailing whitespace #120: FILE: drivers/dma-buf/dma-resv.c:116:
+^I$

-:128: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <[email protected]>'

total: 1 errors, 2 warnings, 0 checks, 36 lines checked
6a45501169ac drm/nouveau: slowpath for pushbuf ioctl
-:153: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <[email protected]>'

total: 0 errors, 1 warnings, 0 checks, 122 lines checked
dd4da03d3f1f drm/ttm: remove ttm_bo_wait_unreserved
-:24: WARNING:BAD_SIGN_OFF: email address '"VMware Graphics" <[email protected]>' might be better as 'VMware Graphics <[email protected]>' #24:
Cc: "VMware Graphics" <[email protected]>

-:165: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter <[email protected]>'

total: 0 errors, 2 warnings, 0 checks, 81 lines checked

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

#26 lore raw

✓ Fi.CI.BAT: success for series starting with dma_resv: prime lockdep annotations (rev3)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: series starting with dma_resv: prime lockdep annotations (rev3)
URL : https://patchwork.freedesktop.org/series/65575/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6763 -> Patchwork_14136
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/

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

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

### IGT changes ###

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: [INCOMPLETE][1] ([fdo#107718]) -> [PASS][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/fi-blb-e6850/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/fi-blb-e6850/igt@[email protected]

* igt@gem_mmap_gtt@basic-small-bo-tiledx:
- fi-icl-u3: [DMESG-WARN][3] ([fdo#107724]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/fi-icl-u3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/fi-icl-u3/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-kbl-guc: [SKIP][5] ([fdo#109271]) -> [FAIL][6] ([fdo#107707])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/fi-kbl-guc/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/fi-kbl-guc/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][7] ([fdo#111096]) -> [FAIL][8] ([fdo#111407])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/fi-kbl-7500u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/fi-kbl-7500u/igt@[email protected]

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

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#107707]: https://bugs.freedesktop.org/show_bug.cgi?id=107707
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407

Participating hosts (56 -> 45)
------------------------------

Missing (11): fi-kbl-soraka fi-ilk-m540 fi-bsw-n3050 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-gdg-551 fi-pnv-d510 fi-icl-y fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6763 -> Patchwork_14136

CI-20190529: 20190529
CI_DRM_6763: a9a5855cece4d78bc2dfd4c719191a9ccabab4fb @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5147: 289dcb935ee195352f987c0ae7dd31693bf7de0f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14136: dd4da03d3f1fffd050c83bbd0458d4b566483e86 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

dd4da03d3f1f drm/ttm: remove ttm_bo_wait_unreserved 6a45501169ac drm/nouveau: slowpath for pushbuf ioctl e2a9273511d1 dma_resv: prime lockdep annotations

== Logs ==

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

#27 lore raw

PATCH 1/1 dma_resv: prime lockdep annotations

In reply to Daniel Vetter

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

v4: Annotate with __init (Rob Herring)

Cc Rob Herring <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
 drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +24 -0
index 42a8f3f11681..97c4c4812d08 100644
@@ -34,6 +34,7 @@
 
 #include <linux/dma-resv.h>
 #include <linux/export.h>
+#include <linux/sched/mm.h>
 
 /**
  * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
 	kfree_rcu(list, rcu);
 }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void __init dma_resv_lockdep(void)
+{
+	struct mm_struct *mm = mm_alloc();
+	struct dma_resv obj;
+
+	if (!mm)
+		return;
+
+	dma_resv_init(&obj);
+
+	down_read(&mm->mmap_sem);
+	ww_mutex_lock(&obj.lock, NULL);
+	fs_reclaim_acquire(GFP_KERNEL);
+	fs_reclaim_release(GFP_KERNEL);
+	ww_mutex_unlock(&obj.lock);
+	up_read(&mm->mmap_sem);
+	
+	mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
 /**
  * dma_resv_init - initialize a reservation object
  * @obj: the reservation object
Signature · 6 lines
2.23.0.rc1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by Thomas Hellström on v1 1/1
#28 lore raw
Quoted 102 lines · Daniel Vetter

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

v4: Annotate with __init (Rob Herring)

Cc Rob Herring <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
  drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +3 -0
index 42a8f3f11681..97c4c4812d08 100644
@@ -34,6 +34,7 @@
 
  #include <linux/dma-resv.h>
  #include <linux/export.h>
+#include <linux/sched/mm.h>
 
  /**
   * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
  	kfree_rcu(list, rcu);
  }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void __init dma_resv_lockdep(void)

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 110

Quoted 10 lines
drivers/dma-buf/dma-resv.c +10 -0
+{
+	struct mm_struct *mm = mm_alloc();
+	struct dma_resv obj;
+
+	if (!mm)
+		return;
+
+	dma_resv_init(&obj);
+
+	down_read(&mm->mmap_sem);

I took a quick look into using lockdep macros replacing the actual locks: Something along the lines of

lock_acquire(mm->mmap_sem.dep_map, 0, 0, 1, 1, NULL, _THIS_IP_);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 111

Quoted 1 line
drivers/dma-buf/dma-resv.c +1 -0
+	ww_mutex_lock(&obj.lock, NULL);

lock_acquire(obj.lock.dep_map, 0, 0, 0, 1, NULL, _THIS_IP_);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 114

Quoted 3 lines
drivers/dma-buf/dma-resv.c +3 -0
+	fs_reclaim_acquire(GFP_KERNEL);
+	fs_reclaim_release(GFP_KERNEL);
+	ww_mutex_unlock(&obj.lock);

lock_release(obj.lock.dep_map, 0, _THIS_IP_);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 115

Quoted 1 line
drivers/dma-buf/dma-resv.c +1 -0
+	up_read(&mm->mmap_sem);

lock_release(obj.lock.dep_map, 0, _THIS_IP_);

Either way is fine with me, though.

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 124

Quoted 9 lines
drivers/dma-buf/dma-resv.c +6 -0
+	
+	mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
  /**
   * dma_resv_init - initialize a reservation object
   * @obj: the reservation object

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

#29 lore raw
Quoted 119 lines · Thomas Hellström (VMware)
Quoted 102 lines · Daniel Vetter

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

v4: Annotate with __init (Rob Herring)

Cc Rob Herring <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
  drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +3 -0
index 42a8f3f11681..97c4c4812d08 100644
@@ -34,6 +34,7 @@
 
  #include <linux/dma-resv.h>
  #include <linux/export.h>
+#include <linux/sched/mm.h>
 
  /**
   * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
      kfree_rcu(list, rcu);
  }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void __init dma_resv_lockdep(void)

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 110

Quoted 10 lines
drivers/dma-buf/dma-resv.c +10 -0
+{
+     struct mm_struct *mm = mm_alloc();
+     struct dma_resv obj;
+
+     if (!mm)
+             return;
+
+     dma_resv_init(&obj);
+
+     down_read(&mm->mmap_sem);

I took a quick look into using lockdep macros replacing the actual
locks: Something along the lines of

Quoted 1 line

lock_acquire(mm->mmap_sem.dep_map, 0, 0, 1, 1, NULL, _THIS_IP_);

Yeah I'm not a fan of the magic numbers this nees :-/ And now this is run once at startup, so the taking the fake locks for real, once, shouldn't hurt. Lockdep updating it's data structures is going to be 100x more cpu cycles anyway :-)

Quoted 8 lines

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 111

Quoted 1 line
drivers/dma-buf/dma-resv.c +1 -0
+     ww_mutex_lock(&obj.lock, NULL);

lock_acquire(obj.lock.dep_map, 0, 0, 0, 1, NULL, _THIS_IP_);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 114

Quoted 3 lines
drivers/dma-buf/dma-resv.c +3 -0
+     fs_reclaim_acquire(GFP_KERNEL);
+     fs_reclaim_release(GFP_KERNEL);
+     ww_mutex_unlock(&obj.lock);

lock_release(obj.lock.dep_map, 0, _THIS_IP_);

Quoted 7 lines

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 115

Quoted 1 line
drivers/dma-buf/dma-resv.c +1 -0
+     up_read(&mm->mmap_sem);

lock_release(obj.lock.dep_map, 0, _THIS_IP_);

Either way is fine with me, though.

Thanks for your review comments.

Can you pls also run this in some test cycles, if that's easily possible? I'd like to have a tested-by from at least the big drivers - i915, amd, nouveau, vmwgfx and is definitely using ttm to its fullest too, so best chances for hitting an oversight.

Cheers, Daniel

Quoted 17 lines

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 124

Quoted 11 lines
drivers/dma-buf/dma-resv.c +6 -0
+
+     mmput(mm);
+}
+subsys_initcall(dma_resv_lockdep);
+#endif
+
  /**
   * dma_resv_init - initialize a reservation object
   * @obj: the reservation object

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

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
Tested-by Thomas Hellström
#30 lore raw
Quoted 138 lines · Daniel Vetter
Quoted 117 lines · Thomas Hellström (VMware)
Quoted 102 lines · Daniel Vetter

Full audit of everyone:

- i915, radeon, amdgpu should be clean per their maintainers.

- vram helpers should be fine, they don't do command submission, so really no business holding struct_mutex while doing copy_*_user. But I haven't checked them all.

- panfrost seems to dma_resv_lock only in panfrost_job_push, which looks clean.

- v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(), copying from/to userspace happens all in v3d_lookup_bos which is outside of the critical section.

- vmwgfx has a bunch of ioctls that do their own copy_*_user:
- vmw_execbuf_process: First this does some copies in vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself. Then comes the usual ttm reserve/validate sequence, then actual submission/fencing, then unreserving, and finally some more copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of details, but looks all safe.
- vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be seen, seems to only create a fence and copy it out.
- a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be found there.
Summary: vmwgfx seems to be fine too.

- virtio: There's virtio_gpu_execbuffer_ioctl, which does all the copying from userspace before even looking up objects through their handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

- qxl only has qxl_execbuffer_ioctl, which calls into qxl_process_single_command. There's a lovely comment before the __copy_from_user_inatomic that the slowpath should be copied from i915, but I guess that never happened. Try not to be unlucky and get your CS data evicted between when it's written and the kernel tries to read it. The only other copy_from_user is for relocs, but those are done before qxl_release_reserve_list(), which seems to be the only thing reserving buffers (in the ttm/dma_resv sense) in that code. So looks safe.

- A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this everywhere and needs to be fixed up.

v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a dma_resv lock of a different object already. Christian mentioned that ttm core does this too for ghost objects. intel-gfx-ci highlighted that i915 has similar issues.

Unfortunately we can't do this in the usual module init functions, because kernel threads don't have an ->mm - we have to wait around for some user thread to do this.

Solution is to spawn a worker (but only once). It's horrible, but it works.

v3: We can allocate mm! (Chris). Horrible worker hack out, clean initcall solution in.

v4: Annotate with __init (Rob Herring)

Cc Rob Herring <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Eric Anholt <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc "VMware Graphics" <[email protected]>
Cc Thomas Hellstrom <[email protected]>
---
   drivers/dma-buf/dma-resv.c | 24 ++++++++++++++++++++++++
   1 file changed, 24 insertions(+)
drivers/dma-buf/dma-resv.c +3 -0
index 42a8f3f11681..97c4c4812d08 100644
@@ -34,6 +34,7 @@
 
   #include <linux/dma-resv.h>
   #include <linux/export.h>
+#include <linux/sched/mm.h>
 
   /**
    * DOC: Reservation Object Overview
@@ -95,6 +96,29 @@ static void dma_resv_list_free(struct dma_resv_list *list)
       kfree_rcu(list, rcu);
   }
 
+#if IS_ENABLED(CONFIG_LOCKDEP)
+static void __init dma_resv_lockdep(void)

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 110

Quoted 10 lines
drivers/dma-buf/dma-resv.c +10 -0
+{
+     struct mm_struct *mm = mm_alloc();
+     struct dma_resv obj;
+
+     if (!mm)
+             return;
+
+     dma_resv_init(&obj);
+
+     down_read(&mm->mmap_sem);

I took a quick look into using lockdep macros replacing the actual
locks: Something along the lines of

Quoted 1 line

lock_acquire(mm->mmap_sem.dep_map, 0, 0, 1, 1, NULL, _THIS_IP_);

Yeah I'm not a fan of the magic numbers this nees :-/ And now this is run once at startup, so the taking the fake locks for real, once, shouldn't hurt. Lockdep updating it's data structures is going to be 100x more cpu cycles anyway :-)

Quoted 5 lines

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 111

Quoted 1 line
drivers/dma-buf/dma-resv.c +1 -0
+     ww_mutex_lock(&obj.lock, NULL);

lock_acquire(obj.lock.dep_map, 0, 0, 0, 1, NULL, _THIS_IP_);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 114

Quoted 3 lines
drivers/dma-buf/dma-resv.c +3 -0
+     fs_reclaim_acquire(GFP_KERNEL);
+     fs_reclaim_release(GFP_KERNEL);
+     ww_mutex_unlock(&obj.lock);
Quoted 8 lines

lock_release(obj.lock.dep_map, 0, _THIS_IP_);

drivers/dma-buf/dma-resv.c static void dma_resv_list_free(struct dma_resv_list *list) · line 115

Quoted 1 line
drivers/dma-buf/dma-resv.c +1 -0
+     up_read(&mm->mmap_sem);

lock_release(obj.lock.dep_map, 0, _THIS_IP_);

Either way is fine with me, though.

Quoted 8 lines

Thanks for your review comments.

Can you pls also run this in some test cycles, if that's easily possible? I'd like to have a tested-by from at least the big drivers - i915, amd, nouveau, vmwgfx and is definitely using ttm to its fullest too, so best chances for hitting an oversight.

Cheers, Daniel

Tested vmwgfx with a decent OpenGL / rendercheck stress test and no lockdep trips.

/Thomas

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

#31 lore raw

✓ Fi.CI.IGT: success for series starting with [1/3] dma_resv: prime lockdep annotations

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: series starting with [1/3] dma_resv: prime lockdep annotations
URL : https://patchwork.freedesktop.org/series/65575/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6759_full -> Patchwork_14132_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@read_all_entries_display_on:
- shard-skl: [PASS][1] -> [DMESG-WARN][2] ([fdo#106107])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl1/igt@debugfs_test@read_all_entries_display_on.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl8/igt@debugfs_test@read_all_entries_display_on.html

* igt@gem_ctx_isolation@rcs0-s3:
- shard-apl: [PASS][3] -> [DMESG-WARN][4] ([fdo#108566]) +3 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-apl4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-apl6/igt@[email protected]

* igt@gem_exec_schedule@out-order-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb8/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@preempt-queue-bsd1:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#109276]) +6 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb1/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb6/igt@[email protected]

* igt@kms_atomic@test_only:
- shard-snb: [PASS][9] -> [SKIP][10] ([fdo#109271]) +2 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-snb6/igt@kms_atomic@test_only.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-snb7/igt@kms_atomic@test_only.html

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
- shard-hsw: [PASS][11] -> [FAIL][12] ([fdo#105767])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-hsw8/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-hsw6/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-glk: [PASS][13] -> [FAIL][14] ([fdo#105363])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-glk2/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-glk3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-pwrite:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +4 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb3/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-pwrite.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-pwrite.html

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-mmap-gtt:
- shard-iclb: [PASS][17] -> [INCOMPLETE][18] ([fdo#106978] / [fdo#107713])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-mmap-gtt.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-mmap-gtt.html

* igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-indfb-draw-blt:
- shard-skl: [PASS][19] -> [FAIL][20] ([fdo#103167])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl2/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl4/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl: [PASS][21] -> [FAIL][22] ([fdo#108145])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl2/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl4/igt@[email protected]

* igt@kms_psr@psr2_suspend:
- shard-iclb: [PASS][23] -> [SKIP][24] ([fdo#109441])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb2/igt@kms_psr@psr2_suspend.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb4/igt@kms_psr@psr2_suspend.html

* igt@kms_vblank@pipe-a-wait-forked-hang:
- shard-snb: [PASS][25] -> [INCOMPLETE][26] ([fdo#105411])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-snb5/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-snb1/igt@[email protected]

* igt@perf@blocking:
- shard-skl: [PASS][27] -> [FAIL][28] ([fdo#110728])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl10/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl9/igt@[email protected]

#### Possible fixes ####

* igt@gem_eio@unwedge-stress:
- shard-glk: [FAIL][29] ([fdo#109661]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-glk7/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-glk3/igt@[email protected]

* igt@gem_exec_reloc@basic-cpu-active:
- shard-skl: [DMESG-WARN][31] ([fdo#106107]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl7/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl2/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-apl: [DMESG-WARN][33] ([fdo#108566]) -> [PASS][34] +7 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-apl1/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-apl2/igt@[email protected]

* igt@i915_selftest@live_execlists:
- shard-skl: [DMESG-FAIL][35] ([fdo#111422]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl8/igt@i915_selftest@live_execlists.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl1/igt@i915_selftest@live_execlists.html

* igt@i915_suspend@forcewake:
- shard-skl: [INCOMPLETE][37] ([fdo#104108]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl3/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl7/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-apl: [INCOMPLETE][39] ([fdo#103927]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-apl2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-apl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite:
- shard-iclb: [FAIL][41] ([fdo#103167]) -> [PASS][42] +2 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb1/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb6/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite.html

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [FAIL][43] ([fdo#108145] / [fdo#110403]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl10/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl9/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_onoff:
- shard-iclb: [SKIP][45] ([fdo#109441]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb1/igt@kms_psr@psr2_sprite_plane_onoff.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb2/igt@kms_psr@psr2_sprite_plane_onoff.html

* igt@kms_setmode@basic:
- shard-apl: [FAIL][47] ([fdo#99912]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-apl2/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-apl5/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
- shard-skl: [INCOMPLETE][49] ([fdo#104108] / [fdo#107773]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl2/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl7/igt@[email protected]

* igt@kms_vblank@pipe-c-ts-continuation-modeset-hang:
- shard-hsw: [INCOMPLETE][51] ([fdo#103540]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-hsw4/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-hsw1/igt@[email protected]

* igt@prime_busy@hang-bsd2:
- shard-iclb: [SKIP][53] ([fdo#109276]) -> [PASS][54] +9 similar issues
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-iclb5/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-iclb4/igt@[email protected]

#### Warnings ####

* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-blt:
- shard-skl: [FAIL][55] ([fdo#108040]) -> [FAIL][56] ([fdo#103167])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6759/shard-skl9/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14132/shard-skl4/igt@[email protected]

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#106978]: https://bugs.freedesktop.org/show_bug.cgi?id=106978
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107773]: https://bugs.freedesktop.org/show_bug.cgi?id=107773
[fdo#108040]: https://bugs.freedesktop.org/show_bug.cgi?id=108040
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
[fdo#110403]: https://bugs.freedesktop.org/show_bug.cgi?id=110403
[fdo#110728]: https://bugs.freedesktop.org/show_bug.cgi?id=110728
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111422]: https://bugs.freedesktop.org/show_bug.cgi?id=111422
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6759 -> Patchwork_14132

CI-20190529: 20190529
CI_DRM_6759: ef8503f9bd35e778de52953fe627fd50f316d712 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5146: 357dbe1869d88a2f08bcee4eebceff4ee9014424 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14132: 95bae0c804e91ea50401859c0f59635eed746891 @ 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_14132/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#32 lore raw

✓ Fi.CI.IGT: success for series starting with dma_resv: prime lockdep annotations (rev3)

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: series starting with dma_resv: prime lockdep annotations (rev3)
URL : https://patchwork.freedesktop.org/series/65575/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6763_full -> Patchwork_14136_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_isolation@rcs0-s3:
- shard-apl: [PASS][1] -> [DMESG-WARN][2] ([fdo#108566]) +3 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-apl4/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-apl8/igt@[email protected]

* igt@gem_exec_balancer@smoke:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#110854])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb8/igt@[email protected]

* igt@gem_exec_flush@basic-wb-ro-default:
- shard-iclb: [PASS][5] -> [INCOMPLETE][6] ([fdo#107713] / [fdo#109100])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb7/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb7/igt@[email protected]

* igt@gem_exec_schedule@preempt-other-chain-bsd:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#111325]) +5 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb5/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb2/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
- shard-skl: [PASS][9] -> [FAIL][10] ([fdo#102670])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-skl9/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-skl4/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-skl: [PASS][11] -> [INCOMPLETE][12] ([fdo#109507])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-skl1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-skl8/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-fullscreen:
- shard-hsw: [PASS][13] -> [SKIP][14] ([fdo#109271])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-hsw5/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-fullscreen.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-hsw8/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-fullscreen.html

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-render:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb5/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-render.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-render.html

* igt@kms_psr@psr2_basic:
- shard-iclb: [PASS][17] -> [SKIP][18] ([fdo#109441]) +3 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb2/igt@kms_psr@psr2_basic.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb6/igt@kms_psr@psr2_basic.html

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-skl: [PASS][19] -> [INCOMPLETE][20] ([fdo#104108])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-skl9/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-skl7/igt@[email protected]

* igt@prime_busy@hang-bsd2:
- shard-iclb: [PASS][21] -> [SKIP][22] ([fdo#109276]) +12 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb4/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb5/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [SKIP][23] ([fdo#110841]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb4/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb5/igt@[email protected]

* igt@gem_exec_schedule@preempt-queue-bsd1:
- shard-iclb: [SKIP][25] ([fdo#109276]) -> [PASS][26] +13 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb8/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@preemptive-hang-bsd:
- shard-iclb: [SKIP][27] ([fdo#111325]) -> [PASS][28] +7 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb7/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-apl: [DMESG-WARN][29] ([fdo#108566]) -> [PASS][30] +3 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-apl4/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-apl4/igt@[email protected]

* igt@kms_color@pipe-b-degamma:
- shard-skl: [FAIL][31] ([fdo#104782]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-skl9/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-skl7/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
- shard-hsw: [FAIL][33] ([fdo#105767]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-hsw4/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-hsw1/igt@[email protected]

* igt@kms_cursor_legacy@pipe-a-torture-bo:
- shard-apl: [INCOMPLETE][35] ([fdo#103927]) -> [PASS][36] +3 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-apl4/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-apl2/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank:
- shard-hsw: [FAIL][37] ([fdo#102887]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-hsw2/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-hsw5/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-glk: [FAIL][39] ([fdo#105363]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-glk1/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-glk6/igt@[email protected]

* igt@kms_flip@dpms-vs-vblank-race:
- shard-glk: [FAIL][41] ([fdo#103060]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-glk6/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-glk3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [FAIL][43] ([fdo#103167]) -> [PASS][44] +3 similar issues
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb2/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [FAIL][45] ([fdo#108145]) -> [PASS][46] +1 similar issue
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-skl9/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-skl4/igt@[email protected]

* igt@kms_psr@no_drrs:
- shard-iclb: [FAIL][47] ([fdo#108341]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb1/igt@kms_psr@no_drrs.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb4/igt@kms_psr@no_drrs.html

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [SKIP][49] ([fdo#109441]) -> [PASS][50] +2 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb5/igt@kms_psr@psr2_primary_mmap_cpu.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html

* igt@kms_vblank@pipe-a-wait-busy-hang:
- shard-iclb: [INCOMPLETE][51] ([fdo#107713]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb7/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb4/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-kbl: [INCOMPLETE][53] ([fdo#103665]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-kbl2/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-kbl6/igt@[email protected]

#### Warnings ####

* igt@gem_mocs_settings@mocs-reset-bsd2:
- shard-iclb: [FAIL][55] ([fdo#111330]) -> [SKIP][56] ([fdo#109276]) +1 similar issue
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6763/shard-iclb2/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14136/shard-iclb5/igt@[email protected]

[fdo#102670]: https://bugs.freedesktop.org/show_bug.cgi?id=102670
[fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
[fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
[fdo#110854]: https://bugs.freedesktop.org/show_bug.cgi?id=110854
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330

Participating hosts (9 -> 9)
------------------------------

No changes in participating hosts

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6763 -> Patchwork_14136

CI-20190529: 20190529
CI_DRM_6763: a9a5855cece4d78bc2dfd4c719191a9ccabab4fb @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5147: 289dcb935ee195352f987c0ae7dd31693bf7de0f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14136: dd4da03d3f1fffd050c83bbd0458d4b566483e86 @ 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_14136/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx