intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Flush all user surfaces prior to first use
@ 2019-11-12 13:54 Chris Wilson
  2019-11-12 13:54 ` [Intel-gfx] " Chris Wilson
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Chris Wilson @ 2019-11-12 13:54 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

Since userspace has the ability to bypass the CPU cache from within its
unprivileged command stream, we have to flush the CPU cache to memory
in order to overwrite the previous contents on creation. We enforce this
at the boundary points (get/put pages) to ensure that before recycling
system pages we are always cache coherent.

v3: We now always clflush on acquisition and release of system pages,
and include a clflush counting selftest to make sure we do. This also
succinctly covers swap-in/swap-out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   8 ++
 drivers/gpu/drm/i915/gem/i915_gem_clflush.h   |   6 +
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     |   7 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  22 +++-
 .../i915/gem/selftests/i915_gem_coherency.c   | 106 ++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h               |   2 +
 6 files changed, 146 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
index b9f504ba3b32..e2434e17ffc1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
@@ -16,11 +16,19 @@ struct clflush {
 	struct drm_i915_gem_object *obj;
 };
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj)
+{
+	atomic_inc(&to_i915(obj->base.dev)->gem.clflushes);
+}
+#endif
+
 static void __do_clflush(struct drm_i915_gem_object *obj)
 {
 	GEM_BUG_ON(!i915_gem_object_has_pages(obj));
 	drm_clflush_sg(obj->mm.pages);
 	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
+	st_clflush_inc(obj);
 }
 
 static int clflush_work(struct dma_fence_work *base)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
index e6c382973129..7434d878a553 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
@@ -17,4 +17,10 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
 #define I915_CLFLUSH_FORCE BIT(0)
 #define I915_CLFLUSH_SYNC BIT(1)
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj);
+#else
+static inline void st_clflush_inc(struct drm_i915_gem_object *obj) { }
+#endif
+
 #endif /* __I915_GEM_CLFLUSH_H__ */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index f402c2c415c2..8bcf9b65d661 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -5,9 +5,10 @@
  */
 
 #include "i915_drv.h"
+#include "i915_gem_clflush.h"
+#include "i915_gem_lmem.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
-#include "i915_gem_lmem.h"
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 				 struct sg_table *pages,
@@ -25,8 +26,10 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 	/* Make the pages coherent with the GPU (flushing any swapin). */
 	if (obj->cache_dirty) {
 		obj->write_domain = 0;
-		if (i915_gem_object_has_struct_page(obj))
+		if (i915_gem_object_has_struct_page(obj)) {
 			drm_clflush_sg(pages);
+			st_clflush_inc(obj);
+		}
 		obj->cache_dirty = false;
 	}
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index 4d69c3fc3439..9db53a4d1b2e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -10,6 +10,7 @@
 #include "gem/i915_gem_region.h"
 #include "i915_drv.h"
 #include "i915_gemfs.h"
+#include "i915_gem_clflush.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 #include "i915_trace.h"
@@ -183,6 +184,15 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj, st);
 
+	/*
+	 * Since userspace has the ability to bypass the CPU cache from within
+	 * its unprivileged command stream, we have to flush the CPU cache to
+	 * memory in order to overwrite the previous contents on creation, so
+	 * that userspace cannot snoop on the old system pages just handed to
+	 * us.
+	 */
+	obj->cache_dirty = true; /* For drm_clflush_sg() inside set_pages */
+
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -285,10 +295,16 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 	if (obj->mm.madv == I915_MADV_DONTNEED)
 		obj->mm.dirty = false;
 
-	if (needs_clflush &&
-	    (obj->read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
-	    !(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ))
+	/*
+	 * Unless we know for certain that the main memory contents are
+	 * coherent with the CPU cache, flush the CPU cache. This ensures
+	 * that userspace that has bypassed the CPU cache to write into
+	 * main memory does not leak the contents of its CPU cache.
+	 */
+	if (obj->write_domain != I915_GEM_DOMAIN_CPU) {
 		drm_clflush_sg(pages);
+		st_clflush_inc(obj);
+	}
 
 	__start_cpu_write(obj);
 }
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
index 2b29f6b4e1dd..30346a6dfa22 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
@@ -6,6 +6,8 @@
 
 #include <linux/prime_numbers.h>
 
+#include "gem/i915_gem_clflush.h"
+#include "gem/i915_gem_object.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_ring.h"
@@ -297,6 +299,109 @@ random_engine(struct drm_i915_private *i915, struct rnd_state *prng)
 	return NULL;
 }
 
+static int checked_clflush(struct drm_i915_gem_object *obj,
+			   unsigned int flags,
+			   int expected)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int clflushes = atomic_read(&i915->gem.clflushes);
+
+	i915_gem_clflush_object(obj, flags);
+
+	if (obj->cache_dirty) {
+		pr_err("clflush did not clear obj->cache_dirty!\n");
+		return -EINVAL;
+	}
+
+	if (atomic_read(&i915->gem.clflushes) != clflushes + expected) {
+		pr_err("clflush counter did not match!\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int igt_gem_clflush(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj;
+	unsigned int clflushes;
+	int err = 0;
+
+	/*
+	 * Before the data is visible to the GPU, we sometimes have to
+	 * flush the CPU cache. For example, only with the introduction
+	 * of LLC with Sandybride could the GPU and CPU caches be fully
+	 * coherent. However, the display engine (scanout) has different
+	 * coherency with the GPU then the CPU, and even if the CPU/GPU
+	 * could talk to each other we would still need to flush the CPU
+	 * caches for scanout. Finally, userspace can bypass the cache
+	 * snooping altogether from inside its unprivileged batch bufers.
+	 *
+	 * We use drm_clflush_*() to clear the CPU cachelines on such
+	 * transitions, so we can assert that we will do so by setting
+	 * up the dirty state and looking at our clflush counter
+	 */
+
+	/*
+	 * Creating a shmem object from system pages, we must assume
+	 * the CPU cache is dirty. That is the main memory can have
+	 * different (stale) content than the CPU, as the kernel
+	 * expects all reads to come from the CPU cache. As we know the GPU
+	 * may ignore the CPU cache and read from memory instead, we must
+	 * assume the worst.
+	 */
+	obj = i915_gem_object_create_shmem(i915, 4096);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	/* We always clflush on acquisition of the backing storage */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto err;
+
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("no clflush recorded for page acquisition\n");
+		err = -EINVAL;
+		goto err;
+	}
+	if (obj->cache_dirty) {
+		pr_err("fresh pages, but CPU cache is dirty!\n");
+		err = -EINVAL;
+		goto err;
+	}
+
+	/* An _unforced_ clflush is ignored */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC, 0);
+	if (err) {
+		pr_err("redundant clflush failed!\n");
+		goto err;
+	}
+
+	/* But a _forced_ clflush is obeyed, even if we think its clean */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE, 1);
+	if (err) {
+		pr_err("forced clflush failed!\n");
+		goto err;
+	}
+
+	/* Releasing a shmem object must flush (in case of user bypass) */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("clflush not recorded for releasing dirty uncached object\n");
+		err = -EINVAL;
+	}
+
+	goto out;
+err:
+	i915_gem_object_put(obj);
+out:
+	return err;
+}
+
 static int igt_gem_coherency(void *arg)
 {
 	const unsigned int ncachelines = PAGE_SIZE/64;
@@ -415,6 +520,7 @@ static int igt_gem_coherency(void *arg)
 int i915_gem_coherency_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
+		SUBTEST(igt_gem_clflush),
 		SUBTEST(igt_gem_coherency),
 	};
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b82ff0bc6d0c..5f8bd1d54c59 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1259,6 +1259,8 @@ struct drm_i915_private {
 			struct llist_head free_list;
 			struct work_struct free_work;
 		} contexts;
+
+		I915_SELFTEST_DECLARE(atomic_t clflushes;)
 	} gem;
 
 	u8 pch_ssc_use;
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [Intel-gfx] [PATCH] drm/i915: Flush all user surfaces prior to first use
  2019-11-12 13:54 [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
@ 2019-11-12 13:54 ` Chris Wilson
  2019-11-12 15:12 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev3) Patchwork
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2019-11-12 13:54 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

Since userspace has the ability to bypass the CPU cache from within its
unprivileged command stream, we have to flush the CPU cache to memory
in order to overwrite the previous contents on creation. We enforce this
at the boundary points (get/put pages) to ensure that before recycling
system pages we are always cache coherent.

v3: We now always clflush on acquisition and release of system pages,
and include a clflush counting selftest to make sure we do. This also
succinctly covers swap-in/swap-out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   8 ++
 drivers/gpu/drm/i915/gem/i915_gem_clflush.h   |   6 +
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     |   7 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  22 +++-
 .../i915/gem/selftests/i915_gem_coherency.c   | 106 ++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h               |   2 +
 6 files changed, 146 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
index b9f504ba3b32..e2434e17ffc1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
@@ -16,11 +16,19 @@ struct clflush {
 	struct drm_i915_gem_object *obj;
 };
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj)
+{
+	atomic_inc(&to_i915(obj->base.dev)->gem.clflushes);
+}
+#endif
+
 static void __do_clflush(struct drm_i915_gem_object *obj)
 {
 	GEM_BUG_ON(!i915_gem_object_has_pages(obj));
 	drm_clflush_sg(obj->mm.pages);
 	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
+	st_clflush_inc(obj);
 }
 
 static int clflush_work(struct dma_fence_work *base)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
index e6c382973129..7434d878a553 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
@@ -17,4 +17,10 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
 #define I915_CLFLUSH_FORCE BIT(0)
 #define I915_CLFLUSH_SYNC BIT(1)
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj);
+#else
+static inline void st_clflush_inc(struct drm_i915_gem_object *obj) { }
+#endif
+
 #endif /* __I915_GEM_CLFLUSH_H__ */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index f402c2c415c2..8bcf9b65d661 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -5,9 +5,10 @@
  */
 
 #include "i915_drv.h"
+#include "i915_gem_clflush.h"
+#include "i915_gem_lmem.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
-#include "i915_gem_lmem.h"
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 				 struct sg_table *pages,
@@ -25,8 +26,10 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 	/* Make the pages coherent with the GPU (flushing any swapin). */
 	if (obj->cache_dirty) {
 		obj->write_domain = 0;
-		if (i915_gem_object_has_struct_page(obj))
+		if (i915_gem_object_has_struct_page(obj)) {
 			drm_clflush_sg(pages);
+			st_clflush_inc(obj);
+		}
 		obj->cache_dirty = false;
 	}
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index 4d69c3fc3439..9db53a4d1b2e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -10,6 +10,7 @@
 #include "gem/i915_gem_region.h"
 #include "i915_drv.h"
 #include "i915_gemfs.h"
+#include "i915_gem_clflush.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 #include "i915_trace.h"
@@ -183,6 +184,15 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj, st);
 
+	/*
+	 * Since userspace has the ability to bypass the CPU cache from within
+	 * its unprivileged command stream, we have to flush the CPU cache to
+	 * memory in order to overwrite the previous contents on creation, so
+	 * that userspace cannot snoop on the old system pages just handed to
+	 * us.
+	 */
+	obj->cache_dirty = true; /* For drm_clflush_sg() inside set_pages */
+
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -285,10 +295,16 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 	if (obj->mm.madv == I915_MADV_DONTNEED)
 		obj->mm.dirty = false;
 
-	if (needs_clflush &&
-	    (obj->read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
-	    !(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ))
+	/*
+	 * Unless we know for certain that the main memory contents are
+	 * coherent with the CPU cache, flush the CPU cache. This ensures
+	 * that userspace that has bypassed the CPU cache to write into
+	 * main memory does not leak the contents of its CPU cache.
+	 */
+	if (obj->write_domain != I915_GEM_DOMAIN_CPU) {
 		drm_clflush_sg(pages);
+		st_clflush_inc(obj);
+	}
 
 	__start_cpu_write(obj);
 }
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
index 2b29f6b4e1dd..30346a6dfa22 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
@@ -6,6 +6,8 @@
 
 #include <linux/prime_numbers.h>
 
+#include "gem/i915_gem_clflush.h"
+#include "gem/i915_gem_object.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_ring.h"
@@ -297,6 +299,109 @@ random_engine(struct drm_i915_private *i915, struct rnd_state *prng)
 	return NULL;
 }
 
+static int checked_clflush(struct drm_i915_gem_object *obj,
+			   unsigned int flags,
+			   int expected)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int clflushes = atomic_read(&i915->gem.clflushes);
+
+	i915_gem_clflush_object(obj, flags);
+
+	if (obj->cache_dirty) {
+		pr_err("clflush did not clear obj->cache_dirty!\n");
+		return -EINVAL;
+	}
+
+	if (atomic_read(&i915->gem.clflushes) != clflushes + expected) {
+		pr_err("clflush counter did not match!\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int igt_gem_clflush(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj;
+	unsigned int clflushes;
+	int err = 0;
+
+	/*
+	 * Before the data is visible to the GPU, we sometimes have to
+	 * flush the CPU cache. For example, only with the introduction
+	 * of LLC with Sandybride could the GPU and CPU caches be fully
+	 * coherent. However, the display engine (scanout) has different
+	 * coherency with the GPU then the CPU, and even if the CPU/GPU
+	 * could talk to each other we would still need to flush the CPU
+	 * caches for scanout. Finally, userspace can bypass the cache
+	 * snooping altogether from inside its unprivileged batch bufers.
+	 *
+	 * We use drm_clflush_*() to clear the CPU cachelines on such
+	 * transitions, so we can assert that we will do so by setting
+	 * up the dirty state and looking at our clflush counter
+	 */
+
+	/*
+	 * Creating a shmem object from system pages, we must assume
+	 * the CPU cache is dirty. That is the main memory can have
+	 * different (stale) content than the CPU, as the kernel
+	 * expects all reads to come from the CPU cache. As we know the GPU
+	 * may ignore the CPU cache and read from memory instead, we must
+	 * assume the worst.
+	 */
+	obj = i915_gem_object_create_shmem(i915, 4096);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	/* We always clflush on acquisition of the backing storage */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto err;
+
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("no clflush recorded for page acquisition\n");
+		err = -EINVAL;
+		goto err;
+	}
+	if (obj->cache_dirty) {
+		pr_err("fresh pages, but CPU cache is dirty!\n");
+		err = -EINVAL;
+		goto err;
+	}
+
+	/* An _unforced_ clflush is ignored */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC, 0);
+	if (err) {
+		pr_err("redundant clflush failed!\n");
+		goto err;
+	}
+
+	/* But a _forced_ clflush is obeyed, even if we think its clean */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE, 1);
+	if (err) {
+		pr_err("forced clflush failed!\n");
+		goto err;
+	}
+
+	/* Releasing a shmem object must flush (in case of user bypass) */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("clflush not recorded for releasing dirty uncached object\n");
+		err = -EINVAL;
+	}
+
+	goto out;
+err:
+	i915_gem_object_put(obj);
+out:
+	return err;
+}
+
 static int igt_gem_coherency(void *arg)
 {
 	const unsigned int ncachelines = PAGE_SIZE/64;
@@ -415,6 +520,7 @@ static int igt_gem_coherency(void *arg)
 int i915_gem_coherency_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
+		SUBTEST(igt_gem_clflush),
 		SUBTEST(igt_gem_coherency),
 	};
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b82ff0bc6d0c..5f8bd1d54c59 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1259,6 +1259,8 @@ struct drm_i915_private {
 			struct llist_head free_list;
 			struct work_struct free_work;
 		} contexts;
+
+		I915_SELFTEST_DECLARE(atomic_t clflushes;)
 	} gem;
 
 	u8 pch_ssc_use;
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev3)
  2019-11-12 13:54 [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
  2019-11-12 13:54 ` [Intel-gfx] " Chris Wilson
@ 2019-11-12 15:12 ` Patchwork
  2019-11-12 15:12   ` [Intel-gfx] " Patchwork
  2019-11-12 15:20 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Patchwork @ 2019-11-12 15:12 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Flush all user surfaces prior to first use (rev3)
URL   : https://patchwork.freedesktop.org/series/63871/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7316 -> Patchwork_15233
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15233 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15233, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live_coherency:
    - fi-skl-6770hq:      [PASS][1] -> [DMESG-WARN][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6770hq/igt@i915_selftest@live_coherency.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6770hq/igt@i915_selftest@live_coherency.html
    - fi-byt-n2820:       [PASS][3] -> [DMESG-FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-byt-n2820/igt@i915_selftest@live_coherency.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-byt-n2820/igt@i915_selftest@live_coherency.html
    - fi-skl-6700k2:      [PASS][5] -> [DMESG-WARN][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6700k2/igt@i915_selftest@live_coherency.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6700k2/igt@i915_selftest@live_coherency.html
    - fi-skl-lmem:        [PASS][7] -> [DMESG-WARN][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-lmem/igt@i915_selftest@live_coherency.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-lmem/igt@i915_selftest@live_coherency.html
    - fi-snb-2600:        [PASS][9] -> [DMESG-WARN][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-snb-2600/igt@i915_selftest@live_coherency.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-snb-2600/igt@i915_selftest@live_coherency.html
    - fi-hsw-peppy:       [PASS][11] -> [DMESG-WARN][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-peppy/igt@i915_selftest@live_coherency.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-peppy/igt@i915_selftest@live_coherency.html
    - fi-kbl-x1275:       [PASS][13] -> [DMESG-WARN][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-x1275/igt@i915_selftest@live_coherency.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-x1275/igt@i915_selftest@live_coherency.html
    - fi-icl-u3:          [PASS][15] -> [DMESG-WARN][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-u3/igt@i915_selftest@live_coherency.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-u3/igt@i915_selftest@live_coherency.html
    - fi-bwr-2160:        [PASS][17] -> [DMESG-FAIL][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bwr-2160/igt@i915_selftest@live_coherency.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bwr-2160/igt@i915_selftest@live_coherency.html
    - fi-kbl-r:           [PASS][19] -> [DMESG-WARN][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-r/igt@i915_selftest@live_coherency.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-r/igt@i915_selftest@live_coherency.html
    - fi-skl-guc:         [PASS][21] -> [DMESG-WARN][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-guc/igt@i915_selftest@live_coherency.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-guc/igt@i915_selftest@live_coherency.html
    - fi-kbl-8809g:       [PASS][23] -> [DMESG-WARN][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-8809g/igt@i915_selftest@live_coherency.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-8809g/igt@i915_selftest@live_coherency.html
    - fi-bsw-nick:        [PASS][25] -> [DMESG-FAIL][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bsw-nick/igt@i915_selftest@live_coherency.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bsw-nick/igt@i915_selftest@live_coherency.html
    - fi-snb-2520m:       [PASS][27] -> [DMESG-WARN][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-snb-2520m/igt@i915_selftest@live_coherency.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-snb-2520m/igt@i915_selftest@live_coherency.html
    - fi-bxt-dsi:         [PASS][29] -> [DMESG-FAIL][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
    - fi-gdg-551:         NOTRUN -> [DMESG-FAIL][31]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-gdg-551/igt@i915_selftest@live_coherency.html
    - fi-cfl-8700k:       [PASS][32] -> [DMESG-WARN][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-cfl-8700k/igt@i915_selftest@live_coherency.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cfl-8700k/igt@i915_selftest@live_coherency.html
    - fi-icl-u2:          [PASS][34] -> [DMESG-WARN][35]
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-u2/igt@i915_selftest@live_coherency.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-u2/igt@i915_selftest@live_coherency.html
    - fi-cml-u2:          [PASS][36] -> [DMESG-WARN][37]
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-cml-u2/igt@i915_selftest@live_coherency.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cml-u2/igt@i915_selftest@live_coherency.html
    - fi-ilk-650:         [PASS][38] -> [DMESG-FAIL][39]
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-ilk-650/igt@i915_selftest@live_coherency.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-ilk-650/igt@i915_selftest@live_coherency.html
    - fi-bsw-n3050:       [PASS][40] -> [DMESG-FAIL][41]
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
    - fi-hsw-4770:        [PASS][42] -> [DMESG-WARN][43]
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-4770/igt@i915_selftest@live_coherency.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-4770/igt@i915_selftest@live_coherency.html
    - fi-cfl-guc:         [PASS][44] -> [DMESG-WARN][45]
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-cfl-guc/igt@i915_selftest@live_coherency.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cfl-guc/igt@i915_selftest@live_coherency.html
    - fi-glk-dsi:         [PASS][46] -> [DMESG-FAIL][47]
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-glk-dsi/igt@i915_selftest@live_coherency.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-glk-dsi/igt@i915_selftest@live_coherency.html
    - fi-ivb-3770:        [PASS][48] -> [DMESG-WARN][49]
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-ivb-3770/igt@i915_selftest@live_coherency.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-ivb-3770/igt@i915_selftest@live_coherency.html
    - fi-icl-u4:          [PASS][50] -> [DMESG-WARN][51]
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-u4/igt@i915_selftest@live_coherency.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-u4/igt@i915_selftest@live_coherency.html
    - fi-kbl-7500u:       [PASS][52] -> [DMESG-WARN][53]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-7500u/igt@i915_selftest@live_coherency.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-7500u/igt@i915_selftest@live_coherency.html
    - fi-hsw-4770r:       [PASS][54] -> [DMESG-WARN][55]
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-4770r/igt@i915_selftest@live_coherency.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-4770r/igt@i915_selftest@live_coherency.html
    - fi-kbl-guc:         [PASS][56] -> [DMESG-WARN][57]
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-guc/igt@i915_selftest@live_coherency.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-guc/igt@i915_selftest@live_coherency.html
    - fi-bsw-kefka:       [PASS][58] -> [DMESG-FAIL][59]
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
    - fi-blb-e6850:       [PASS][60] -> [DMESG-FAIL][61]
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-blb-e6850/igt@i915_selftest@live_coherency.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-blb-e6850/igt@i915_selftest@live_coherency.html
    - fi-bdw-5557u:       [PASS][62] -> [DMESG-WARN][63]
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bdw-5557u/igt@i915_selftest@live_coherency.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bdw-5557u/igt@i915_selftest@live_coherency.html
    - fi-apl-guc:         [PASS][64] -> [DMESG-FAIL][65]
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-apl-guc/igt@i915_selftest@live_coherency.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-apl-guc/igt@i915_selftest@live_coherency.html
    - fi-icl-y:           [PASS][66] -> [DMESG-WARN][67]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-y/igt@i915_selftest@live_coherency.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-y/igt@i915_selftest@live_coherency.html
    - fi-skl-6600u:       [PASS][68] -> [DMESG-WARN][69]
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6600u/igt@i915_selftest@live_coherency.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6600u/igt@i915_selftest@live_coherency.html
    - fi-pnv-d510:        [PASS][70] -> [DMESG-FAIL][71]
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-pnv-d510/igt@i915_selftest@live_coherency.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-pnv-d510/igt@i915_selftest@live_coherency.html
    - fi-byt-j1900:       [PASS][72] -> [DMESG-FAIL][73]
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-byt-j1900/igt@i915_selftest@live_coherency.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-byt-j1900/igt@i915_selftest@live_coherency.html
    - fi-whl-u:           [PASS][74] -> [DMESG-WARN][75]
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-whl-u/igt@i915_selftest@live_coherency.html
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-whl-u/igt@i915_selftest@live_coherency.html
    - fi-icl-dsi:         [PASS][76] -> [DMESG-WARN][77]
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-dsi/igt@i915_selftest@live_coherency.html
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-dsi/igt@i915_selftest@live_coherency.html

  * igt@runner@aborted:
    - fi-pnv-d510:        NOTRUN -> [FAIL][78]
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-pnv-d510/igt@runner@aborted.html
    - fi-gdg-551:         NOTRUN -> [FAIL][79]
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-gdg-551/igt@runner@aborted.html
    - fi-whl-u:           NOTRUN -> [FAIL][80]
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-whl-u/igt@runner@aborted.html
    - fi-cml-u2:          NOTRUN -> [FAIL][81]
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cml-u2/igt@runner@aborted.html
    - fi-bxt-dsi:         NOTRUN -> [FAIL][82]
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bxt-dsi/igt@runner@aborted.html
    - fi-blb-e6850:       NOTRUN -> [FAIL][83]
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-blb-e6850/igt@runner@aborted.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-guc:         [PASS][84] -> [FAIL][85] ([fdo#103167])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-guc/igt@kms_frontbuffer_tracking@basic.html
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-guc/igt@kms_frontbuffer_tracking@basic.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - fi-skl-6770hq:      [PASS][86] -> [WARN][87] ([fdo#112252])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - fi-hsw-4770:        [SKIP][88] ([fdo#109271]) -> [PASS][89] +1 similar issue
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-4770/igt@i915_pm_rpm@basic-pci-d3-state.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-4770/igt@i915_pm_rpm@basic-pci-d3-state.html

  
  {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#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109964]: https://bugs.freedesktop.org/show_bug.cgi?id=109964
  [fdo#110343]: https://bugs.freedesktop.org/show_bug.cgi?id=110343
  [fdo#112252]: https://bugs.freedesktop.org/show_bug.cgi?id=112252


Participating hosts (52 -> 46)
------------------------------

  Additional (1): fi-gdg-551 
  Missing    (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-elk-e7500 fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7316 -> Patchwork_15233

  CI-20190529: 20190529
  CI_DRM_7316: a4939708275196364ef98691a90c89d501536494 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5272: 5997df31db10f190fe8b70d920b6a6b8d3b24126 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15233: efbbfb869fdb414f8319186ab87b5c53f0cb7447 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

efbbfb869fdb drm/i915: Flush all user surfaces prior to first use

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev3)
  2019-11-12 15:12 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev3) Patchwork
@ 2019-11-12 15:12   ` Patchwork
  0 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2019-11-12 15:12 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Flush all user surfaces prior to first use (rev3)
URL   : https://patchwork.freedesktop.org/series/63871/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7316 -> Patchwork_15233
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15233 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15233, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live_coherency:
    - fi-skl-6770hq:      [PASS][1] -> [DMESG-WARN][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6770hq/igt@i915_selftest@live_coherency.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6770hq/igt@i915_selftest@live_coherency.html
    - fi-byt-n2820:       [PASS][3] -> [DMESG-FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-byt-n2820/igt@i915_selftest@live_coherency.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-byt-n2820/igt@i915_selftest@live_coherency.html
    - fi-skl-6700k2:      [PASS][5] -> [DMESG-WARN][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6700k2/igt@i915_selftest@live_coherency.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6700k2/igt@i915_selftest@live_coherency.html
    - fi-skl-lmem:        [PASS][7] -> [DMESG-WARN][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-lmem/igt@i915_selftest@live_coherency.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-lmem/igt@i915_selftest@live_coherency.html
    - fi-snb-2600:        [PASS][9] -> [DMESG-WARN][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-snb-2600/igt@i915_selftest@live_coherency.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-snb-2600/igt@i915_selftest@live_coherency.html
    - fi-hsw-peppy:       [PASS][11] -> [DMESG-WARN][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-peppy/igt@i915_selftest@live_coherency.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-peppy/igt@i915_selftest@live_coherency.html
    - fi-kbl-x1275:       [PASS][13] -> [DMESG-WARN][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-x1275/igt@i915_selftest@live_coherency.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-x1275/igt@i915_selftest@live_coherency.html
    - fi-icl-u3:          [PASS][15] -> [DMESG-WARN][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-u3/igt@i915_selftest@live_coherency.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-u3/igt@i915_selftest@live_coherency.html
    - fi-bwr-2160:        [PASS][17] -> [DMESG-FAIL][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bwr-2160/igt@i915_selftest@live_coherency.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bwr-2160/igt@i915_selftest@live_coherency.html
    - fi-kbl-r:           [PASS][19] -> [DMESG-WARN][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-r/igt@i915_selftest@live_coherency.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-r/igt@i915_selftest@live_coherency.html
    - fi-skl-guc:         [PASS][21] -> [DMESG-WARN][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-guc/igt@i915_selftest@live_coherency.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-guc/igt@i915_selftest@live_coherency.html
    - fi-kbl-8809g:       [PASS][23] -> [DMESG-WARN][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-8809g/igt@i915_selftest@live_coherency.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-8809g/igt@i915_selftest@live_coherency.html
    - fi-bsw-nick:        [PASS][25] -> [DMESG-FAIL][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bsw-nick/igt@i915_selftest@live_coherency.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bsw-nick/igt@i915_selftest@live_coherency.html
    - fi-snb-2520m:       [PASS][27] -> [DMESG-WARN][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-snb-2520m/igt@i915_selftest@live_coherency.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-snb-2520m/igt@i915_selftest@live_coherency.html
    - fi-bxt-dsi:         [PASS][29] -> [DMESG-FAIL][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
    - fi-gdg-551:         NOTRUN -> [DMESG-FAIL][31]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-gdg-551/igt@i915_selftest@live_coherency.html
    - fi-cfl-8700k:       [PASS][32] -> [DMESG-WARN][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-cfl-8700k/igt@i915_selftest@live_coherency.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cfl-8700k/igt@i915_selftest@live_coherency.html
    - fi-icl-u2:          [PASS][34] -> [DMESG-WARN][35]
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-u2/igt@i915_selftest@live_coherency.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-u2/igt@i915_selftest@live_coherency.html
    - fi-cml-u2:          [PASS][36] -> [DMESG-WARN][37]
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-cml-u2/igt@i915_selftest@live_coherency.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cml-u2/igt@i915_selftest@live_coherency.html
    - fi-ilk-650:         [PASS][38] -> [DMESG-FAIL][39]
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-ilk-650/igt@i915_selftest@live_coherency.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-ilk-650/igt@i915_selftest@live_coherency.html
    - fi-bsw-n3050:       [PASS][40] -> [DMESG-FAIL][41]
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
    - fi-hsw-4770:        [PASS][42] -> [DMESG-WARN][43]
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-4770/igt@i915_selftest@live_coherency.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-4770/igt@i915_selftest@live_coherency.html
    - fi-cfl-guc:         [PASS][44] -> [DMESG-WARN][45]
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-cfl-guc/igt@i915_selftest@live_coherency.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cfl-guc/igt@i915_selftest@live_coherency.html
    - fi-glk-dsi:         [PASS][46] -> [DMESG-FAIL][47]
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-glk-dsi/igt@i915_selftest@live_coherency.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-glk-dsi/igt@i915_selftest@live_coherency.html
    - fi-ivb-3770:        [PASS][48] -> [DMESG-WARN][49]
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-ivb-3770/igt@i915_selftest@live_coherency.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-ivb-3770/igt@i915_selftest@live_coherency.html
    - fi-icl-u4:          [PASS][50] -> [DMESG-WARN][51]
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-u4/igt@i915_selftest@live_coherency.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-u4/igt@i915_selftest@live_coherency.html
    - fi-kbl-7500u:       [PASS][52] -> [DMESG-WARN][53]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-7500u/igt@i915_selftest@live_coherency.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-7500u/igt@i915_selftest@live_coherency.html
    - fi-hsw-4770r:       [PASS][54] -> [DMESG-WARN][55]
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-4770r/igt@i915_selftest@live_coherency.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-4770r/igt@i915_selftest@live_coherency.html
    - fi-kbl-guc:         [PASS][56] -> [DMESG-WARN][57]
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-kbl-guc/igt@i915_selftest@live_coherency.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-kbl-guc/igt@i915_selftest@live_coherency.html
    - fi-bsw-kefka:       [PASS][58] -> [DMESG-FAIL][59]
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
    - fi-blb-e6850:       [PASS][60] -> [DMESG-FAIL][61]
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-blb-e6850/igt@i915_selftest@live_coherency.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-blb-e6850/igt@i915_selftest@live_coherency.html
    - fi-bdw-5557u:       [PASS][62] -> [DMESG-WARN][63]
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-bdw-5557u/igt@i915_selftest@live_coherency.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bdw-5557u/igt@i915_selftest@live_coherency.html
    - fi-apl-guc:         [PASS][64] -> [DMESG-FAIL][65]
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-apl-guc/igt@i915_selftest@live_coherency.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-apl-guc/igt@i915_selftest@live_coherency.html
    - fi-icl-y:           [PASS][66] -> [DMESG-WARN][67]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-y/igt@i915_selftest@live_coherency.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-y/igt@i915_selftest@live_coherency.html
    - fi-skl-6600u:       [PASS][68] -> [DMESG-WARN][69]
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6600u/igt@i915_selftest@live_coherency.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6600u/igt@i915_selftest@live_coherency.html
    - fi-pnv-d510:        [PASS][70] -> [DMESG-FAIL][71]
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-pnv-d510/igt@i915_selftest@live_coherency.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-pnv-d510/igt@i915_selftest@live_coherency.html
    - fi-byt-j1900:       [PASS][72] -> [DMESG-FAIL][73]
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-byt-j1900/igt@i915_selftest@live_coherency.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-byt-j1900/igt@i915_selftest@live_coherency.html
    - fi-whl-u:           [PASS][74] -> [DMESG-WARN][75]
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-whl-u/igt@i915_selftest@live_coherency.html
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-whl-u/igt@i915_selftest@live_coherency.html
    - fi-icl-dsi:         [PASS][76] -> [DMESG-WARN][77]
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-dsi/igt@i915_selftest@live_coherency.html
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-dsi/igt@i915_selftest@live_coherency.html

  * igt@runner@aborted:
    - fi-pnv-d510:        NOTRUN -> [FAIL][78]
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-pnv-d510/igt@runner@aborted.html
    - fi-gdg-551:         NOTRUN -> [FAIL][79]
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-gdg-551/igt@runner@aborted.html
    - fi-whl-u:           NOTRUN -> [FAIL][80]
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-whl-u/igt@runner@aborted.html
    - fi-cml-u2:          NOTRUN -> [FAIL][81]
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-cml-u2/igt@runner@aborted.html
    - fi-bxt-dsi:         NOTRUN -> [FAIL][82]
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-bxt-dsi/igt@runner@aborted.html
    - fi-blb-e6850:       NOTRUN -> [FAIL][83]
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-blb-e6850/igt@runner@aborted.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-guc:         [PASS][84] -> [FAIL][85] ([fdo#103167])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-icl-guc/igt@kms_frontbuffer_tracking@basic.html
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-icl-guc/igt@kms_frontbuffer_tracking@basic.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - fi-skl-6770hq:      [PASS][86] -> [WARN][87] ([fdo#112252])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - fi-hsw-4770:        [SKIP][88] ([fdo#109271]) -> [PASS][89] +1 similar issue
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7316/fi-hsw-4770/igt@i915_pm_rpm@basic-pci-d3-state.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/fi-hsw-4770/igt@i915_pm_rpm@basic-pci-d3-state.html

  
  {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#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109964]: https://bugs.freedesktop.org/show_bug.cgi?id=109964
  [fdo#110343]: https://bugs.freedesktop.org/show_bug.cgi?id=110343
  [fdo#112252]: https://bugs.freedesktop.org/show_bug.cgi?id=112252


Participating hosts (52 -> 46)
------------------------------

  Additional (1): fi-gdg-551 
  Missing    (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-elk-e7500 fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7316 -> Patchwork_15233

  CI-20190529: 20190529
  CI_DRM_7316: a4939708275196364ef98691a90c89d501536494 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5272: 5997df31db10f190fe8b70d920b6a6b8d3b24126 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15233: efbbfb869fdb414f8319186ab87b5c53f0cb7447 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

efbbfb869fdb drm/i915: Flush all user surfaces prior to first use

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15233/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH] drm/i915: Flush all user surfaces prior to first use
  2019-11-12 13:54 [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
  2019-11-12 13:54 ` [Intel-gfx] " Chris Wilson
  2019-11-12 15:12 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev3) Patchwork
@ 2019-11-12 15:20 ` Chris Wilson
  2019-11-12 15:20   ` [Intel-gfx] " Chris Wilson
  2019-11-12 20:30 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev4) Patchwork
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2019-11-12 15:20 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

Since userspace has the ability to bypass the CPU cache from within its
unprivileged command stream, we have to flush the CPU cache to memory
in order to overwrite the previous contents on creation. We enforce this
at the boundary points (get/put pages) to ensure that before recycling
system pages we are always cache coherent.

v3: We now always clflush on acquisition and release of system pages,
and include a clflush counting selftest to make sure we do. This also
succinctly covers swap-in/swap-out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   8 ++
 drivers/gpu/drm/i915/gem/i915_gem_clflush.h   |   6 +
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     |   7 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  22 +++-
 .../i915/gem/selftests/i915_gem_coherency.c   | 113 ++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h               |   2 +
 6 files changed, 153 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
index b9f504ba3b32..e2434e17ffc1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
@@ -16,11 +16,19 @@ struct clflush {
 	struct drm_i915_gem_object *obj;
 };
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj)
+{
+	atomic_inc(&to_i915(obj->base.dev)->gem.clflushes);
+}
+#endif
+
 static void __do_clflush(struct drm_i915_gem_object *obj)
 {
 	GEM_BUG_ON(!i915_gem_object_has_pages(obj));
 	drm_clflush_sg(obj->mm.pages);
 	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
+	st_clflush_inc(obj);
 }
 
 static int clflush_work(struct dma_fence_work *base)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
index e6c382973129..7434d878a553 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
@@ -17,4 +17,10 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
 #define I915_CLFLUSH_FORCE BIT(0)
 #define I915_CLFLUSH_SYNC BIT(1)
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj);
+#else
+static inline void st_clflush_inc(struct drm_i915_gem_object *obj) { }
+#endif
+
 #endif /* __I915_GEM_CLFLUSH_H__ */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index f402c2c415c2..8bcf9b65d661 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -5,9 +5,10 @@
  */
 
 #include "i915_drv.h"
+#include "i915_gem_clflush.h"
+#include "i915_gem_lmem.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
-#include "i915_gem_lmem.h"
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 				 struct sg_table *pages,
@@ -25,8 +26,10 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 	/* Make the pages coherent with the GPU (flushing any swapin). */
 	if (obj->cache_dirty) {
 		obj->write_domain = 0;
-		if (i915_gem_object_has_struct_page(obj))
+		if (i915_gem_object_has_struct_page(obj)) {
 			drm_clflush_sg(pages);
+			st_clflush_inc(obj);
+		}
 		obj->cache_dirty = false;
 	}
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index 4d69c3fc3439..9db53a4d1b2e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -10,6 +10,7 @@
 #include "gem/i915_gem_region.h"
 #include "i915_drv.h"
 #include "i915_gemfs.h"
+#include "i915_gem_clflush.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 #include "i915_trace.h"
@@ -183,6 +184,15 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj, st);
 
+	/*
+	 * Since userspace has the ability to bypass the CPU cache from within
+	 * its unprivileged command stream, we have to flush the CPU cache to
+	 * memory in order to overwrite the previous contents on creation, so
+	 * that userspace cannot snoop on the old system pages just handed to
+	 * us.
+	 */
+	obj->cache_dirty = true; /* For drm_clflush_sg() inside set_pages */
+
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -285,10 +295,16 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 	if (obj->mm.madv == I915_MADV_DONTNEED)
 		obj->mm.dirty = false;
 
-	if (needs_clflush &&
-	    (obj->read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
-	    !(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ))
+	/*
+	 * Unless we know for certain that the main memory contents are
+	 * coherent with the CPU cache, flush the CPU cache. This ensures
+	 * that userspace that has bypassed the CPU cache to write into
+	 * main memory does not leak the contents of its CPU cache.
+	 */
+	if (obj->write_domain != I915_GEM_DOMAIN_CPU) {
 		drm_clflush_sg(pages);
+		st_clflush_inc(obj);
+	}
 
 	__start_cpu_write(obj);
 }
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
index 2b29f6b4e1dd..d7607fea6ce2 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
@@ -6,6 +6,8 @@
 
 #include <linux/prime_numbers.h>
 
+#include "gem/i915_gem_clflush.h"
+#include "gem/i915_gem_object.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_ring.h"
@@ -297,6 +299,116 @@ random_engine(struct drm_i915_private *i915, struct rnd_state *prng)
 	return NULL;
 }
 
+static int checked_clflush(struct drm_i915_gem_object *obj,
+			   unsigned int flags,
+			   int expected)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int clflushes = atomic_read(&i915->gem.clflushes);
+	int err = 0;
+
+	i915_gem_object_lock(obj);
+
+	i915_gem_clflush_object(obj, flags);
+
+	if (obj->cache_dirty) {
+		pr_err("clflush did not clear obj->cache_dirty!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+	if (atomic_read(&i915->gem.clflushes) != clflushes + expected) {
+		pr_err("clflush counter did not match!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+unlock:
+	i915_gem_object_unlock(obj);
+	return err;
+}
+
+static int igt_gem_clflush(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj;
+	unsigned int clflushes;
+	int err = 0;
+
+	/*
+	 * Before the data is visible to the GPU, we sometimes have to
+	 * flush the CPU cache. For example, only with the introduction
+	 * of LLC with Sandybride could the GPU and CPU caches be fully
+	 * coherent. However, the display engine (scanout) has different
+	 * coherency with the GPU then the CPU, and even if the CPU/GPU
+	 * could talk to each other we would still need to flush the CPU
+	 * caches for scanout. Finally, userspace can bypass the cache
+	 * snooping altogether from inside its unprivileged batch bufers.
+	 *
+	 * We use drm_clflush_*() to clear the CPU cachelines on such
+	 * transitions, so we can assert that we will do so by setting
+	 * up the dirty state and looking at our clflush counter
+	 */
+
+	/*
+	 * Creating a shmem object from system pages, we must assume
+	 * the CPU cache is dirty. That is the main memory can have
+	 * different (stale) content than the CPU, as the kernel
+	 * expects all reads to come from the CPU cache. As we know the GPU
+	 * may ignore the CPU cache and read from memory instead, we must
+	 * assume the worst.
+	 */
+	obj = i915_gem_object_create_shmem(i915, 4096);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	/* We always clflush on acquisition of the backing storage */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto err;
+
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("no clflush recorded for page acquisition\n");
+		err = -EINVAL;
+		goto err;
+	}
+	if (obj->cache_dirty) {
+		pr_err("fresh pages, but CPU cache is dirty!\n");
+		err = -EINVAL;
+		goto err;
+	}
+
+	/* An _unforced_ clflush is ignored */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC, 0);
+	if (err) {
+		pr_err("redundant clflush failed!\n");
+		goto err;
+	}
+
+	/* But a _forced_ clflush is obeyed, even if we think its clean */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE, 1);
+	if (err) {
+		pr_err("forced clflush failed!\n");
+		goto err;
+	}
+
+	/* Releasing a shmem object must flush (in case of user bypass) */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("clflush not recorded for releasing dirty uncached object\n");
+		err = -EINVAL;
+	}
+
+	goto out;
+err:
+	i915_gem_object_put(obj);
+out:
+	return err;
+}
+
 static int igt_gem_coherency(void *arg)
 {
 	const unsigned int ncachelines = PAGE_SIZE/64;
@@ -415,6 +527,7 @@ static int igt_gem_coherency(void *arg)
 int i915_gem_coherency_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
+		SUBTEST(igt_gem_clflush),
 		SUBTEST(igt_gem_coherency),
 	};
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b82ff0bc6d0c..5f8bd1d54c59 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1259,6 +1259,8 @@ struct drm_i915_private {
 			struct llist_head free_list;
 			struct work_struct free_work;
 		} contexts;
+
+		I915_SELFTEST_DECLARE(atomic_t clflushes;)
 	} gem;
 
 	u8 pch_ssc_use;
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [Intel-gfx] [PATCH] drm/i915: Flush all user surfaces prior to first use
  2019-11-12 15:20 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
@ 2019-11-12 15:20   ` Chris Wilson
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2019-11-12 15:20 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

Since userspace has the ability to bypass the CPU cache from within its
unprivileged command stream, we have to flush the CPU cache to memory
in order to overwrite the previous contents on creation. We enforce this
at the boundary points (get/put pages) to ensure that before recycling
system pages we are always cache coherent.

v3: We now always clflush on acquisition and release of system pages,
and include a clflush counting selftest to make sure we do. This also
succinctly covers swap-in/swap-out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   8 ++
 drivers/gpu/drm/i915/gem/i915_gem_clflush.h   |   6 +
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     |   7 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  22 +++-
 .../i915/gem/selftests/i915_gem_coherency.c   | 113 ++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h               |   2 +
 6 files changed, 153 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
index b9f504ba3b32..e2434e17ffc1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
@@ -16,11 +16,19 @@ struct clflush {
 	struct drm_i915_gem_object *obj;
 };
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj)
+{
+	atomic_inc(&to_i915(obj->base.dev)->gem.clflushes);
+}
+#endif
+
 static void __do_clflush(struct drm_i915_gem_object *obj)
 {
 	GEM_BUG_ON(!i915_gem_object_has_pages(obj));
 	drm_clflush_sg(obj->mm.pages);
 	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
+	st_clflush_inc(obj);
 }
 
 static int clflush_work(struct dma_fence_work *base)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
index e6c382973129..7434d878a553 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
@@ -17,4 +17,10 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
 #define I915_CLFLUSH_FORCE BIT(0)
 #define I915_CLFLUSH_SYNC BIT(1)
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj);
+#else
+static inline void st_clflush_inc(struct drm_i915_gem_object *obj) { }
+#endif
+
 #endif /* __I915_GEM_CLFLUSH_H__ */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index f402c2c415c2..8bcf9b65d661 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -5,9 +5,10 @@
  */
 
 #include "i915_drv.h"
+#include "i915_gem_clflush.h"
+#include "i915_gem_lmem.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
-#include "i915_gem_lmem.h"
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 				 struct sg_table *pages,
@@ -25,8 +26,10 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 	/* Make the pages coherent with the GPU (flushing any swapin). */
 	if (obj->cache_dirty) {
 		obj->write_domain = 0;
-		if (i915_gem_object_has_struct_page(obj))
+		if (i915_gem_object_has_struct_page(obj)) {
 			drm_clflush_sg(pages);
+			st_clflush_inc(obj);
+		}
 		obj->cache_dirty = false;
 	}
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index 4d69c3fc3439..9db53a4d1b2e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -10,6 +10,7 @@
 #include "gem/i915_gem_region.h"
 #include "i915_drv.h"
 #include "i915_gemfs.h"
+#include "i915_gem_clflush.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 #include "i915_trace.h"
@@ -183,6 +184,15 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj, st);
 
+	/*
+	 * Since userspace has the ability to bypass the CPU cache from within
+	 * its unprivileged command stream, we have to flush the CPU cache to
+	 * memory in order to overwrite the previous contents on creation, so
+	 * that userspace cannot snoop on the old system pages just handed to
+	 * us.
+	 */
+	obj->cache_dirty = true; /* For drm_clflush_sg() inside set_pages */
+
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -285,10 +295,16 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 	if (obj->mm.madv == I915_MADV_DONTNEED)
 		obj->mm.dirty = false;
 
-	if (needs_clflush &&
-	    (obj->read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
-	    !(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ))
+	/*
+	 * Unless we know for certain that the main memory contents are
+	 * coherent with the CPU cache, flush the CPU cache. This ensures
+	 * that userspace that has bypassed the CPU cache to write into
+	 * main memory does not leak the contents of its CPU cache.
+	 */
+	if (obj->write_domain != I915_GEM_DOMAIN_CPU) {
 		drm_clflush_sg(pages);
+		st_clflush_inc(obj);
+	}
 
 	__start_cpu_write(obj);
 }
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
index 2b29f6b4e1dd..d7607fea6ce2 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
@@ -6,6 +6,8 @@
 
 #include <linux/prime_numbers.h>
 
+#include "gem/i915_gem_clflush.h"
+#include "gem/i915_gem_object.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_ring.h"
@@ -297,6 +299,116 @@ random_engine(struct drm_i915_private *i915, struct rnd_state *prng)
 	return NULL;
 }
 
+static int checked_clflush(struct drm_i915_gem_object *obj,
+			   unsigned int flags,
+			   int expected)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int clflushes = atomic_read(&i915->gem.clflushes);
+	int err = 0;
+
+	i915_gem_object_lock(obj);
+
+	i915_gem_clflush_object(obj, flags);
+
+	if (obj->cache_dirty) {
+		pr_err("clflush did not clear obj->cache_dirty!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+	if (atomic_read(&i915->gem.clflushes) != clflushes + expected) {
+		pr_err("clflush counter did not match!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+unlock:
+	i915_gem_object_unlock(obj);
+	return err;
+}
+
+static int igt_gem_clflush(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj;
+	unsigned int clflushes;
+	int err = 0;
+
+	/*
+	 * Before the data is visible to the GPU, we sometimes have to
+	 * flush the CPU cache. For example, only with the introduction
+	 * of LLC with Sandybride could the GPU and CPU caches be fully
+	 * coherent. However, the display engine (scanout) has different
+	 * coherency with the GPU then the CPU, and even if the CPU/GPU
+	 * could talk to each other we would still need to flush the CPU
+	 * caches for scanout. Finally, userspace can bypass the cache
+	 * snooping altogether from inside its unprivileged batch bufers.
+	 *
+	 * We use drm_clflush_*() to clear the CPU cachelines on such
+	 * transitions, so we can assert that we will do so by setting
+	 * up the dirty state and looking at our clflush counter
+	 */
+
+	/*
+	 * Creating a shmem object from system pages, we must assume
+	 * the CPU cache is dirty. That is the main memory can have
+	 * different (stale) content than the CPU, as the kernel
+	 * expects all reads to come from the CPU cache. As we know the GPU
+	 * may ignore the CPU cache and read from memory instead, we must
+	 * assume the worst.
+	 */
+	obj = i915_gem_object_create_shmem(i915, 4096);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	/* We always clflush on acquisition of the backing storage */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto err;
+
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("no clflush recorded for page acquisition\n");
+		err = -EINVAL;
+		goto err;
+	}
+	if (obj->cache_dirty) {
+		pr_err("fresh pages, but CPU cache is dirty!\n");
+		err = -EINVAL;
+		goto err;
+	}
+
+	/* An _unforced_ clflush is ignored */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC, 0);
+	if (err) {
+		pr_err("redundant clflush failed!\n");
+		goto err;
+	}
+
+	/* But a _forced_ clflush is obeyed, even if we think its clean */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE, 1);
+	if (err) {
+		pr_err("forced clflush failed!\n");
+		goto err;
+	}
+
+	/* Releasing a shmem object must flush (in case of user bypass) */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("clflush not recorded for releasing dirty uncached object\n");
+		err = -EINVAL;
+	}
+
+	goto out;
+err:
+	i915_gem_object_put(obj);
+out:
+	return err;
+}
+
 static int igt_gem_coherency(void *arg)
 {
 	const unsigned int ncachelines = PAGE_SIZE/64;
@@ -415,6 +527,7 @@ static int igt_gem_coherency(void *arg)
 int i915_gem_coherency_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
+		SUBTEST(igt_gem_clflush),
 		SUBTEST(igt_gem_coherency),
 	};
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b82ff0bc6d0c..5f8bd1d54c59 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1259,6 +1259,8 @@ struct drm_i915_private {
 			struct llist_head free_list;
 			struct work_struct free_work;
 		} contexts;
+
+		I915_SELFTEST_DECLARE(atomic_t clflushes;)
 	} gem;
 
 	u8 pch_ssc_use;
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev4)
  2019-11-12 13:54 [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
                   ` (2 preceding siblings ...)
  2019-11-12 15:20 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
@ 2019-11-12 20:30 ` Patchwork
  2019-11-12 20:30   ` [Intel-gfx] " Patchwork
  2019-11-12 20:38 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
  2019-11-12 22:57 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev5) Patchwork
  5 siblings, 1 reply; 12+ messages in thread
From: Patchwork @ 2019-11-12 20:30 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Flush all user surfaces prior to first use (rev4)
URL   : https://patchwork.freedesktop.org/series/63871/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7322 -> Patchwork_15238
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15238 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15238, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@gem_ctx_switch@rcs0:
    - fi-icl-dsi:         [PASS][1] -> [DMESG-WARN][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-icl-dsi/igt@gem_ctx_switch@rcs0.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-icl-dsi/igt@gem_ctx_switch@rcs0.html

  * igt@i915_selftest@live_coherency:
    - fi-byt-n2820:       [PASS][3] -> [DMESG-FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-byt-n2820/igt@i915_selftest@live_coherency.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-byt-n2820/igt@i915_selftest@live_coherency.html
    - fi-elk-e7500:       [PASS][5] -> [DMESG-FAIL][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-elk-e7500/igt@i915_selftest@live_coherency.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-elk-e7500/igt@i915_selftest@live_coherency.html
    - fi-bwr-2160:        [PASS][7] -> [DMESG-FAIL][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bwr-2160/igt@i915_selftest@live_coherency.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bwr-2160/igt@i915_selftest@live_coherency.html
    - fi-bsw-nick:        [PASS][9] -> [DMESG-FAIL][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bsw-nick/igt@i915_selftest@live_coherency.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bsw-nick/igt@i915_selftest@live_coherency.html
    - fi-bxt-dsi:         [PASS][11] -> [DMESG-FAIL][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
    - fi-gdg-551:         [PASS][13] -> [DMESG-FAIL][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-gdg-551/igt@i915_selftest@live_coherency.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-gdg-551/igt@i915_selftest@live_coherency.html
    - fi-ilk-650:         [PASS][15] -> [DMESG-FAIL][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-ilk-650/igt@i915_selftest@live_coherency.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-ilk-650/igt@i915_selftest@live_coherency.html
    - fi-bsw-n3050:       [PASS][17] -> [DMESG-FAIL][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
    - fi-glk-dsi:         [PASS][19] -> [DMESG-FAIL][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-glk-dsi/igt@i915_selftest@live_coherency.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-glk-dsi/igt@i915_selftest@live_coherency.html
    - fi-bsw-kefka:       [PASS][21] -> [DMESG-FAIL][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
    - fi-blb-e6850:       [PASS][23] -> [DMESG-FAIL][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-blb-e6850/igt@i915_selftest@live_coherency.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-blb-e6850/igt@i915_selftest@live_coherency.html
    - fi-apl-guc:         [PASS][25] -> [DMESG-FAIL][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-apl-guc/igt@i915_selftest@live_coherency.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-apl-guc/igt@i915_selftest@live_coherency.html
    - fi-pnv-d510:        [PASS][27] -> [DMESG-FAIL][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-pnv-d510/igt@i915_selftest@live_coherency.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-pnv-d510/igt@i915_selftest@live_coherency.html
    - fi-byt-j1900:       [PASS][29] -> [DMESG-FAIL][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-byt-j1900/igt@i915_selftest@live_coherency.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-byt-j1900/igt@i915_selftest@live_coherency.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@kms_chamelium@dp-crc-fast:
    - fi-kbl-7500u:       [PASS][31] -> [FAIL][32] ([fdo#109483] / [fdo#109635 ])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-icl-u2:          [PASS][33] -> [FAIL][34] ([fdo#109483])
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html
    - fi-kbl-7500u:       [PASS][35] -> [FAIL][36] ([fdo#111045] / [fdo#111096])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_flip@basic-flip-vs-wf_vblank:
    - fi-skl-6770hq:      [PASS][37] -> [DMESG-WARN][38] ([fdo#105541])
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-lmem:        [DMESG-WARN][39] -> [PASS][40]
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html

  * igt@kms_busy@basic-flip-pipe-b:
    - fi-skl-6770hq:      [DMESG-WARN][41] ([fdo#105541]) -> [PASS][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-skl-6770hq/igt@kms_busy@basic-flip-pipe-b.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-skl-6770hq/igt@kms_busy@basic-flip-pipe-b.html

  
#### Warnings ####

  * igt@kms_chamelium@common-hpd-after-suspend:
    - fi-icl-u2:          [DMESG-WARN][43] ([fdo#102505] / [fdo#110390]) -> [FAIL][44] ([fdo#109483])
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-icl-u2/igt@kms_chamelium@common-hpd-after-suspend.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-icl-u2/igt@kms_chamelium@common-hpd-after-suspend.html

  
  {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#105541]: https://bugs.freedesktop.org/show_bug.cgi?id=105541
  [fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
  [fdo#109635 ]: https://bugs.freedesktop.org/show_bug.cgi?id=109635 
  [fdo#110343]: https://bugs.freedesktop.org/show_bug.cgi?id=110343
  [fdo#110390]: https://bugs.freedesktop.org/show_bug.cgi?id=110390
  [fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
  [fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096


Participating hosts (51 -> 46)
------------------------------

  Additional (1): fi-hsw-4770r 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7322 -> Patchwork_15238

  CI-20190529: 20190529
  CI_DRM_7322: e801d42a3dbfd524896ab2e7f9904ad6ce413cfe @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5273: 602003c3d751c72fc309a0e64d4193f6da720f6b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15238: 0f124433d6a57cbfe6cd0595a51017411a23146f @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

0f124433d6a5 drm/i915: Flush all user surfaces prior to first use

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev4)
  2019-11-12 20:30 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev4) Patchwork
@ 2019-11-12 20:30   ` Patchwork
  0 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2019-11-12 20:30 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Flush all user surfaces prior to first use (rev4)
URL   : https://patchwork.freedesktop.org/series/63871/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7322 -> Patchwork_15238
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15238 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15238, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@gem_ctx_switch@rcs0:
    - fi-icl-dsi:         [PASS][1] -> [DMESG-WARN][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-icl-dsi/igt@gem_ctx_switch@rcs0.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-icl-dsi/igt@gem_ctx_switch@rcs0.html

  * igt@i915_selftest@live_coherency:
    - fi-byt-n2820:       [PASS][3] -> [DMESG-FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-byt-n2820/igt@i915_selftest@live_coherency.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-byt-n2820/igt@i915_selftest@live_coherency.html
    - fi-elk-e7500:       [PASS][5] -> [DMESG-FAIL][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-elk-e7500/igt@i915_selftest@live_coherency.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-elk-e7500/igt@i915_selftest@live_coherency.html
    - fi-bwr-2160:        [PASS][7] -> [DMESG-FAIL][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bwr-2160/igt@i915_selftest@live_coherency.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bwr-2160/igt@i915_selftest@live_coherency.html
    - fi-bsw-nick:        [PASS][9] -> [DMESG-FAIL][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bsw-nick/igt@i915_selftest@live_coherency.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bsw-nick/igt@i915_selftest@live_coherency.html
    - fi-bxt-dsi:         [PASS][11] -> [DMESG-FAIL][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bxt-dsi/igt@i915_selftest@live_coherency.html
    - fi-gdg-551:         [PASS][13] -> [DMESG-FAIL][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-gdg-551/igt@i915_selftest@live_coherency.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-gdg-551/igt@i915_selftest@live_coherency.html
    - fi-ilk-650:         [PASS][15] -> [DMESG-FAIL][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-ilk-650/igt@i915_selftest@live_coherency.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-ilk-650/igt@i915_selftest@live_coherency.html
    - fi-bsw-n3050:       [PASS][17] -> [DMESG-FAIL][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bsw-n3050/igt@i915_selftest@live_coherency.html
    - fi-glk-dsi:         [PASS][19] -> [DMESG-FAIL][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-glk-dsi/igt@i915_selftest@live_coherency.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-glk-dsi/igt@i915_selftest@live_coherency.html
    - fi-bsw-kefka:       [PASS][21] -> [DMESG-FAIL][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-bsw-kefka/igt@i915_selftest@live_coherency.html
    - fi-blb-e6850:       [PASS][23] -> [DMESG-FAIL][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-blb-e6850/igt@i915_selftest@live_coherency.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-blb-e6850/igt@i915_selftest@live_coherency.html
    - fi-apl-guc:         [PASS][25] -> [DMESG-FAIL][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-apl-guc/igt@i915_selftest@live_coherency.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-apl-guc/igt@i915_selftest@live_coherency.html
    - fi-pnv-d510:        [PASS][27] -> [DMESG-FAIL][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-pnv-d510/igt@i915_selftest@live_coherency.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-pnv-d510/igt@i915_selftest@live_coherency.html
    - fi-byt-j1900:       [PASS][29] -> [DMESG-FAIL][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-byt-j1900/igt@i915_selftest@live_coherency.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-byt-j1900/igt@i915_selftest@live_coherency.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@kms_chamelium@dp-crc-fast:
    - fi-kbl-7500u:       [PASS][31] -> [FAIL][32] ([fdo#109483] / [fdo#109635 ])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-icl-u2:          [PASS][33] -> [FAIL][34] ([fdo#109483])
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html
    - fi-kbl-7500u:       [PASS][35] -> [FAIL][36] ([fdo#111045] / [fdo#111096])
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_flip@basic-flip-vs-wf_vblank:
    - fi-skl-6770hq:      [PASS][37] -> [DMESG-WARN][38] ([fdo#105541])
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-lmem:        [DMESG-WARN][39] -> [PASS][40]
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html

  * igt@kms_busy@basic-flip-pipe-b:
    - fi-skl-6770hq:      [DMESG-WARN][41] ([fdo#105541]) -> [PASS][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-skl-6770hq/igt@kms_busy@basic-flip-pipe-b.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-skl-6770hq/igt@kms_busy@basic-flip-pipe-b.html

  
#### Warnings ####

  * igt@kms_chamelium@common-hpd-after-suspend:
    - fi-icl-u2:          [DMESG-WARN][43] ([fdo#102505] / [fdo#110390]) -> [FAIL][44] ([fdo#109483])
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7322/fi-icl-u2/igt@kms_chamelium@common-hpd-after-suspend.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/fi-icl-u2/igt@kms_chamelium@common-hpd-after-suspend.html

  
  {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#105541]: https://bugs.freedesktop.org/show_bug.cgi?id=105541
  [fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
  [fdo#109635 ]: https://bugs.freedesktop.org/show_bug.cgi?id=109635 
  [fdo#110343]: https://bugs.freedesktop.org/show_bug.cgi?id=110343
  [fdo#110390]: https://bugs.freedesktop.org/show_bug.cgi?id=110390
  [fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
  [fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096


Participating hosts (51 -> 46)
------------------------------

  Additional (1): fi-hsw-4770r 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7322 -> Patchwork_15238

  CI-20190529: 20190529
  CI_DRM_7322: e801d42a3dbfd524896ab2e7f9904ad6ce413cfe @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5273: 602003c3d751c72fc309a0e64d4193f6da720f6b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15238: 0f124433d6a57cbfe6cd0595a51017411a23146f @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

0f124433d6a5 drm/i915: Flush all user surfaces prior to first use

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15238/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH] drm/i915: Flush all user surfaces prior to first use
  2019-11-12 13:54 [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
                   ` (3 preceding siblings ...)
  2019-11-12 20:30 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev4) Patchwork
@ 2019-11-12 20:38 ` Chris Wilson
  2019-11-12 20:38   ` [Intel-gfx] " Chris Wilson
  2019-11-12 22:57 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev5) Patchwork
  5 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2019-11-12 20:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

Since userspace has the ability to bypass the CPU cache from within its
unprivileged command stream, we have to flush the CPU cache to memory
in order to overwrite the previous contents on creation. We enforce this
at the boundary points (get/put pages) to ensure that before recycling
system pages we are always cache coherent.

v3: We now always clflush on acquisition and release of system pages,
and include a clflush counting selftest to make sure we do. This also
succinctly covers swap-in/swap-out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
Remember the difference in clflush behaviour between llc and !llc.
---
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   8 ++
 drivers/gpu/drm/i915/gem/i915_gem_clflush.h   |   6 +
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     |   7 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  22 +++-
 .../i915/gem/selftests/i915_gem_coherency.c   | 113 ++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h               |   2 +
 6 files changed, 153 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
index b9f504ba3b32..e2434e17ffc1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
@@ -16,11 +16,19 @@ struct clflush {
 	struct drm_i915_gem_object *obj;
 };
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj)
+{
+	atomic_inc(&to_i915(obj->base.dev)->gem.clflushes);
+}
+#endif
+
 static void __do_clflush(struct drm_i915_gem_object *obj)
 {
 	GEM_BUG_ON(!i915_gem_object_has_pages(obj));
 	drm_clflush_sg(obj->mm.pages);
 	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
+	st_clflush_inc(obj);
 }
 
 static int clflush_work(struct dma_fence_work *base)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
index e6c382973129..7434d878a553 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
@@ -17,4 +17,10 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
 #define I915_CLFLUSH_FORCE BIT(0)
 #define I915_CLFLUSH_SYNC BIT(1)
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj);
+#else
+static inline void st_clflush_inc(struct drm_i915_gem_object *obj) { }
+#endif
+
 #endif /* __I915_GEM_CLFLUSH_H__ */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index f402c2c415c2..8bcf9b65d661 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -5,9 +5,10 @@
  */
 
 #include "i915_drv.h"
+#include "i915_gem_clflush.h"
+#include "i915_gem_lmem.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
-#include "i915_gem_lmem.h"
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 				 struct sg_table *pages,
@@ -25,8 +26,10 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 	/* Make the pages coherent with the GPU (flushing any swapin). */
 	if (obj->cache_dirty) {
 		obj->write_domain = 0;
-		if (i915_gem_object_has_struct_page(obj))
+		if (i915_gem_object_has_struct_page(obj)) {
 			drm_clflush_sg(pages);
+			st_clflush_inc(obj);
+		}
 		obj->cache_dirty = false;
 	}
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index 4d69c3fc3439..9db53a4d1b2e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -10,6 +10,7 @@
 #include "gem/i915_gem_region.h"
 #include "i915_drv.h"
 #include "i915_gemfs.h"
+#include "i915_gem_clflush.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 #include "i915_trace.h"
@@ -183,6 +184,15 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj, st);
 
+	/*
+	 * Since userspace has the ability to bypass the CPU cache from within
+	 * its unprivileged command stream, we have to flush the CPU cache to
+	 * memory in order to overwrite the previous contents on creation, so
+	 * that userspace cannot snoop on the old system pages just handed to
+	 * us.
+	 */
+	obj->cache_dirty = true; /* For drm_clflush_sg() inside set_pages */
+
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -285,10 +295,16 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 	if (obj->mm.madv == I915_MADV_DONTNEED)
 		obj->mm.dirty = false;
 
-	if (needs_clflush &&
-	    (obj->read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
-	    !(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ))
+	/*
+	 * Unless we know for certain that the main memory contents are
+	 * coherent with the CPU cache, flush the CPU cache. This ensures
+	 * that userspace that has bypassed the CPU cache to write into
+	 * main memory does not leak the contents of its CPU cache.
+	 */
+	if (obj->write_domain != I915_GEM_DOMAIN_CPU) {
 		drm_clflush_sg(pages);
+		st_clflush_inc(obj);
+	}
 
 	__start_cpu_write(obj);
 }
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
index 2b29f6b4e1dd..20c76a8f81fd 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
@@ -6,6 +6,8 @@
 
 #include <linux/prime_numbers.h>
 
+#include "gem/i915_gem_clflush.h"
+#include "gem/i915_gem_object.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_ring.h"
@@ -297,6 +299,116 @@ random_engine(struct drm_i915_private *i915, struct rnd_state *prng)
 	return NULL;
 }
 
+static int checked_clflush(struct drm_i915_gem_object *obj,
+			   unsigned int flags,
+			   int expected)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int clflushes = atomic_read(&i915->gem.clflushes);
+	int err = 0;
+
+	i915_gem_object_lock(obj);
+
+	i915_gem_clflush_object(obj, flags);
+
+	if (obj->cache_dirty) {
+		pr_err("clflush did not clear obj->cache_dirty!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+	if (atomic_read(&i915->gem.clflushes) != clflushes + expected) {
+		pr_err("clflush counter did not match!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+unlock:
+	i915_gem_object_unlock(obj);
+	return err;
+}
+
+static int igt_gem_clflush(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj;
+	unsigned int clflushes;
+	int err = 0;
+
+	/*
+	 * Before the data is visible to the GPU, we sometimes have to
+	 * flush the CPU cache. For example, only with the introduction
+	 * of LLC with Sandybride could the GPU and CPU caches be fully
+	 * coherent. However, the display engine (scanout) has different
+	 * coherency with the GPU then the CPU, and even if the CPU/GPU
+	 * could talk to each other we would still need to flush the CPU
+	 * caches for scanout. Finally, userspace can bypass the cache
+	 * snooping altogether from inside its unprivileged batch bufers.
+	 *
+	 * We use drm_clflush_*() to clear the CPU cachelines on such
+	 * transitions, so we can assert that we will do so by setting
+	 * up the dirty state and looking at our clflush counter
+	 */
+
+	/*
+	 * Creating a shmem object from system pages, we must assume
+	 * the CPU cache is dirty. That is the main memory can have
+	 * different (stale) content than the CPU, as the kernel
+	 * expects all reads to come from the CPU cache. As we know the GPU
+	 * may ignore the CPU cache and read from memory instead, we must
+	 * assume the worst.
+	 */
+	obj = i915_gem_object_create_shmem(i915, 4096);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	/* We always clflush on acquisition of the backing storage */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto err;
+
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("no clflush recorded for page acquisition\n");
+		err = -EINVAL;
+		goto err;
+	}
+	if (obj->cache_dirty) {
+		pr_err("fresh pages, but CPU cache is dirty!\n");
+		err = -EINVAL;
+		goto err;
+	}
+
+	/* An _unforced_ clflush is ignored on llc */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC, !HAS_LLC(i915));
+	if (err) {
+		pr_err("redundant clflush failed!\n");
+		goto err;
+	}
+
+	/* But a _forced_ clflush is obeyed, even if we think its clean */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE, 1);
+	if (err) {
+		pr_err("forced clflush failed!\n");
+		goto err;
+	}
+
+	/* Releasing a shmem object must flush (in case of user bypass) */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("clflush not recorded for releasing dirty uncached object\n");
+		err = -EINVAL;
+	}
+
+	goto out;
+err:
+	i915_gem_object_put(obj);
+out:
+	return err;
+}
+
 static int igt_gem_coherency(void *arg)
 {
 	const unsigned int ncachelines = PAGE_SIZE/64;
@@ -415,6 +527,7 @@ static int igt_gem_coherency(void *arg)
 int i915_gem_coherency_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
+		SUBTEST(igt_gem_clflush),
 		SUBTEST(igt_gem_coherency),
 	};
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 50809ffdc6b2..0ebd43b79813 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1254,6 +1254,8 @@ struct drm_i915_private {
 			struct llist_head free_list;
 			struct work_struct free_work;
 		} contexts;
+
+		I915_SELFTEST_DECLARE(atomic_t clflushes;)
 	} gem;
 
 	u8 pch_ssc_use;
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [Intel-gfx] [PATCH] drm/i915: Flush all user surfaces prior to first use
  2019-11-12 20:38 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
@ 2019-11-12 20:38   ` Chris Wilson
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2019-11-12 20:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

Since userspace has the ability to bypass the CPU cache from within its
unprivileged command stream, we have to flush the CPU cache to memory
in order to overwrite the previous contents on creation. We enforce this
at the boundary points (get/put pages) to ensure that before recycling
system pages we are always cache coherent.

v3: We now always clflush on acquisition and release of system pages,
and include a clflush counting selftest to make sure we do. This also
succinctly covers swap-in/swap-out.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
Remember the difference in clflush behaviour between llc and !llc.
---
 drivers/gpu/drm/i915/gem/i915_gem_clflush.c   |   8 ++
 drivers/gpu/drm/i915/gem/i915_gem_clflush.h   |   6 +
 drivers/gpu/drm/i915/gem/i915_gem_pages.c     |   7 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c     |  22 +++-
 .../i915/gem/selftests/i915_gem_coherency.c   | 113 ++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h               |   2 +
 6 files changed, 153 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
index b9f504ba3b32..e2434e17ffc1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c
@@ -16,11 +16,19 @@ struct clflush {
 	struct drm_i915_gem_object *obj;
 };
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj)
+{
+	atomic_inc(&to_i915(obj->base.dev)->gem.clflushes);
+}
+#endif
+
 static void __do_clflush(struct drm_i915_gem_object *obj)
 {
 	GEM_BUG_ON(!i915_gem_object_has_pages(obj));
 	drm_clflush_sg(obj->mm.pages);
 	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_CPU);
+	st_clflush_inc(obj);
 }
 
 static int clflush_work(struct dma_fence_work *base)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
index e6c382973129..7434d878a553 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_clflush.h
@@ -17,4 +17,10 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
 #define I915_CLFLUSH_FORCE BIT(0)
 #define I915_CLFLUSH_SYNC BIT(1)
 
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+void st_clflush_inc(struct drm_i915_gem_object *obj);
+#else
+static inline void st_clflush_inc(struct drm_i915_gem_object *obj) { }
+#endif
+
 #endif /* __I915_GEM_CLFLUSH_H__ */
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index f402c2c415c2..8bcf9b65d661 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -5,9 +5,10 @@
  */
 
 #include "i915_drv.h"
+#include "i915_gem_clflush.h"
+#include "i915_gem_lmem.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
-#include "i915_gem_lmem.h"
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 				 struct sg_table *pages,
@@ -25,8 +26,10 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 	/* Make the pages coherent with the GPU (flushing any swapin). */
 	if (obj->cache_dirty) {
 		obj->write_domain = 0;
-		if (i915_gem_object_has_struct_page(obj))
+		if (i915_gem_object_has_struct_page(obj)) {
 			drm_clflush_sg(pages);
+			st_clflush_inc(obj);
+		}
 		obj->cache_dirty = false;
 	}
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
index 4d69c3fc3439..9db53a4d1b2e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
@@ -10,6 +10,7 @@
 #include "gem/i915_gem_region.h"
 #include "i915_drv.h"
 #include "i915_gemfs.h"
+#include "i915_gem_clflush.h"
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 #include "i915_trace.h"
@@ -183,6 +184,15 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj, st);
 
+	/*
+	 * Since userspace has the ability to bypass the CPU cache from within
+	 * its unprivileged command stream, we have to flush the CPU cache to
+	 * memory in order to overwrite the previous contents on creation, so
+	 * that userspace cannot snoop on the old system pages just handed to
+	 * us.
+	 */
+	obj->cache_dirty = true; /* For drm_clflush_sg() inside set_pages */
+
 	__i915_gem_object_set_pages(obj, st, sg_page_sizes);
 
 	return 0;
@@ -285,10 +295,16 @@ __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 	if (obj->mm.madv == I915_MADV_DONTNEED)
 		obj->mm.dirty = false;
 
-	if (needs_clflush &&
-	    (obj->read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
-	    !(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ))
+	/*
+	 * Unless we know for certain that the main memory contents are
+	 * coherent with the CPU cache, flush the CPU cache. This ensures
+	 * that userspace that has bypassed the CPU cache to write into
+	 * main memory does not leak the contents of its CPU cache.
+	 */
+	if (obj->write_domain != I915_GEM_DOMAIN_CPU) {
 		drm_clflush_sg(pages);
+		st_clflush_inc(obj);
+	}
 
 	__start_cpu_write(obj);
 }
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
index 2b29f6b4e1dd..20c76a8f81fd 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c
@@ -6,6 +6,8 @@
 
 #include <linux/prime_numbers.h>
 
+#include "gem/i915_gem_clflush.h"
+#include "gem/i915_gem_object.h"
 #include "gt/intel_gt.h"
 #include "gt/intel_gt_pm.h"
 #include "gt/intel_ring.h"
@@ -297,6 +299,116 @@ random_engine(struct drm_i915_private *i915, struct rnd_state *prng)
 	return NULL;
 }
 
+static int checked_clflush(struct drm_i915_gem_object *obj,
+			   unsigned int flags,
+			   int expected)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int clflushes = atomic_read(&i915->gem.clflushes);
+	int err = 0;
+
+	i915_gem_object_lock(obj);
+
+	i915_gem_clflush_object(obj, flags);
+
+	if (obj->cache_dirty) {
+		pr_err("clflush did not clear obj->cache_dirty!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+	if (atomic_read(&i915->gem.clflushes) != clflushes + expected) {
+		pr_err("clflush counter did not match!\n");
+		err = -EINVAL;
+		goto unlock;
+	}
+
+unlock:
+	i915_gem_object_unlock(obj);
+	return err;
+}
+
+static int igt_gem_clflush(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj;
+	unsigned int clflushes;
+	int err = 0;
+
+	/*
+	 * Before the data is visible to the GPU, we sometimes have to
+	 * flush the CPU cache. For example, only with the introduction
+	 * of LLC with Sandybride could the GPU and CPU caches be fully
+	 * coherent. However, the display engine (scanout) has different
+	 * coherency with the GPU then the CPU, and even if the CPU/GPU
+	 * could talk to each other we would still need to flush the CPU
+	 * caches for scanout. Finally, userspace can bypass the cache
+	 * snooping altogether from inside its unprivileged batch bufers.
+	 *
+	 * We use drm_clflush_*() to clear the CPU cachelines on such
+	 * transitions, so we can assert that we will do so by setting
+	 * up the dirty state and looking at our clflush counter
+	 */
+
+	/*
+	 * Creating a shmem object from system pages, we must assume
+	 * the CPU cache is dirty. That is the main memory can have
+	 * different (stale) content than the CPU, as the kernel
+	 * expects all reads to come from the CPU cache. As we know the GPU
+	 * may ignore the CPU cache and read from memory instead, we must
+	 * assume the worst.
+	 */
+	obj = i915_gem_object_create_shmem(i915, 4096);
+	if (IS_ERR(obj))
+		return PTR_ERR(obj);
+
+	/* We always clflush on acquisition of the backing storage */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	err = i915_gem_object_pin_pages(obj);
+	if (err)
+		goto err;
+
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("no clflush recorded for page acquisition\n");
+		err = -EINVAL;
+		goto err;
+	}
+	if (obj->cache_dirty) {
+		pr_err("fresh pages, but CPU cache is dirty!\n");
+		err = -EINVAL;
+		goto err;
+	}
+
+	/* An _unforced_ clflush is ignored on llc */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC, !HAS_LLC(i915));
+	if (err) {
+		pr_err("redundant clflush failed!\n");
+		goto err;
+	}
+
+	/* But a _forced_ clflush is obeyed, even if we think its clean */
+	err = checked_clflush(obj, I915_CLFLUSH_SYNC | I915_CLFLUSH_FORCE, 1);
+	if (err) {
+		pr_err("forced clflush failed!\n");
+		goto err;
+	}
+
+	/* Releasing a shmem object must flush (in case of user bypass) */
+	clflushes = atomic_read(&i915->gem.clflushes);
+	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
+	if (atomic_read(&i915->gem.clflushes) == clflushes) {
+		pr_err("clflush not recorded for releasing dirty uncached object\n");
+		err = -EINVAL;
+	}
+
+	goto out;
+err:
+	i915_gem_object_put(obj);
+out:
+	return err;
+}
+
 static int igt_gem_coherency(void *arg)
 {
 	const unsigned int ncachelines = PAGE_SIZE/64;
@@ -415,6 +527,7 @@ static int igt_gem_coherency(void *arg)
 int i915_gem_coherency_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
+		SUBTEST(igt_gem_clflush),
 		SUBTEST(igt_gem_coherency),
 	};
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 50809ffdc6b2..0ebd43b79813 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1254,6 +1254,8 @@ struct drm_i915_private {
 			struct llist_head free_list;
 			struct work_struct free_work;
 		} contexts;
+
+		I915_SELFTEST_DECLARE(atomic_t clflushes;)
 	} gem;
 
 	u8 pch_ssc_use;
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev5)
  2019-11-12 13:54 [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
                   ` (4 preceding siblings ...)
  2019-11-12 20:38 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
@ 2019-11-12 22:57 ` Patchwork
  2019-11-12 22:57   ` [Intel-gfx] " Patchwork
  5 siblings, 1 reply; 12+ messages in thread
From: Patchwork @ 2019-11-12 22:57 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Flush all user surfaces prior to first use (rev5)
URL   : https://patchwork.freedesktop.org/series/63871/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7323 -> Patchwork_15242
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15242 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15242, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-lmem:        [PASS][1] -> [DMESG-WARN][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@kms_setmode@basic-clone-single-crtc:
    - fi-skl-6770hq:      [PASS][3] -> [WARN][4] ([fdo#112252])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html

  
#### Possible fixes ####

  * igt@gem_mmap_gtt@basic-copy:
    - fi-glk-dsi:         [INCOMPLETE][5] ([fdo#103359] / [k.org#198133]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-glk-dsi/igt@gem_mmap_gtt@basic-copy.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-glk-dsi/igt@gem_mmap_gtt@basic-copy.html

  * igt@i915_module_load@reload-with-fault-injection:
    - {fi-kbl-7560u}:     [DMESG-WARN][7] -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-kbl-7560u/igt@i915_module_load@reload-with-fault-injection.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-kbl-7560u/igt@i915_module_load@reload-with-fault-injection.html

  * igt@kms_flip@basic-flip-vs-wf_vblank:
    - fi-skl-6770hq:      [DMESG-WARN][9] ([fdo#105541]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html

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

  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#105541]: https://bugs.freedesktop.org/show_bug.cgi?id=105541
  [fdo#112252]: https://bugs.freedesktop.org/show_bug.cgi?id=112252
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


Participating hosts (51 -> 45)
------------------------------

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-skl-6600u 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7323 -> Patchwork_15242

  CI-20190529: 20190529
  CI_DRM_7323: aac244f23bf1eaf986c5df9e529863b34e52bee8 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5273: 602003c3d751c72fc309a0e64d4193f6da720f6b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15242: 829ff143a5ba63f512dbf54193c62044e9ff09e7 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

829ff143a5ba drm/i915: Flush all user surfaces prior to first use

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev5)
  2019-11-12 22:57 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev5) Patchwork
@ 2019-11-12 22:57   ` Patchwork
  0 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2019-11-12 22:57 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Flush all user surfaces prior to first use (rev5)
URL   : https://patchwork.freedesktop.org/series/63871/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7323 -> Patchwork_15242
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_15242 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_15242, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/index.html

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@i915_pm_rpm@module-reload:
    - fi-skl-lmem:        [PASS][1] -> [DMESG-WARN][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-skl-lmem/igt@i915_pm_rpm@module-reload.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@kms_setmode@basic-clone-single-crtc:
    - fi-skl-6770hq:      [PASS][3] -> [WARN][4] ([fdo#112252])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-skl-6770hq/igt@kms_setmode@basic-clone-single-crtc.html

  
#### Possible fixes ####

  * igt@gem_mmap_gtt@basic-copy:
    - fi-glk-dsi:         [INCOMPLETE][5] ([fdo#103359] / [k.org#198133]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-glk-dsi/igt@gem_mmap_gtt@basic-copy.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-glk-dsi/igt@gem_mmap_gtt@basic-copy.html

  * igt@i915_module_load@reload-with-fault-injection:
    - {fi-kbl-7560u}:     [DMESG-WARN][7] -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-kbl-7560u/igt@i915_module_load@reload-with-fault-injection.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-kbl-7560u/igt@i915_module_load@reload-with-fault-injection.html

  * igt@kms_flip@basic-flip-vs-wf_vblank:
    - fi-skl-6770hq:      [DMESG-WARN][9] ([fdo#105541]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7323/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-wf_vblank.html

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

  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#105541]: https://bugs.freedesktop.org/show_bug.cgi?id=105541
  [fdo#112252]: https://bugs.freedesktop.org/show_bug.cgi?id=112252
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


Participating hosts (51 -> 45)
------------------------------

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-skl-6600u 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_7323 -> Patchwork_15242

  CI-20190529: 20190529
  CI_DRM_7323: aac244f23bf1eaf986c5df9e529863b34e52bee8 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5273: 602003c3d751c72fc309a0e64d4193f6da720f6b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_15242: 829ff143a5ba63f512dbf54193c62044e9ff09e7 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

829ff143a5ba drm/i915: Flush all user surfaces prior to first use

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15242/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2019-11-12 22:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 13:54 [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
2019-11-12 13:54 ` [Intel-gfx] " Chris Wilson
2019-11-12 15:12 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev3) Patchwork
2019-11-12 15:12   ` [Intel-gfx] " Patchwork
2019-11-12 15:20 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
2019-11-12 15:20   ` [Intel-gfx] " Chris Wilson
2019-11-12 20:30 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev4) Patchwork
2019-11-12 20:30   ` [Intel-gfx] " Patchwork
2019-11-12 20:38 ` [PATCH] drm/i915: Flush all user surfaces prior to first use Chris Wilson
2019-11-12 20:38   ` [Intel-gfx] " Chris Wilson
2019-11-12 22:57 ` ✗ Fi.CI.BAT: failure for drm/i915: Flush all user surfaces prior to first use (rev5) Patchwork
2019-11-12 22:57   ` [Intel-gfx] " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).