All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] dma-buf: Introduce selftesting framework
@ 2019-08-17 14:47 Chris Wilson
  2019-08-17 14:47 ` [PATCH 2/6] dma-buf: Add selftests for dma-fence Chris Wilson
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 14:47 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, christian.koenig

In light of recent review slip ups, the absence of a suite of tests for
dma-buf became apparent. Given the current plethora of testing
frameworks, opt for one already in use by Intel's CI and so allow easy
hook up into igt.

We introduce a new module that when loaded will execute the list of
selftests and their subtest. The names of the selftests are put into the
modinfo as parameters so that igt can identify each, and run them
independently, principally for ease of error reporting.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/dma-buf/Kconfig     |   5 ++
 drivers/dma-buf/Makefile    |   3 +
 drivers/dma-buf/selftest.c  | 167 ++++++++++++++++++++++++++++++++++++
 drivers/dma-buf/selftest.h  |  30 +++++++
 drivers/dma-buf/selftests.h |  12 +++
 5 files changed, 217 insertions(+)
 create mode 100644 drivers/dma-buf/selftest.c
 create mode 100644 drivers/dma-buf/selftest.h
 create mode 100644 drivers/dma-buf/selftests.h

diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index b6a9c2f1bc41..a23b6752d11a 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -39,4 +39,9 @@ config UDMABUF
 	  A driver to let userspace turn memfd regions into dma-bufs.
 	  Qemu can use this to create host dmabufs for guest framebuffers.
 
+config DMABUF_SELFTESTS
+	tristate "Selftests for the dma-buf interfaces"
+	default n
+	depends on DMA_SHARED_BUFFER
+
 endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index dcfb01e7c6f4..b5ae122a9349 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -4,3 +4,6 @@ obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
 obj-$(CONFIG_SYNC_FILE)		+= sync_file.o
 obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)		+= udmabuf.o
+
+dmabuf_selftests-y := selftest.o
+obj-$(CONFIG_DMABUF_SELFTESTS)	+= dmabuf_selftests.o
diff --git a/drivers/dma-buf/selftest.c b/drivers/dma-buf/selftest.c
new file mode 100644
index 000000000000..c60b6944b4bd
--- /dev/null
+++ b/drivers/dma-buf/selftest.c
@@ -0,0 +1,167 @@
+/* SPDX-License-Identifier: MIT */
+
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sched/signal.h>
+#include <linux/slab.h>
+
+#include "selftest.h"
+
+enum {
+#define selftest(n, func) __idx_##n,
+#include "selftests.h"
+#undef selftest
+};
+
+#define selftest(n, f) [__idx_##n] = { .name = #n, .func = f },
+static struct selftest {
+	bool enabled;
+	const char *name;
+	int (*func)(void);
+} selftests[] = {
+#include "selftests.h"
+};
+#undef selftest
+
+/* Embed the line number into the parameter name so that we can order tests */
+#define param(n) __PASTE(igt__, __PASTE(__PASTE(__LINE__, __), n))
+#define selftest_0(n, func, id) \
+module_param_named(id, selftests[__idx_##n].enabled, bool, 0400);
+#define selftest(n, func) selftest_0(n, func, param(n))
+#include "selftests.h"
+#undef selftest
+
+int __sanitycheck__(void)
+{
+	pr_debug("Hello World!\n");
+	return 0;
+}
+
+static char *__st_filter;
+
+static bool apply_subtest_filter(const char *caller, const char *name)
+{
+	char *filter, *sep, *tok;
+	bool result = true;
+
+	filter = kstrdup(__st_filter, GFP_KERNEL);
+	for (sep = filter; (tok = strsep(&sep, ","));) {
+		bool allow = true;
+		char *sl;
+
+		if (*tok == '!') {
+			allow = false;
+			tok++;
+		}
+
+		if (*tok == '\0')
+			continue;
+
+		sl = strchr(tok, '/');
+		if (sl) {
+			*sl++ = '\0';
+			if (strcmp(tok, caller)) {
+				if (allow)
+					result = false;
+				continue;
+			}
+			tok = sl;
+		}
+
+		if (strcmp(tok, name)) {
+			if (allow)
+				result = false;
+			continue;
+		}
+
+		result = allow;
+		break;
+	}
+	kfree(filter);
+
+	return result;
+}
+
+int
+__subtests(const char *caller, const struct subtest *st, int count, void *data)
+{
+	int err;
+
+	for (; count--; st++) {
+		cond_resched();
+		if (signal_pending(current))
+			return -EINTR;
+
+		if (!apply_subtest_filter(caller, st->name))
+			continue;
+
+		pr_info("dma-buf: Running %s/%s\n", caller, st->name);
+
+		err = st->func(data);
+		if (err && err != -EINTR) {
+			pr_err("dma-buf/%s: %s failed with error %d\n",
+			       caller, st->name, err);
+			return err;
+		}
+	}
+
+	return 0;
+}
+
+static void set_default_test_all(struct selftest *st, unsigned long count)
+{
+	unsigned long i;
+
+	for (i = 0; i < count; i++)
+		if (st[i].enabled)
+			return;
+
+	for (i = 0; i < count; i++)
+		st[i].enabled = true;
+}
+
+static int run_selftests(struct selftest *st, unsigned long count)
+{
+	int err = 0;
+
+	set_default_test_all(st, count);
+
+	/* Tests are listed in natural order in selftests.h */
+	for (; count--; st++) {
+		if (!st->enabled)
+			continue;
+
+		pr_info("dma-buf: Running %s\n", st->name);
+		err = st->func();
+		if (err)
+			break;
+	}
+
+	if (WARN(err > 0 || err == -ENOTTY,
+		 "%s returned %d, conflicting with selftest's magic values!\n",
+		 st->name, err))
+		err = -1;
+
+	return err;
+}
+
+static int __init st_init(void)
+{
+	return run_selftests(selftests, ARRAY_SIZE(selftests));
+}
+
+static void __exit st_exit(void)
+{
+}
+
+module_param_named(st_filter, __st_filter, charp, 0400);
+module_init(st_init);
+module_exit(st_exit);
+
+MODULE_DESCRIPTION("Self-test harness for dma-buf");
+MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/dma-buf/selftest.h b/drivers/dma-buf/selftest.h
new file mode 100644
index 000000000000..45793aff6142
--- /dev/null
+++ b/drivers/dma-buf/selftest.h
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: MIT
+
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#ifndef __SELFTEST_H__
+#define __SELFTEST_H__
+
+#include <linux/compiler.h>
+
+#define selftest(name, func) int func(void);
+#include "selftests.h"
+#undef selftest
+
+struct subtest {
+	int (*func)(void *data);
+	const char *name;
+};
+
+int __subtests(const char *caller,
+	       const struct subtest *st,
+	       int count,
+	       void *data);
+#define subtests(T, data) \
+	__subtests(__func__, T, ARRAY_SIZE(T), data)
+
+#define SUBTEST(x) { x, #x }
+
+#endif /* __SELFTEST_H__ */
diff --git a/drivers/dma-buf/selftests.h b/drivers/dma-buf/selftests.h
new file mode 100644
index 000000000000..44b44390d23a
--- /dev/null
+++ b/drivers/dma-buf/selftests.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: MIT */
+/* List each unit test as selftest(name, function)
+ *
+ * The name is used as both an enum and expanded as subtest__name to create
+ * a module parameter. It must be unique and legal for a C identifier.
+ *
+ * The function should be of type int function(void). It may be conditionally
+ * compiled using #if IS_ENABLED(DRM_I915_SELFTEST).
+ *
+ * Tests are executed in order by igt/dmabuf_selftest
+ */
+selftest(sanitycheck, __sanitycheck__) /* keep first (igt selfcheck) */
-- 
2.23.0.rc1

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

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

* [PATCH 2/6] dma-buf: Add selftests for dma-fence
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
@ 2019-08-17 14:47 ` Chris Wilson
  2019-08-17 14:47 ` [PATCH 3/6] dma-fence: Shrink size of struct dma_fence Chris Wilson
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 14:47 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, christian.koenig

Exercise the dma-fence API exported to drivers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/dma-buf/Makefile       |   5 +-
 drivers/dma-buf/selftests.h    |   1 +
 drivers/dma-buf/st-dma-fence.c | 571 +++++++++++++++++++++++++++++++++
 3 files changed, 576 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma-buf/st-dma-fence.c

diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index b5ae122a9349..03479da06422 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -5,5 +5,8 @@ obj-$(CONFIG_SYNC_FILE)		+= sync_file.o
 obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)		+= udmabuf.o
 
-dmabuf_selftests-y := selftest.o
+dmabuf_selftests-y := \
+	selftest.o \
+	st-dma-fence.o
+
 obj-$(CONFIG_DMABUF_SELFTESTS)	+= dmabuf_selftests.o
diff --git a/drivers/dma-buf/selftests.h b/drivers/dma-buf/selftests.h
index 44b44390d23a..5320386f02e5 100644
--- a/drivers/dma-buf/selftests.h
+++ b/drivers/dma-buf/selftests.h
@@ -10,3 +10,4 @@
  * Tests are executed in order by igt/dmabuf_selftest
  */
 selftest(sanitycheck, __sanitycheck__) /* keep first (igt selfcheck) */
+selftest(dma_fence, dma_fence)
diff --git a/drivers/dma-buf/st-dma-fence.c b/drivers/dma-buf/st-dma-fence.c
new file mode 100644
index 000000000000..d052bea4fb9f
--- /dev/null
+++ b/drivers/dma-buf/st-dma-fence.c
@@ -0,0 +1,571 @@
+/* SPDX-License-Identifier: MIT */
+
+/*
+ * Copyright © 2019 Intel Corporation
+ */
+
+#include <linux/delay.h>
+#include <linux/dma-fence.h>
+#include <linux/kernel.h>
+#include <linux/kthread.h>
+#include <linux/sched/signal.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+
+#include "selftest.h"
+
+static struct kmem_cache *slab_fences;
+
+static struct mock_fence {
+	struct dma_fence base;
+	struct spinlock lock;
+} *to_mock_fence(struct dma_fence *f) {
+	return container_of(f, struct mock_fence, base);
+}
+
+static const char *mock_name(struct dma_fence *f)
+{
+	return "mock";
+}
+
+static void mock_fence_release(struct dma_fence *f)
+{
+	kmem_cache_free(slab_fences, to_mock_fence(f));
+}
+
+struct wait_cb {
+	struct dma_fence_cb cb;
+	struct task_struct *task;
+};
+
+static void mock_wakeup(struct dma_fence *f, struct dma_fence_cb *cb)
+{
+	wake_up_process(container_of(cb, struct wait_cb, cb)->task);
+}
+
+static long mock_wait(struct dma_fence *f, bool intr, long timeout)
+{
+	const int state = intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE;
+	struct wait_cb cb = { .task = current };
+
+	if (dma_fence_add_callback(f, &cb.cb, mock_wakeup))
+		return timeout;
+
+	while (timeout) {
+		set_current_state(state);
+
+		if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &f->flags))
+			break;
+
+		if (signal_pending_state(state, current))
+			break;
+
+		timeout = schedule_timeout(timeout);
+	}
+	__set_current_state(TASK_RUNNING);
+
+	if (!dma_fence_remove_callback(f, &cb.cb))
+		return timeout;
+
+	if (signal_pending_state(state, current))
+		return -ERESTARTSYS;
+
+	return -ETIME;
+}
+
+static const struct dma_fence_ops mock_ops = {
+	.get_driver_name = mock_name,
+	.get_timeline_name = mock_name,
+	.wait = mock_wait,
+	.release = mock_fence_release,
+};
+
+static struct dma_fence *mock_fence(void)
+{
+	struct mock_fence *f;
+
+	f = kmem_cache_alloc(slab_fences, GFP_KERNEL);
+	if (!f)
+		return NULL;
+
+	spin_lock_init(&f->lock);
+	dma_fence_init(&f->base, &mock_ops, &f->lock, 0, 0);
+
+	return &f->base;
+}
+
+static int sanitycheck(void *arg)
+{
+	struct dma_fence *f;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	dma_fence_signal(f);
+	dma_fence_put(f);
+
+	return 0;
+}
+
+static int test_signaling(void *arg)
+{
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	if (dma_fence_is_signaled(f)) {
+		pr_err("Fence unexpectedly signaled on creation\n");
+		goto err_free;
+	}
+
+	if (dma_fence_signal(f)) {
+		pr_err("Fence reported being already signaled\n");
+		goto err_free;
+	}
+
+	if (!dma_fence_is_signaled(f)) {
+		pr_err("Fence not reporting signaled\n");
+		goto err_free;
+	}
+
+	if (!dma_fence_signal(f)) {
+		pr_err("Fence reported not being already signaled\n");
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_put(f);
+	return err;
+}
+
+struct simple_cb {
+	struct dma_fence_cb cb;
+	bool seen;
+};
+
+static void simple_callback(struct dma_fence *f, struct dma_fence_cb *cb)
+{
+	smp_store_mb(container_of(cb, struct simple_cb, cb)->seen, true);
+}
+
+static int test_add_callback(void *arg)
+{
+	struct simple_cb cb = {};
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	if (dma_fence_add_callback(f, &cb.cb, simple_callback)) {
+		pr_err("Failed to add callback, fence already signaled!\n");
+		goto err_free;
+	}
+
+	dma_fence_signal(f);
+	if (!cb.seen) {
+		pr_err("Callback failed!\n");
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_put(f);
+	return err;
+}
+
+static int test_late_add_callback(void *arg)
+{
+	struct simple_cb cb = {};
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	dma_fence_signal(f);
+
+	if (!dma_fence_add_callback(f, &cb.cb, simple_callback)) {
+		pr_err("Added callback, but fence was already signaled!\n");
+		goto err_free;
+	}
+
+	dma_fence_signal(f);
+	if (cb.seen) {
+		pr_err("Callback called after failed attachment !\n");
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_put(f);
+	return err;
+}
+
+static int test_rm_callback(void *arg)
+{
+	struct simple_cb cb = {};
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	if (dma_fence_add_callback(f, &cb.cb, simple_callback)) {
+		pr_err("Failed to add callback, fence already signaled!\n");
+		goto err_free;
+	}
+
+	if (!dma_fence_remove_callback(f, &cb.cb)) {
+		pr_err("Failed to remove callback!\n");
+		goto err_free;
+	}
+
+	dma_fence_signal(f);
+	if (cb.seen) {
+		pr_err("Callback still signaled after removal!\n");
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_put(f);
+	return err;
+}
+
+static int test_late_rm_callback(void *arg)
+{
+	struct simple_cb cb = {};
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	if (dma_fence_add_callback(f, &cb.cb, simple_callback)) {
+		pr_err("Failed to add callback, fence already signaled!\n");
+		goto err_free;
+	}
+
+	dma_fence_signal(f);
+	if (!cb.seen) {
+		pr_err("Callback failed!\n");
+		goto err_free;
+	}
+
+	if (dma_fence_remove_callback(f, &cb.cb)) {
+		pr_err("Callback removal succeed after being executed!\n");
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_put(f);
+	return err;
+}
+
+static int test_status(void *arg)
+{
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	if (dma_fence_get_status(f)) {
+		pr_err("Fence unexpectedly has signaled status on creation\n");
+		goto err_free;
+	}
+
+	dma_fence_signal(f);
+	if (!dma_fence_get_status(f)) {
+		pr_err("Fence not reporting signaled status\n");
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_put(f);
+	return err;
+}
+
+static int test_error(void *arg)
+{
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	dma_fence_set_error(f, -EIO);
+
+	if (dma_fence_get_status(f)) {
+		pr_err("Fence unexpectedly has error status before signal\n");
+		goto err_free;
+	}
+
+	dma_fence_signal(f);
+	if (dma_fence_get_status(f) != -EIO) {
+		pr_err("Fence not reporting error status, got %d\n",
+		       dma_fence_get_status(f));
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_put(f);
+	return err;
+}
+
+static int test_wait(void *arg)
+{
+	struct dma_fence *f;
+	int err = -EINVAL;
+
+	f = mock_fence();
+	if (!f)
+		return -ENOMEM;
+
+	if (dma_fence_wait_timeout(f, false, 0) != -ETIME) {
+		pr_err("Wait reported complete before being signaled\n");
+		goto err_free;
+	}
+
+	dma_fence_signal(f);
+
+	if (dma_fence_wait_timeout(f, false, 0) != 0) {
+		pr_err("Wait reported incomplete after being signaled\n");
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	dma_fence_signal(f);
+	dma_fence_put(f);
+	return err;
+}
+
+struct wait_timer {
+	struct timer_list timer;
+	struct dma_fence *f;
+};
+
+static void wait_timer(struct timer_list *timer)
+{
+	struct wait_timer *wt = from_timer(wt, timer, timer);
+
+	dma_fence_signal(wt->f);
+}
+
+static int test_wait_timeout(void *arg)
+{
+	struct wait_timer wt;
+	int err = -EINVAL;
+
+	timer_setup(&wt.timer, wait_timer, 0);
+
+	wt.f = mock_fence();
+	if (!wt.f)
+		return -ENOMEM;
+
+	if (dma_fence_wait_timeout(wt.f, false, 1) != -ETIME) {
+		pr_err("Wait reported complete before being signaled\n");
+		goto err_free;
+	}
+
+	mod_timer(&wt.timer, 1);
+
+	if (dma_fence_wait_timeout(wt.f, false, 2) == -ETIME) {
+		if (timer_pending(&wt.timer)) {
+			pr_notice("Timer did not fire within the jiffie!\n");
+			err = 0; /* not our fault! */
+		} else {
+			pr_err("Wait reported incomplete after timeout\n");
+		}
+		goto err_free;
+	}
+
+	err = 0;
+err_free:
+	del_timer_sync(&wt.timer);
+	dma_fence_signal(wt.f);
+	dma_fence_put(wt.f);
+	return err;
+}
+
+static int test_stub(void *arg)
+{
+	struct dma_fence *f[64];
+	int err = -EINVAL;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(f); i++) {
+		f[i] = dma_fence_get_stub();
+		if (!dma_fence_is_signaled(f[i])) {
+			pr_err("Obtained unsignaled stub fence!\n");
+			goto err;
+		}
+	}
+
+	err = 0;
+err:
+	while (i--)
+		dma_fence_put(f[i]);
+	return err;
+}
+
+/* Now off to the races! */
+
+struct race_thread {
+	struct dma_fence __rcu **fences;
+	struct task_struct *task;
+	bool before;
+	int id;
+};
+
+static void __wait_for_callbacks(struct dma_fence *f)
+{
+	spin_lock_irq(f->lock);
+	spin_unlock_irq(f->lock);
+}
+
+static int thread_signal_callback(void *arg)
+{
+	const struct race_thread *t = arg;
+	unsigned long pass = 0;
+	unsigned long miss = 0;
+	int err = 0;
+
+	while (!err && !kthread_should_stop()) {
+		struct dma_fence *f1, *f2;
+		struct simple_cb cb;
+
+		f1 = mock_fence();
+		if (!f1) {
+			err = -ENOMEM;
+			break;
+		}
+
+		rcu_assign_pointer(t->fences[t->id], f1);
+		smp_wmb();
+
+		rcu_read_lock();
+		do {
+			f2 = dma_fence_get_rcu_safe(&t->fences[!t->id]);
+		} while (!f2 && !kthread_should_stop());
+		rcu_read_unlock();
+
+		if (t->before)
+			dma_fence_signal(f1);
+
+		smp_store_mb(cb.seen, false);
+		if (!f2 || dma_fence_add_callback(f2, &cb.cb, simple_callback))
+			miss++, cb.seen = true;
+
+		if (!t->before)
+			dma_fence_signal(f1);
+
+		if (!cb.seen) {
+			dma_fence_wait(f2, false);
+			__wait_for_callbacks(f2);
+		}
+
+		if (!READ_ONCE(cb.seen)) {
+			pr_err("Callback not seen on thread %d, pass %lu (%lu misses), signaling %s add_callback; fence signaled? %s\n",
+			       t->id, pass, miss,
+			       t->before ? "before" : "after",
+			       dma_fence_is_signaled(f2) ? "yes" : "no");
+			err = -EINVAL;
+		}
+
+		dma_fence_put(f2);
+
+		rcu_assign_pointer(t->fences[t->id], NULL);
+		smp_wmb();
+
+		dma_fence_put(f1);
+
+		pass++;
+	}
+
+	pr_info("%s[%d] completed %lu passes, %lu misses\n",
+		__func__, t->id, pass, miss);
+	return err;
+}
+
+static int race_signal_callback(void *arg)
+{
+	struct dma_fence __rcu *f[2] = {};
+	int ret = 0;
+	int pass;
+
+	for (pass = 0; !ret && pass <= 1; pass++) {
+		struct race_thread t[2];
+		int i;
+
+		for (i = 0; i < ARRAY_SIZE(t); i++) {
+			t[i].fences = f;
+			t[i].id = i;
+			t[i].before = pass;
+			t[i].task = kthread_run(thread_signal_callback, &t[i],
+						"dma-fence:%d", i);
+			get_task_struct(t[i].task);
+		}
+
+		msleep(50);
+
+		for (i = 0; i < ARRAY_SIZE(t); i++) {
+			int err;
+
+			err = kthread_stop(t[i].task);
+			if (err && !ret)
+				ret = err;
+
+			put_task_struct(t[i].task);
+		}
+	}
+
+	return ret;
+}
+
+int dma_fence(void)
+{
+	static const struct subtest tests[] = {
+		SUBTEST(sanitycheck),
+		SUBTEST(test_signaling),
+		SUBTEST(test_add_callback),
+		SUBTEST(test_late_add_callback),
+		SUBTEST(test_rm_callback),
+		SUBTEST(test_late_rm_callback),
+		SUBTEST(test_status),
+		SUBTEST(test_error),
+		SUBTEST(test_wait),
+		SUBTEST(test_wait_timeout),
+		SUBTEST(test_stub),
+		SUBTEST(race_signal_callback),
+	};
+	int ret;
+
+	pr_info("sizeof(dma_fence)=%lu\n", sizeof(struct dma_fence));
+
+	slab_fences = KMEM_CACHE(mock_fence,
+				 SLAB_TYPESAFE_BY_RCU |
+				 SLAB_HWCACHE_ALIGN);
+
+	ret = subtests(tests, NULL);
+
+	kmem_cache_destroy(slab_fences);
+
+	return ret;
+}
-- 
2.23.0.rc1

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

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

* [PATCH 3/6] dma-fence: Shrink size of struct dma_fence
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
  2019-08-17 14:47 ` [PATCH 2/6] dma-buf: Add selftests for dma-fence Chris Wilson
@ 2019-08-17 14:47 ` Chris Wilson
  2019-08-17 14:47 ` [PATCH 4/6] dma-fence: Avoid list_del during fence->cb_list iteration Chris Wilson
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 14:47 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, christian.koenig

Rearrange the couple of 32-bit atomics hidden amongst the field of
pointers that unnecessarily caused the compiler to insert some padding,
shrinks the size of the base struct dma_fence from 80 to 72 bytes on
x86-64.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 include/linux/dma-fence.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 404aa748eda6..2ce4d877d33e 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -63,7 +63,7 @@ struct dma_fence_cb;
  * been completed, or never called at all.
  */
 struct dma_fence {
-	struct kref refcount;
+	spinlock_t *lock;
 	const struct dma_fence_ops *ops;
 	/* We clear the callback list on kref_put so that by the time we
 	 * release the fence it is unused. No one should be adding to the cb_list
@@ -73,11 +73,11 @@ struct dma_fence {
 		struct rcu_head rcu;
 		struct list_head cb_list;
 	};
-	spinlock_t *lock;
 	u64 context;
 	u64 seqno;
-	unsigned long flags;
 	ktime_t timestamp;
+	unsigned long flags;
+	struct kref refcount;
 	int error;
 };
 
-- 
2.23.0.rc1

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

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

* [PATCH 4/6] dma-fence: Avoid list_del during fence->cb_list iteration
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
  2019-08-17 14:47 ` [PATCH 2/6] dma-buf: Add selftests for dma-fence Chris Wilson
  2019-08-17 14:47 ` [PATCH 3/6] dma-fence: Shrink size of struct dma_fence Chris Wilson
@ 2019-08-17 14:47 ` Chris Wilson
  2019-08-17 14:47 ` [PATCH 5/6] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal Chris Wilson
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 14:47 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, christian.koenig

Before we notify the fence signal callback, we remove the cb from the
list. However, since we are processing the entire list from underneath
the spinlock, we do not need to individual delete each element, but can
simply reset the link and the entire list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 drivers/dma-buf/dma-fence.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 8025a891d3e9..ff0cd6eae766 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -149,9 +149,12 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 		trace_dma_fence_signaled(fence);
 	}
 
-	list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
-		list_del_init(&cur->node);
-		cur->func(fence, cur);
+	if (!list_empty(&fence->cb_list)) {
+		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
+			INIT_LIST_HEAD(&cur->node);
+			cur->func(fence, cur);
+		}
+		INIT_LIST_HEAD(&fence->cb_list);
 	}
 	return ret;
 }
-- 
2.23.0.rc1

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

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

* [PATCH 5/6] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
                   ` (2 preceding siblings ...)
  2019-08-17 14:47 ` [PATCH 4/6] dma-fence: Avoid list_del during fence->cb_list iteration Chris Wilson
@ 2019-08-17 14:47 ` Chris Wilson
  2019-08-17 15:16   ` Koenig, Christian
  2019-08-17 15:23   ` [PATCH v3] " Chris Wilson
  2019-08-17 14:47 ` [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list Chris Wilson
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 14:47 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, christian.koenig

Currently dma_fence_signal() tries to avoid the spinlock and only takes
it if absolutely required to walk the callback list. However, to allow
for some users to surreptitiously insert lazy signal callbacks that
do not depend on enabling the signaling mechanism around every fence,
we always need to notify the callbacks on signaling. As such, we will
always need to take the spinlock and dma_fence_signal() effectively
becomes a clone of dma_fence_signal_locked().

v2: Update the test_and_set_bit() before entering the spinlock.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/dma-buf/dma-fence.c | 43 +++++++++++--------------------------
 1 file changed, 13 insertions(+), 30 deletions(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index ff0cd6eae766..89d96e3e6df6 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -129,25 +129,16 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
 int dma_fence_signal_locked(struct dma_fence *fence)
 {
 	struct dma_fence_cb *cur, *tmp;
-	int ret = 0;
 
 	lockdep_assert_held(fence->lock);
 
-	if (WARN_ON(!fence))
+	if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
+				      &fence->flags)))
 		return -EINVAL;
 
-	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
-		ret = -EINVAL;
-
-		/*
-		 * we might have raced with the unlocked dma_fence_signal,
-		 * still run through all callbacks
-		 */
-	} else {
-		fence->timestamp = ktime_get();
-		set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
-		trace_dma_fence_signaled(fence);
-	}
+	fence->timestamp = ktime_get();
+	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
+	trace_dma_fence_signaled(fence);
 
 	if (!list_empty(&fence->cb_list)) {
 		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
@@ -156,7 +147,8 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 		}
 		INIT_LIST_HEAD(&fence->cb_list);
 	}
-	return ret;
+
+	return 0;
 }
 EXPORT_SYMBOL(dma_fence_signal_locked);
 
@@ -176,28 +168,19 @@ EXPORT_SYMBOL(dma_fence_signal_locked);
 int dma_fence_signal(struct dma_fence *fence)
 {
 	unsigned long flags;
+	int ret;
 
 	if (!fence)
 		return -EINVAL;
 
-	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
+	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
 		return -EINVAL;
 
-	fence->timestamp = ktime_get();
-	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
-	trace_dma_fence_signaled(fence);
-
-	if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
-		struct dma_fence_cb *cur, *tmp;
+	spin_lock_irqsave(fence->lock, flags);
+	ret = dma_fence_signal_locked(fence);
+	spin_unlock_irqrestore(fence->lock, flags);
 
-		spin_lock_irqsave(fence->lock, flags);
-		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
-			list_del_init(&cur->node);
-			cur->func(fence, cur);
-		}
-		spin_unlock_irqrestore(fence->lock, flags);
-	}
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(dma_fence_signal);
 
-- 
2.23.0.rc1

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

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

* [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
                   ` (3 preceding siblings ...)
  2019-08-17 14:47 ` [PATCH 5/6] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal Chris Wilson
@ 2019-08-17 14:47 ` Chris Wilson
  2019-08-17 15:20   ` Koenig, Christian
  2019-08-17 15:30   ` [PATCH v2] " Chris Wilson
  2019-08-17 15:30 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev2) Patchwork
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 14:47 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, christian.koenig

The timestamp and the cb_list are mutually exclusive, the cb_list can
only be added to prior to being signaled (and once signaled we drain),
while the timestamp is only valid upon being signaled. Both the
timestamp and the cb_list are only valid while the fence is alive, and
as soon as no references are held can be replaced by the rcu_head.

By reusing the union for the timestamp, we squeeze the base dma_fence
struct to 64 bytes on x86-64.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
---
 drivers/dma-buf/dma-fence.c                 | 16 +++++++++-------
 drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 13 +++++++------
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c       |  3 +++
 include/linux/dma-fence.h                   | 17 +++++++++++++----
 4 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 89d96e3e6df6..2c21115b1a37 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -129,6 +129,7 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
 int dma_fence_signal_locked(struct dma_fence *fence)
 {
 	struct dma_fence_cb *cur, *tmp;
+	struct list_head cb_list;
 
 	lockdep_assert_held(fence->lock);
 
@@ -136,16 +137,16 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 				      &fence->flags)))
 		return -EINVAL;
 
+	/* Stash the cb_list before replacing it with the timestamp */
+	list_replace(&fence->cb_list, &cb_list);
+
 	fence->timestamp = ktime_get();
 	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
 	trace_dma_fence_signaled(fence);
 
-	if (!list_empty(&fence->cb_list)) {
-		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
-			INIT_LIST_HEAD(&cur->node);
-			cur->func(fence, cur);
-		}
-		INIT_LIST_HEAD(&fence->cb_list);
+	list_for_each_entry_safe(cur, tmp, &cb_list, node) {
+		INIT_LIST_HEAD(&cur->node);
+		cur->func(fence, cur);
 	}
 
 	return 0;
@@ -234,7 +235,8 @@ void dma_fence_release(struct kref *kref)
 
 	trace_dma_fence_destroy(fence);
 
-	if (WARN(!list_empty(&fence->cb_list),
+	if (WARN(!list_empty(&fence->cb_list) &&
+		 !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags),
 		 "Fence %s:%s:%llx:%llx released with pending signals!\n",
 		 fence->ops->get_driver_name(fence),
 		 fence->ops->get_timeline_name(fence),
diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
index 2bc9c460e78d..09c68dda2098 100644
--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
@@ -114,18 +114,18 @@ __dma_fence_signal__timestamp(struct dma_fence *fence, ktime_t timestamp)
 }
 
 static void
-__dma_fence_signal__notify(struct dma_fence *fence)
+__dma_fence_signal__notify(struct dma_fence *fence,
+			   const struct list_head *list)
 {
 	struct dma_fence_cb *cur, *tmp;
 
 	lockdep_assert_held(fence->lock);
 	lockdep_assert_irqs_disabled();
 
-	list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
+	list_for_each_entry_safe(cur, tmp, list, node) {
 		INIT_LIST_HEAD(&cur->node);
 		cur->func(fence, cur);
 	}
-	INIT_LIST_HEAD(&fence->cb_list);
 }
 
 void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
@@ -187,11 +187,12 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
 	list_for_each_safe(pos, next, &signal) {
 		struct i915_request *rq =
 			list_entry(pos, typeof(*rq), signal_link);
-
-		__dma_fence_signal__timestamp(&rq->fence, timestamp);
+		struct list_head cb_list;
 
 		spin_lock(&rq->lock);
-		__dma_fence_signal__notify(&rq->fence);
+		list_replace(&rq->fence.cb_list, &cb_list);
+		__dma_fence_signal__timestamp(&rq->fence, timestamp);
+		__dma_fence_signal__notify(&rq->fence, &cb_list);
 		spin_unlock(&rq->lock);
 
 		i915_request_put(rq);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 434dfadb0e52..178a6cd1a06f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -185,6 +185,9 @@ static long vmw_fence_wait(struct dma_fence *f, bool intr, signed long timeout)
 
 	spin_lock(f->lock);
 
+	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &f->flags))
+		goto out;
+
 	if (intr && signal_pending(current)) {
 		ret = -ERESTARTSYS;
 		goto out;
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 2ce4d877d33e..6c36502a0562 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -65,17 +65,26 @@ struct dma_fence_cb;
 struct dma_fence {
 	spinlock_t *lock;
 	const struct dma_fence_ops *ops;
-	/* We clear the callback list on kref_put so that by the time we
-	 * release the fence it is unused. No one should be adding to the cb_list
-	 * that they don't themselves hold a reference for.
+	/*
+	 * We clear the callback list on kref_put so that by the time we
+	 * release the fence it is unused. No one should be adding to the
+	 * cb_list that they don't themselves hold a reference for.
+	 *
+	 * The lifetime of the timestamp is similarly tied to both the
+	 * rcu freelist and the cb_list. The timestamp is only set upon
+	 * signaling while simultaneously notifying the cb_list. Ergo, we
+	 * only use either the cb_list of timestamp. Upon destruction,
+	 * neither are accessible, and so we can use the rcu. This means
+	 * that the cb_list is *only* valid until the signal bit is set,
+	 * and to read either you *must* hold a reference to the fence.
 	 */
 	union {
 		struct rcu_head rcu;
 		struct list_head cb_list;
+		ktime_t timestamp;
 	};
 	u64 context;
 	u64 seqno;
-	ktime_t timestamp;
 	unsigned long flags;
 	struct kref refcount;
 	int error;
-- 
2.23.0.rc1

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

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

* Re: [PATCH 5/6] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
  2019-08-17 14:47 ` [PATCH 5/6] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal Chris Wilson
@ 2019-08-17 15:16   ` Koenig, Christian
  2019-08-17 15:23   ` [PATCH v3] " Chris Wilson
  1 sibling, 0 replies; 19+ messages in thread
From: Koenig, Christian @ 2019-08-17 15:16 UTC (permalink / raw)
  To: Chris Wilson, dri-devel; +Cc: Daniel Vetter, intel-gfx

Am 17.08.19 um 16:47 schrieb Chris Wilson:
> Currently dma_fence_signal() tries to avoid the spinlock and only takes
> it if absolutely required to walk the callback list. However, to allow
> for some users to surreptitiously insert lazy signal callbacks that
> do not depend on enabling the signaling mechanism around every fence,
> we always need to notify the callbacks on signaling. As such, we will
> always need to take the spinlock and dma_fence_signal() effectively
> becomes a clone of dma_fence_signal_locked().
>
> v2: Update the test_and_set_bit() before entering the spinlock.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>   drivers/dma-buf/dma-fence.c | 43 +++++++++++--------------------------
>   1 file changed, 13 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index ff0cd6eae766..89d96e3e6df6 100644
> --- a/drivers/dma-buf/dma-fence.c
> +++ b/drivers/dma-buf/dma-fence.c
> @@ -129,25 +129,16 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
>   int dma_fence_signal_locked(struct dma_fence *fence)
>   {
>   	struct dma_fence_cb *cur, *tmp;
> -	int ret = 0;
>   
>   	lockdep_assert_held(fence->lock);
>   
> -	if (WARN_ON(!fence))
> +	if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
> +				      &fence->flags)))
>   		return -EINVAL;
>   
> -	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
> -		ret = -EINVAL;
> -
> -		/*
> -		 * we might have raced with the unlocked dma_fence_signal,
> -		 * still run through all callbacks
> -		 */
> -	} else {
> -		fence->timestamp = ktime_get();
> -		set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
> -		trace_dma_fence_signaled(fence);
> -	}
> +	fence->timestamp = ktime_get();
> +	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
> +	trace_dma_fence_signaled(fence);
>   
>   	if (!list_empty(&fence->cb_list)) {
>   		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> @@ -156,7 +147,8 @@ int dma_fence_signal_locked(struct dma_fence *fence)
>   		}
>   		INIT_LIST_HEAD(&fence->cb_list);
>   	}
> -	return ret;
> +
> +	return 0;
>   }
>   EXPORT_SYMBOL(dma_fence_signal_locked);
>   
> @@ -176,28 +168,19 @@ EXPORT_SYMBOL(dma_fence_signal_locked);
>   int dma_fence_signal(struct dma_fence *fence)
>   {
>   	unsigned long flags;
> +	int ret;
>   
>   	if (!fence)
>   		return -EINVAL;
>   
> -	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
> +	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
>   		return -EINVAL;

Actually I think we can completely drop this extra test. Signaling a 
fence twice shouldn't be the fast path we should optimize for.

Apart from that it looks good to me,
Christian.

>   
> -	fence->timestamp = ktime_get();
> -	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
> -	trace_dma_fence_signaled(fence);
> -
> -	if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
> -		struct dma_fence_cb *cur, *tmp;
> +	spin_lock_irqsave(fence->lock, flags);
> +	ret = dma_fence_signal_locked(fence);
> +	spin_unlock_irqrestore(fence->lock, flags);
>   
> -		spin_lock_irqsave(fence->lock, flags);
> -		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> -			list_del_init(&cur->node);
> -			cur->func(fence, cur);
> -		}
> -		spin_unlock_irqrestore(fence->lock, flags);
> -	}
> -	return 0;
> +	return ret;
>   }
>   EXPORT_SYMBOL(dma_fence_signal);
>   

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

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

* Re: [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list
  2019-08-17 14:47 ` [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list Chris Wilson
@ 2019-08-17 15:20   ` Koenig, Christian
  2019-08-17 15:27     ` Chris Wilson
  2019-08-17 15:30   ` [PATCH v2] " Chris Wilson
  1 sibling, 1 reply; 19+ messages in thread
From: Koenig, Christian @ 2019-08-17 15:20 UTC (permalink / raw)
  To: Chris Wilson, dri-devel; +Cc: intel-gfx

Am 17.08.19 um 16:47 schrieb Chris Wilson:
> The timestamp and the cb_list are mutually exclusive, the cb_list can
> only be added to prior to being signaled (and once signaled we drain),
> while the timestamp is only valid upon being signaled. Both the
> timestamp and the cb_list are only valid while the fence is alive, and
> as soon as no references are held can be replaced by the rcu_head.
>
> By reusing the union for the timestamp, we squeeze the base dma_fence
> struct to 64 bytes on x86-64.
>
> Suggested-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Christian König <christian.koenig@amd.com>
> ---
>   drivers/dma-buf/dma-fence.c                 | 16 +++++++++-------
>   drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 13 +++++++------
>   drivers/gpu/drm/vmwgfx/vmwgfx_fence.c       |  3 +++
>   include/linux/dma-fence.h                   | 17 +++++++++++++----
>   4 files changed, 32 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index 89d96e3e6df6..2c21115b1a37 100644
> --- a/drivers/dma-buf/dma-fence.c
> +++ b/drivers/dma-buf/dma-fence.c
> @@ -129,6 +129,7 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
>   int dma_fence_signal_locked(struct dma_fence *fence)
>   {
>   	struct dma_fence_cb *cur, *tmp;
> +	struct list_head cb_list;
>   
>   	lockdep_assert_held(fence->lock);
>   
> @@ -136,16 +137,16 @@ int dma_fence_signal_locked(struct dma_fence *fence)
>   				      &fence->flags)))
>   		return -EINVAL;
>   
> +	/* Stash the cb_list before replacing it with the timestamp */
> +	list_replace(&fence->cb_list, &cb_list);

Stashing the timestamp instead is probably less bytes to modify.

> +
>   	fence->timestamp = ktime_get();
>   	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
>   	trace_dma_fence_signaled(fence);
>   
> -	if (!list_empty(&fence->cb_list)) {
> -		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> -			INIT_LIST_HEAD(&cur->node);
> -			cur->func(fence, cur);
> -		}
> -		INIT_LIST_HEAD(&fence->cb_list);
> +	list_for_each_entry_safe(cur, tmp, &cb_list, node) {
> +		INIT_LIST_HEAD(&cur->node);
> +		cur->func(fence, cur);
>   	}
>   
>   	return 0;
> @@ -234,7 +235,8 @@ void dma_fence_release(struct kref *kref)
>   
>   	trace_dma_fence_destroy(fence);
>   
> -	if (WARN(!list_empty(&fence->cb_list),
> +	if (WARN(!list_empty(&fence->cb_list) &&
> +		 !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags),
>   		 "Fence %s:%s:%llx:%llx released with pending signals!\n",
>   		 fence->ops->get_driver_name(fence),
>   		 fence->ops->get_timeline_name(fence),
> diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> index 2bc9c460e78d..09c68dda2098 100644
> --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> @@ -114,18 +114,18 @@ __dma_fence_signal__timestamp(struct dma_fence *fence, ktime_t timestamp)
>   }
>   
>   static void
> -__dma_fence_signal__notify(struct dma_fence *fence)
> +__dma_fence_signal__notify(struct dma_fence *fence,
> +			   const struct list_head *list)
>   {
>   	struct dma_fence_cb *cur, *tmp;
>   
>   	lockdep_assert_held(fence->lock);
>   	lockdep_assert_irqs_disabled();
>   
> -	list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> +	list_for_each_entry_safe(cur, tmp, list, node) {
>   		INIT_LIST_HEAD(&cur->node);
>   		cur->func(fence, cur);
>   	}
> -	INIT_LIST_HEAD(&fence->cb_list);
>   }
>   
>   void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
> @@ -187,11 +187,12 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
>   	list_for_each_safe(pos, next, &signal) {
>   		struct i915_request *rq =
>   			list_entry(pos, typeof(*rq), signal_link);
> -
> -		__dma_fence_signal__timestamp(&rq->fence, timestamp);
> +		struct list_head cb_list;
>   
>   		spin_lock(&rq->lock);
> -		__dma_fence_signal__notify(&rq->fence);
> +		list_replace(&rq->fence.cb_list, &cb_list);
> +		__dma_fence_signal__timestamp(&rq->fence, timestamp);
> +		__dma_fence_signal__notify(&rq->fence, &cb_list);
>   		spin_unlock(&rq->lock);
>   
>   		i915_request_put(rq);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> index 434dfadb0e52..178a6cd1a06f 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> @@ -185,6 +185,9 @@ static long vmw_fence_wait(struct dma_fence *f, bool intr, signed long timeout)
>   
>   	spin_lock(f->lock);
>   
> +	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &f->flags))
> +		goto out;
> +
>   	if (intr && signal_pending(current)) {
>   		ret = -ERESTARTSYS;
>   		goto out;
> diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
> index 2ce4d877d33e..6c36502a0562 100644
> --- a/include/linux/dma-fence.h
> +++ b/include/linux/dma-fence.h
> @@ -65,17 +65,26 @@ struct dma_fence_cb;
>   struct dma_fence {
>   	spinlock_t *lock;
>   	const struct dma_fence_ops *ops;
> -	/* We clear the callback list on kref_put so that by the time we
> -	 * release the fence it is unused. No one should be adding to the cb_list
> -	 * that they don't themselves hold a reference for.
> +	/*
> +	 * We clear the callback list on kref_put so that by the time we
> +	 * release the fence it is unused. No one should be adding to the
> +	 * cb_list that they don't themselves hold a reference for.
> +	 *
> +	 * The lifetime of the timestamp is similarly tied to both the
> +	 * rcu freelist and the cb_list. The timestamp is only set upon
> +	 * signaling while simultaneously notifying the cb_list. Ergo, we
> +	 * only use either the cb_list of timestamp. Upon destruction,
> +	 * neither are accessible, and so we can use the rcu. This means
> +	 * that the cb_list is *only* valid until the signal bit is set,
> +	 * and to read either you *must* hold a reference to the fence.
>   	 */
>   	union {
>   		struct rcu_head rcu;
>   		struct list_head cb_list;
> +		ktime_t timestamp;

Maybe sort this cb_list, timestamp, rcu to better note in which order it 
is used in the lifetime of a fence.

Apart from that looks good to me,
Christian.

>   	};
>   	u64 context;
>   	u64 seqno;
> -	ktime_t timestamp;
>   	unsigned long flags;
>   	struct kref refcount;
>   	int error;

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

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

* [PATCH v3] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
  2019-08-17 14:47 ` [PATCH 5/6] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal Chris Wilson
  2019-08-17 15:16   ` Koenig, Christian
@ 2019-08-17 15:23   ` Chris Wilson
  2019-08-17 15:25     ` Koenig, Christian
  1 sibling, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 15:23 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx, Christian König

Currently dma_fence_signal() tries to avoid the spinlock and only takes
it if absolutely required to walk the callback list. However, to allow
for some users to surreptitiously insert lazy signal callbacks that
do not depend on enabling the signaling mechanism around every fence,
we always need to notify the callbacks on signaling. As such, we will
always need to take the spinlock and dma_fence_signal() effectively
becomes a clone of dma_fence_signal_locked().

v2: Update the test_and_set_bit() before entering the spinlock.
v3: Drop the test_[and_set]_bit() before the spinlock, it's a caller
error so expected to be very unlikely.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/dma-buf/dma-fence.c | 44 ++++++++++---------------------------
 1 file changed, 12 insertions(+), 32 deletions(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index ff0cd6eae766..8a6d0250285d 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -129,25 +129,16 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
 int dma_fence_signal_locked(struct dma_fence *fence)
 {
 	struct dma_fence_cb *cur, *tmp;
-	int ret = 0;
 
 	lockdep_assert_held(fence->lock);
 
-	if (WARN_ON(!fence))
+	if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
+				      &fence->flags)))
 		return -EINVAL;
 
-	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
-		ret = -EINVAL;
-
-		/*
-		 * we might have raced with the unlocked dma_fence_signal,
-		 * still run through all callbacks
-		 */
-	} else {
-		fence->timestamp = ktime_get();
-		set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
-		trace_dma_fence_signaled(fence);
-	}
+	fence->timestamp = ktime_get();
+	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
+	trace_dma_fence_signaled(fence);
 
 	if (!list_empty(&fence->cb_list)) {
 		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
@@ -156,7 +147,8 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 		}
 		INIT_LIST_HEAD(&fence->cb_list);
 	}
-	return ret;
+
+	return 0;
 }
 EXPORT_SYMBOL(dma_fence_signal_locked);
 
@@ -176,28 +168,16 @@ EXPORT_SYMBOL(dma_fence_signal_locked);
 int dma_fence_signal(struct dma_fence *fence)
 {
 	unsigned long flags;
+	int ret;
 
 	if (!fence)
 		return -EINVAL;
 
-	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
-		return -EINVAL;
-
-	fence->timestamp = ktime_get();
-	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
-	trace_dma_fence_signaled(fence);
-
-	if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
-		struct dma_fence_cb *cur, *tmp;
+	spin_lock_irqsave(fence->lock, flags);
+	ret = dma_fence_signal_locked(fence);
+	spin_unlock_irqrestore(fence->lock, flags);
 
-		spin_lock_irqsave(fence->lock, flags);
-		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
-			list_del_init(&cur->node);
-			cur->func(fence, cur);
-		}
-		spin_unlock_irqrestore(fence->lock, flags);
-	}
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(dma_fence_signal);
 
-- 
2.23.0.rc1

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

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

* Re: [PATCH v3] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
  2019-08-17 15:23   ` [PATCH v3] " Chris Wilson
@ 2019-08-17 15:25     ` Koenig, Christian
  0 siblings, 0 replies; 19+ messages in thread
From: Koenig, Christian @ 2019-08-17 15:25 UTC (permalink / raw)
  To: Chris Wilson, dri-devel; +Cc: Daniel Vetter, intel-gfx

Am 17.08.19 um 17:23 schrieb Chris Wilson:
> Currently dma_fence_signal() tries to avoid the spinlock and only takes
> it if absolutely required to walk the callback list. However, to allow
> for some users to surreptitiously insert lazy signal callbacks that
> do not depend on enabling the signaling mechanism around every fence,
> we always need to notify the callbacks on signaling. As such, we will
> always need to take the spinlock and dma_fence_signal() effectively
> becomes a clone of dma_fence_signal_locked().
>
> v2: Update the test_and_set_bit() before entering the spinlock.
> v3: Drop the test_[and_set]_bit() before the spinlock, it's a caller
> error so expected to be very unlikely.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/dma-buf/dma-fence.c | 44 ++++++++++---------------------------
>   1 file changed, 12 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index ff0cd6eae766..8a6d0250285d 100644
> --- a/drivers/dma-buf/dma-fence.c
> +++ b/drivers/dma-buf/dma-fence.c
> @@ -129,25 +129,16 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
>   int dma_fence_signal_locked(struct dma_fence *fence)
>   {
>   	struct dma_fence_cb *cur, *tmp;
> -	int ret = 0;
>   
>   	lockdep_assert_held(fence->lock);
>   
> -	if (WARN_ON(!fence))
> +	if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
> +				      &fence->flags)))
>   		return -EINVAL;
>   
> -	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
> -		ret = -EINVAL;
> -
> -		/*
> -		 * we might have raced with the unlocked dma_fence_signal,
> -		 * still run through all callbacks
> -		 */
> -	} else {
> -		fence->timestamp = ktime_get();
> -		set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
> -		trace_dma_fence_signaled(fence);
> -	}
> +	fence->timestamp = ktime_get();
> +	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
> +	trace_dma_fence_signaled(fence);
>   
>   	if (!list_empty(&fence->cb_list)) {
>   		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> @@ -156,7 +147,8 @@ int dma_fence_signal_locked(struct dma_fence *fence)
>   		}
>   		INIT_LIST_HEAD(&fence->cb_list);
>   	}
> -	return ret;
> +
> +	return 0;
>   }
>   EXPORT_SYMBOL(dma_fence_signal_locked);
>   
> @@ -176,28 +168,16 @@ EXPORT_SYMBOL(dma_fence_signal_locked);
>   int dma_fence_signal(struct dma_fence *fence)
>   {
>   	unsigned long flags;
> +	int ret;
>   
>   	if (!fence)
>   		return -EINVAL;
>   
> -	if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
> -		return -EINVAL;
> -
> -	fence->timestamp = ktime_get();
> -	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
> -	trace_dma_fence_signaled(fence);
> -
> -	if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
> -		struct dma_fence_cb *cur, *tmp;
> +	spin_lock_irqsave(fence->lock, flags);
> +	ret = dma_fence_signal_locked(fence);
> +	spin_unlock_irqrestore(fence->lock, flags);
>   
> -		spin_lock_irqsave(fence->lock, flags);
> -		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> -			list_del_init(&cur->node);
> -			cur->func(fence, cur);
> -		}
> -		spin_unlock_irqrestore(fence->lock, flags);
> -	}
> -	return 0;
> +	return ret;
>   }
>   EXPORT_SYMBOL(dma_fence_signal);
>   

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

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

* Re: [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list
  2019-08-17 15:20   ` Koenig, Christian
@ 2019-08-17 15:27     ` Chris Wilson
  2019-08-17 15:31       ` Koenig, Christian
  0 siblings, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 15:27 UTC (permalink / raw)
  To: Koenig, Christian, dri-devel; +Cc: intel-gfx

Quoting Koenig, Christian (2019-08-17 16:20:12)
> Am 17.08.19 um 16:47 schrieb Chris Wilson:
> > diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> > index 89d96e3e6df6..2c21115b1a37 100644
> > --- a/drivers/dma-buf/dma-fence.c
> > +++ b/drivers/dma-buf/dma-fence.c
> > @@ -129,6 +129,7 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
> >   int dma_fence_signal_locked(struct dma_fence *fence)
> >   {
> >       struct dma_fence_cb *cur, *tmp;
> > +     struct list_head cb_list;
> >   
> >       lockdep_assert_held(fence->lock);
> >   
> > @@ -136,16 +137,16 @@ int dma_fence_signal_locked(struct dma_fence *fence)
> >                                     &fence->flags)))
> >               return -EINVAL;
> >   
> > +     /* Stash the cb_list before replacing it with the timestamp */
> > +     list_replace(&fence->cb_list, &cb_list);
> 
> Stashing the timestamp instead is probably less bytes to modify.

My thinking was to pass the timestamp to the notify callbacks, we need
to stash the list and set the timestamp first.

Nothing that I'm aware of uses the timestamp (just the sync file debug
which weston was considering using at one point)... So I guess we don't
care? But I would say we should do that as a separate step in case
someone does.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev2)
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
                   ` (4 preceding siblings ...)
  2019-08-17 14:47 ` [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list Chris Wilson
@ 2019-08-17 15:30 ` Patchwork
  2019-08-17 15:53 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-08-17 15:30 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/6] dma-buf: Introduce selftesting framework (rev2)
URL   : https://patchwork.freedesktop.org/series/65353/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
68147e4f876c dma-buf: Introduce selftesting framework
-:27: WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully
#27: FILE: drivers/dma-buf/Kconfig:42:
+config DMABUF_SELFTESTS

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

-:50: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/dma-buf/selftest.c', please use '//' instead
#50: FILE: drivers/dma-buf/selftest.c:1:
+/* SPDX-License-Identifier: MIT */

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

-:70: ERROR:BRACKET_SPACE: space prohibited before open square bracket '['
#70: FILE: drivers/dma-buf/selftest.c:21:
+#define selftest(n, f) [__idx_##n] = { .name = #n, .func = f },

-:78: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
#78: FILE: drivers/dma-buf/selftest.c:29:
+};
+#undef selftest

-:82: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon
#82: FILE: drivers/dma-buf/selftest.c:33:
+#define selftest_0(n, func, id) \
+module_param_named(id, selftests[__idx_##n].enabled, bool, 0400);

-:84: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?
#84: FILE: drivers/dma-buf/selftest.c:35:
+#define selftest(n, func) selftest_0(n, func, param(n))

-:223: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/dma-buf/selftest.h', please use '/*' instead
#223: FILE: drivers/dma-buf/selftest.h:1:
+// SPDX-License-Identifier: MIT

-:223: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#223: FILE: drivers/dma-buf/selftest.h:1:
+// SPDX-License-Identifier: MIT

-:234: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon
#234: FILE: drivers/dma-buf/selftest.h:12:
+#define selftest(name, func) int func(void);

-:247: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'T' - possible side-effects?
#247: FILE: drivers/dma-buf/selftest.h:25:
+#define subtests(T, data) \
+	__subtests(__func__, T, ARRAY_SIZE(T), data)

total: 1 errors, 8 warnings, 3 checks, 224 lines checked
a2263cefd9ad dma-buf: Add selftests for dma-fence
-:35: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#35: 
new file mode 100644

-:40: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/dma-buf/st-dma-fence.c', please use '//' instead
#40: FILE: drivers/dma-buf/st-dma-fence.c:1:
+/* SPDX-License-Identifier: MIT */

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

-:60: WARNING:USE_SPINLOCK_T: struct spinlock should be spinlock_t
#60: FILE: drivers/dma-buf/st-dma-fence.c:21:
+	struct spinlock lock;

-:192: WARNING:MEMORY_BARRIER: memory barrier without comment
#192: FILE: drivers/dma-buf/st-dma-fence.c:153:
+	smp_store_mb(container_of(cb, struct simple_cb, cb)->seen, true);

-:500: WARNING:MEMORY_BARRIER: memory barrier without comment
#500: FILE: drivers/dma-buf/st-dma-fence.c:461:
+		smp_wmb();

-:511: WARNING:MEMORY_BARRIER: memory barrier without comment
#511: FILE: drivers/dma-buf/st-dma-fence.c:472:
+		smp_store_mb(cb.seen, false);

-:534: WARNING:MEMORY_BARRIER: memory barrier without comment
#534: FILE: drivers/dma-buf/st-dma-fence.c:495:
+		smp_wmb();

-:599: WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'dma_fence', this function's name, in a string
#599: FILE: drivers/dma-buf/st-dma-fence.c:560:
+	pr_info("sizeof(dma_fence)=%lu\n", sizeof(struct dma_fence));

total: 0 errors, 9 warnings, 0 checks, 584 lines checked
a0349c894fa7 dma-fence: Shrink size of struct dma_fence
-:27: CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment
#27: FILE: include/linux/dma-fence.h:66:
+	spinlock_t *lock;

total: 0 errors, 0 warnings, 1 checks, 21 lines checked
b169d6484e5b dma-fence: Avoid list_del during fence->cb_list iteration
a11eb4863ead dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
fa4560a581b3 dma-fence: Store the timestamp in the same union as the cb_list

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

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

* [PATCH v2] dma-fence: Store the timestamp in the same union as the cb_list
  2019-08-17 14:47 ` [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list Chris Wilson
  2019-08-17 15:20   ` Koenig, Christian
@ 2019-08-17 15:30   ` Chris Wilson
  2019-08-17 15:40     ` Koenig, Christian
  1 sibling, 1 reply; 19+ messages in thread
From: Chris Wilson @ 2019-08-17 15:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Christian König

The timestamp and the cb_list are mutually exclusive, the cb_list can
only be added to prior to being signaled (and once signaled we drain),
while the timestamp is only valid upon being signaled. Both the
timestamp and the cb_list are only valid while the fence is alive, and
as soon as no references are held can be replaced by the rcu_head.

By reusing the union for the timestamp, we squeeze the base dma_fence
struct to 64 bytes on x86-64.

v2: Sort the union chronologically

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
---
 drivers/dma-buf/dma-fence.c                 | 16 +++++++-------
 drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 13 ++++++------
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c       |  3 +++
 include/linux/dma-fence.h                   | 23 ++++++++++++++++-----
 4 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 8a6d0250285d..2c136aee3e79 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -129,6 +129,7 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
 int dma_fence_signal_locked(struct dma_fence *fence)
 {
 	struct dma_fence_cb *cur, *tmp;
+	struct list_head cb_list;
 
 	lockdep_assert_held(fence->lock);
 
@@ -136,16 +137,16 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 				      &fence->flags)))
 		return -EINVAL;
 
+	/* Stash the cb_list before replacing it with the timestamp */
+	list_replace(&fence->cb_list, &cb_list);
+
 	fence->timestamp = ktime_get();
 	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
 	trace_dma_fence_signaled(fence);
 
-	if (!list_empty(&fence->cb_list)) {
-		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
-			INIT_LIST_HEAD(&cur->node);
-			cur->func(fence, cur);
-		}
-		INIT_LIST_HEAD(&fence->cb_list);
+	list_for_each_entry_safe(cur, tmp, &cb_list, node) {
+		INIT_LIST_HEAD(&cur->node);
+		cur->func(fence, cur);
 	}
 
 	return 0;
@@ -231,7 +232,8 @@ void dma_fence_release(struct kref *kref)
 
 	trace_dma_fence_destroy(fence);
 
-	if (WARN(!list_empty(&fence->cb_list),
+	if (WARN(!list_empty(&fence->cb_list) &&
+		 !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags),
 		 "Fence %s:%s:%llx:%llx released with pending signals!\n",
 		 fence->ops->get_driver_name(fence),
 		 fence->ops->get_timeline_name(fence),
diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
index 2bc9c460e78d..09c68dda2098 100644
--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
@@ -114,18 +114,18 @@ __dma_fence_signal__timestamp(struct dma_fence *fence, ktime_t timestamp)
 }
 
 static void
-__dma_fence_signal__notify(struct dma_fence *fence)
+__dma_fence_signal__notify(struct dma_fence *fence,
+			   const struct list_head *list)
 {
 	struct dma_fence_cb *cur, *tmp;
 
 	lockdep_assert_held(fence->lock);
 	lockdep_assert_irqs_disabled();
 
-	list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
+	list_for_each_entry_safe(cur, tmp, list, node) {
 		INIT_LIST_HEAD(&cur->node);
 		cur->func(fence, cur);
 	}
-	INIT_LIST_HEAD(&fence->cb_list);
 }
 
 void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
@@ -187,11 +187,12 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
 	list_for_each_safe(pos, next, &signal) {
 		struct i915_request *rq =
 			list_entry(pos, typeof(*rq), signal_link);
-
-		__dma_fence_signal__timestamp(&rq->fence, timestamp);
+		struct list_head cb_list;
 
 		spin_lock(&rq->lock);
-		__dma_fence_signal__notify(&rq->fence);
+		list_replace(&rq->fence.cb_list, &cb_list);
+		__dma_fence_signal__timestamp(&rq->fence, timestamp);
+		__dma_fence_signal__notify(&rq->fence, &cb_list);
 		spin_unlock(&rq->lock);
 
 		i915_request_put(rq);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 434dfadb0e52..178a6cd1a06f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -185,6 +185,9 @@ static long vmw_fence_wait(struct dma_fence *f, bool intr, signed long timeout)
 
 	spin_lock(f->lock);
 
+	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &f->flags))
+		goto out;
+
 	if (intr && signal_pending(current)) {
 		ret = -ERESTARTSYS;
 		goto out;
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 2ce4d877d33e..8b4a5aaa6848 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -65,17 +65,30 @@ struct dma_fence_cb;
 struct dma_fence {
 	spinlock_t *lock;
 	const struct dma_fence_ops *ops;
-	/* We clear the callback list on kref_put so that by the time we
-	 * release the fence it is unused. No one should be adding to the cb_list
-	 * that they don't themselves hold a reference for.
+	/*
+	 * We clear the callback list on kref_put so that by the time we
+	 * release the fence it is unused. No one should be adding to the
+	 * cb_list that they don't themselves hold a reference for.
+	 *
+	 * The lifetime of the timestamp is similarly tied to both the
+	 * rcu freelist and the cb_list. The timestamp is only set upon
+	 * signaling while simultaneously notifying the cb_list. Ergo, we
+	 * only use either the cb_list of timestamp. Upon destruction,
+	 * neither are accessible, and so we can use the rcu. This means
+	 * that the cb_list is *only* valid until the signal bit is set,
+	 * and to read either you *must* hold a reference to the fence.
+	 *
+	 * Listed in chronological order.
 	 */
 	union {
-		struct rcu_head rcu;
 		struct list_head cb_list;
+		/* @cb_list replaced by @timestamp on dma_fence_signal() */
+		ktime_t timestamp;
+		/* @timestamp replaced by @rcu on dma_fence_release() */
+		struct rcu_head rcu;
 	};
 	u64 context;
 	u64 seqno;
-	ktime_t timestamp;
 	unsigned long flags;
 	struct kref refcount;
 	int error;
-- 
2.23.0.rc1

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

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

* Re: [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list
  2019-08-17 15:27     ` Chris Wilson
@ 2019-08-17 15:31       ` Koenig, Christian
  0 siblings, 0 replies; 19+ messages in thread
From: Koenig, Christian @ 2019-08-17 15:31 UTC (permalink / raw)
  To: Chris Wilson, dri-devel; +Cc: intel-gfx

Am 17.08.19 um 17:27 schrieb Chris Wilson:
> Quoting Koenig, Christian (2019-08-17 16:20:12)
>> Am 17.08.19 um 16:47 schrieb Chris Wilson:
>>> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
>>> index 89d96e3e6df6..2c21115b1a37 100644
>>> --- a/drivers/dma-buf/dma-fence.c
>>> +++ b/drivers/dma-buf/dma-fence.c
>>> @@ -129,6 +129,7 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
>>>    int dma_fence_signal_locked(struct dma_fence *fence)
>>>    {
>>>        struct dma_fence_cb *cur, *tmp;
>>> +     struct list_head cb_list;
>>>    
>>>        lockdep_assert_held(fence->lock);
>>>    
>>> @@ -136,16 +137,16 @@ int dma_fence_signal_locked(struct dma_fence *fence)
>>>                                      &fence->flags)))
>>>                return -EINVAL;
>>>    
>>> +     /* Stash the cb_list before replacing it with the timestamp */
>>> +     list_replace(&fence->cb_list, &cb_list);
>> Stashing the timestamp instead is probably less bytes to modify.
> My thinking was to pass the timestamp to the notify callbacks, we need
> to stash the list and set the timestamp first.

I don't see much of a reason for callbacks to use the timestamp, they 
could just call ktime_get() and would most likely get the same or at 
least a very close by value.

> Nothing that I'm aware of uses the timestamp (just the sync file debug
> which weston was considering using at one point)... So I guess we don't
> care? But I would say we should do that as a separate step in case
> someone does.

Yeah, agree.

Christian.

> -Chris

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

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

* Re: [PATCH v2] dma-fence: Store the timestamp in the same union as the cb_list
  2019-08-17 15:30   ` [PATCH v2] " Chris Wilson
@ 2019-08-17 15:40     ` Koenig, Christian
  0 siblings, 0 replies; 19+ messages in thread
From: Koenig, Christian @ 2019-08-17 15:40 UTC (permalink / raw)
  To: Chris Wilson, dri-devel; +Cc: intel-gfx

Am 17.08.19 um 17:30 schrieb Chris Wilson:
> The timestamp and the cb_list are mutually exclusive, the cb_list can
> only be added to prior to being signaled (and once signaled we drain),
> while the timestamp is only valid upon being signaled. Both the
> timestamp and the cb_list are only valid while the fence is alive, and
> as soon as no references are held can be replaced by the rcu_head.
>
> By reusing the union for the timestamp, we squeeze the base dma_fence
> struct to 64 bytes on x86-64.
>
> v2: Sort the union chronologically
>
> Suggested-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Christian König <christian.koenig@amd.com>

I can't judge about the correctness of the vmw and Intel stuff, so only 
Acked-by: Christian König <christian.koenig@amd.com>.

> ---
>   drivers/dma-buf/dma-fence.c                 | 16 +++++++-------
>   drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 13 ++++++------
>   drivers/gpu/drm/vmwgfx/vmwgfx_fence.c       |  3 +++
>   include/linux/dma-fence.h                   | 23 ++++++++++++++++-----
>   4 files changed, 37 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index 8a6d0250285d..2c136aee3e79 100644
> --- a/drivers/dma-buf/dma-fence.c
> +++ b/drivers/dma-buf/dma-fence.c
> @@ -129,6 +129,7 @@ EXPORT_SYMBOL(dma_fence_context_alloc);
>   int dma_fence_signal_locked(struct dma_fence *fence)
>   {
>   	struct dma_fence_cb *cur, *tmp;
> +	struct list_head cb_list;
>   
>   	lockdep_assert_held(fence->lock);
>   
> @@ -136,16 +137,16 @@ int dma_fence_signal_locked(struct dma_fence *fence)
>   				      &fence->flags)))
>   		return -EINVAL;
>   
> +	/* Stash the cb_list before replacing it with the timestamp */
> +	list_replace(&fence->cb_list, &cb_list);
> +
>   	fence->timestamp = ktime_get();
>   	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
>   	trace_dma_fence_signaled(fence);
>   
> -	if (!list_empty(&fence->cb_list)) {
> -		list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> -			INIT_LIST_HEAD(&cur->node);
> -			cur->func(fence, cur);
> -		}
> -		INIT_LIST_HEAD(&fence->cb_list);
> +	list_for_each_entry_safe(cur, tmp, &cb_list, node) {
> +		INIT_LIST_HEAD(&cur->node);
> +		cur->func(fence, cur);
>   	}
>   
>   	return 0;
> @@ -231,7 +232,8 @@ void dma_fence_release(struct kref *kref)
>   
>   	trace_dma_fence_destroy(fence);
>   
> -	if (WARN(!list_empty(&fence->cb_list),
> +	if (WARN(!list_empty(&fence->cb_list) &&
> +		 !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags),
>   		 "Fence %s:%s:%llx:%llx released with pending signals!\n",
>   		 fence->ops->get_driver_name(fence),
>   		 fence->ops->get_timeline_name(fence),
> diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> index 2bc9c460e78d..09c68dda2098 100644
> --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> @@ -114,18 +114,18 @@ __dma_fence_signal__timestamp(struct dma_fence *fence, ktime_t timestamp)
>   }
>   
>   static void
> -__dma_fence_signal__notify(struct dma_fence *fence)
> +__dma_fence_signal__notify(struct dma_fence *fence,
> +			   const struct list_head *list)
>   {
>   	struct dma_fence_cb *cur, *tmp;
>   
>   	lockdep_assert_held(fence->lock);
>   	lockdep_assert_irqs_disabled();
>   
> -	list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
> +	list_for_each_entry_safe(cur, tmp, list, node) {
>   		INIT_LIST_HEAD(&cur->node);
>   		cur->func(fence, cur);
>   	}
> -	INIT_LIST_HEAD(&fence->cb_list);
>   }
>   
>   void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
> @@ -187,11 +187,12 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
>   	list_for_each_safe(pos, next, &signal) {
>   		struct i915_request *rq =
>   			list_entry(pos, typeof(*rq), signal_link);
> -
> -		__dma_fence_signal__timestamp(&rq->fence, timestamp);
> +		struct list_head cb_list;
>   
>   		spin_lock(&rq->lock);
> -		__dma_fence_signal__notify(&rq->fence);
> +		list_replace(&rq->fence.cb_list, &cb_list);
> +		__dma_fence_signal__timestamp(&rq->fence, timestamp);
> +		__dma_fence_signal__notify(&rq->fence, &cb_list);
>   		spin_unlock(&rq->lock);
>   
>   		i915_request_put(rq);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> index 434dfadb0e52..178a6cd1a06f 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> @@ -185,6 +185,9 @@ static long vmw_fence_wait(struct dma_fence *f, bool intr, signed long timeout)
>   
>   	spin_lock(f->lock);
>   
> +	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &f->flags))
> +		goto out;
> +
>   	if (intr && signal_pending(current)) {
>   		ret = -ERESTARTSYS;
>   		goto out;
> diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
> index 2ce4d877d33e..8b4a5aaa6848 100644
> --- a/include/linux/dma-fence.h
> +++ b/include/linux/dma-fence.h
> @@ -65,17 +65,30 @@ struct dma_fence_cb;
>   struct dma_fence {
>   	spinlock_t *lock;
>   	const struct dma_fence_ops *ops;
> -	/* We clear the callback list on kref_put so that by the time we
> -	 * release the fence it is unused. No one should be adding to the cb_list
> -	 * that they don't themselves hold a reference for.
> +	/*
> +	 * We clear the callback list on kref_put so that by the time we
> +	 * release the fence it is unused. No one should be adding to the
> +	 * cb_list that they don't themselves hold a reference for.
> +	 *
> +	 * The lifetime of the timestamp is similarly tied to both the
> +	 * rcu freelist and the cb_list. The timestamp is only set upon
> +	 * signaling while simultaneously notifying the cb_list. Ergo, we
> +	 * only use either the cb_list of timestamp. Upon destruction,
> +	 * neither are accessible, and so we can use the rcu. This means
> +	 * that the cb_list is *only* valid until the signal bit is set,
> +	 * and to read either you *must* hold a reference to the fence.
> +	 *
> +	 * Listed in chronological order.
>   	 */
>   	union {
> -		struct rcu_head rcu;
>   		struct list_head cb_list;
> +		/* @cb_list replaced by @timestamp on dma_fence_signal() */
> +		ktime_t timestamp;
> +		/* @timestamp replaced by @rcu on dma_fence_release() */
> +		struct rcu_head rcu;
>   	};
>   	u64 context;
>   	u64 seqno;
> -	ktime_t timestamp;
>   	unsigned long flags;
>   	struct kref refcount;
>   	int error;

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

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

* ✓ Fi.CI.BAT: success for series starting with [1/6] dma-buf: Introduce selftesting framework (rev2)
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
                   ` (5 preceding siblings ...)
  2019-08-17 15:30 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev2) Patchwork
@ 2019-08-17 15:53 ` Patchwork
  2019-08-17 15:56 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev3) Patchwork
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-08-17 15:53 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/6] dma-buf: Introduce selftesting framework (rev2)
URL   : https://patchwork.freedesktop.org/series/65353/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6727 -> Patchwork_14072
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live_active:
    - fi-bsw-n3050:       [PASS][1] -> [DMESG-WARN][2] ([fdo#111373])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-bsw-n3050/igt@i915_selftest@live_active.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14072/fi-bsw-n3050/igt@i915_selftest@live_active.html

  * igt@kms_busy@basic-flip-a:
    - fi-kbl-7567u:       [PASS][3] -> [SKIP][4] ([fdo#109271] / [fdo#109278]) +2 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-kbl-7567u/igt@kms_busy@basic-flip-a.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14072/fi-kbl-7567u/igt@kms_busy@basic-flip-a.html

  * igt@vgem_basic@second-client:
    - fi-icl-u3:          [PASS][5] -> [DMESG-WARN][6] ([fdo#107724])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-icl-u3/igt@vgem_basic@second-client.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14072/fi-icl-u3/igt@vgem_basic@second-client.html

  
#### Possible fixes ####

  * igt@gem_ctx_switch@rcs0:
    - {fi-icl-guc}:       [INCOMPLETE][7] ([fdo#107713]) -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-icl-guc/igt@gem_ctx_switch@rcs0.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14072/fi-icl-guc/igt@gem_ctx_switch@rcs0.html

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - fi-icl-u3:          [DMESG-WARN][9] ([fdo#107724]) -> [PASS][10] +1 similar issue
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-icl-u3/igt@i915_pm_rpm@basic-pci-d3-state.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14072/fi-icl-u3/igt@i915_pm_rpm@basic-pci-d3-state.html

  * igt@i915_selftest@live_reset:
    - fi-icl-u3:          [INCOMPLETE][11] ([fdo#107713]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-icl-u3/igt@i915_selftest@live_reset.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14072/fi-icl-u3/igt@i915_selftest@live_reset.html

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

  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#111373]: https://bugs.freedesktop.org/show_bug.cgi?id=111373


Participating hosts (52 -> 44)
------------------------------

  Missing    (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-pnv-d510 fi-icl-y fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_6727 -> Patchwork_14072

  CI-20190529: 20190529
  CI_DRM_6727: 4d570d761e6f6459dbd9dfd9952f4c189e62e756 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5138: b9abe0bf6c478c4f6cac56bff286d6926ad8c0ab @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_14072: fa4560a581b3ee08bdf590a64d917aabcf725f33 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

fa4560a581b3 dma-fence: Store the timestamp in the same union as the cb_list
a11eb4863ead dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
b169d6484e5b dma-fence: Avoid list_del during fence->cb_list iteration
a0349c894fa7 dma-fence: Shrink size of struct dma_fence
a2263cefd9ad dma-buf: Add selftests for dma-fence
68147e4f876c dma-buf: Introduce selftesting framework

== Logs ==

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

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

* ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev3)
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
                   ` (6 preceding siblings ...)
  2019-08-17 15:53 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2019-08-17 15:56 ` Patchwork
  2019-08-17 16:18 ` ✓ Fi.CI.BAT: success " Patchwork
  2019-08-18  9:08 ` ✗ Fi.CI.IGT: failure " Patchwork
  9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-08-17 15:56 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/6] dma-buf: Introduce selftesting framework (rev3)
URL   : https://patchwork.freedesktop.org/series/65353/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
e16973981faa dma-buf: Introduce selftesting framework
-:27: WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully
#27: FILE: drivers/dma-buf/Kconfig:42:
+config DMABUF_SELFTESTS

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

-:50: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/dma-buf/selftest.c', please use '//' instead
#50: FILE: drivers/dma-buf/selftest.c:1:
+/* SPDX-License-Identifier: MIT */

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

-:70: ERROR:BRACKET_SPACE: space prohibited before open square bracket '['
#70: FILE: drivers/dma-buf/selftest.c:21:
+#define selftest(n, f) [__idx_##n] = { .name = #n, .func = f },

-:78: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
#78: FILE: drivers/dma-buf/selftest.c:29:
+};
+#undef selftest

-:82: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon
#82: FILE: drivers/dma-buf/selftest.c:33:
+#define selftest_0(n, func, id) \
+module_param_named(id, selftests[__idx_##n].enabled, bool, 0400);

-:84: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'n' - possible side-effects?
#84: FILE: drivers/dma-buf/selftest.c:35:
+#define selftest(n, func) selftest_0(n, func, param(n))

-:223: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/dma-buf/selftest.h', please use '/*' instead
#223: FILE: drivers/dma-buf/selftest.h:1:
+// SPDX-License-Identifier: MIT

-:223: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
#223: FILE: drivers/dma-buf/selftest.h:1:
+// SPDX-License-Identifier: MIT

-:234: WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon
#234: FILE: drivers/dma-buf/selftest.h:12:
+#define selftest(name, func) int func(void);

-:247: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'T' - possible side-effects?
#247: FILE: drivers/dma-buf/selftest.h:25:
+#define subtests(T, data) \
+	__subtests(__func__, T, ARRAY_SIZE(T), data)

total: 1 errors, 8 warnings, 3 checks, 224 lines checked
7fddd1caea50 dma-buf: Add selftests for dma-fence
-:35: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#35: 
new file mode 100644

-:40: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/dma-buf/st-dma-fence.c', please use '//' instead
#40: FILE: drivers/dma-buf/st-dma-fence.c:1:
+/* SPDX-License-Identifier: MIT */

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

-:60: WARNING:USE_SPINLOCK_T: struct spinlock should be spinlock_t
#60: FILE: drivers/dma-buf/st-dma-fence.c:21:
+	struct spinlock lock;

-:192: WARNING:MEMORY_BARRIER: memory barrier without comment
#192: FILE: drivers/dma-buf/st-dma-fence.c:153:
+	smp_store_mb(container_of(cb, struct simple_cb, cb)->seen, true);

-:500: WARNING:MEMORY_BARRIER: memory barrier without comment
#500: FILE: drivers/dma-buf/st-dma-fence.c:461:
+		smp_wmb();

-:511: WARNING:MEMORY_BARRIER: memory barrier without comment
#511: FILE: drivers/dma-buf/st-dma-fence.c:472:
+		smp_store_mb(cb.seen, false);

-:534: WARNING:MEMORY_BARRIER: memory barrier without comment
#534: FILE: drivers/dma-buf/st-dma-fence.c:495:
+		smp_wmb();

-:599: WARNING:EMBEDDED_FUNCTION_NAME: Prefer using '"%s...", __func__' to using 'dma_fence', this function's name, in a string
#599: FILE: drivers/dma-buf/st-dma-fence.c:560:
+	pr_info("sizeof(dma_fence)=%lu\n", sizeof(struct dma_fence));

total: 0 errors, 9 warnings, 0 checks, 584 lines checked
193bf5443d1e dma-fence: Shrink size of struct dma_fence
-:27: CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment
#27: FILE: include/linux/dma-fence.h:66:
+	spinlock_t *lock;

total: 0 errors, 0 warnings, 1 checks, 21 lines checked
c7c0ee948b31 dma-fence: Avoid list_del during fence->cb_list iteration
1de075a7a6cb dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
3105c8cfc60f dma-fence: Store the timestamp in the same union as the cb_list

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

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

* ✓ Fi.CI.BAT: success for series starting with [1/6] dma-buf: Introduce selftesting framework (rev3)
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
                   ` (7 preceding siblings ...)
  2019-08-17 15:56 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev3) Patchwork
@ 2019-08-17 16:18 ` Patchwork
  2019-08-18  9:08 ` ✗ Fi.CI.IGT: failure " Patchwork
  9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-08-17 16:18 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/6] dma-buf: Introduce selftesting framework (rev3)
URL   : https://patchwork.freedesktop.org/series/65353/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6727 -> Patchwork_14073
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

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

  * igt@kms_busy@basic-flip-a:
    - fi-kbl-7567u:       [PASS][3] -> [SKIP][4] ([fdo#109271] / [fdo#109278]) +2 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-kbl-7567u/igt@kms_busy@basic-flip-a.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/fi-kbl-7567u/igt@kms_busy@basic-flip-a.html

  
#### Possible fixes ####

  * igt@gem_ctx_switch@rcs0:
    - {fi-icl-guc}:       [INCOMPLETE][5] ([fdo#107713]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-icl-guc/igt@gem_ctx_switch@rcs0.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/fi-icl-guc/igt@gem_ctx_switch@rcs0.html

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - fi-icl-u3:          [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8] +1 similar issue
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-icl-u3/igt@i915_pm_rpm@basic-pci-d3-state.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/fi-icl-u3/igt@i915_pm_rpm@basic-pci-d3-state.html

  * igt@i915_selftest@live_reset:
    - fi-icl-u3:          [INCOMPLETE][9] ([fdo#107713]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/fi-icl-u3/igt@i915_selftest@live_reset.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/fi-icl-u3/igt@i915_selftest@live_reset.html

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

  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278


Participating hosts (52 -> 44)
------------------------------

  Missing    (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus fi-kbl-r 


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_6727 -> Patchwork_14073

  CI-20190529: 20190529
  CI_DRM_6727: 4d570d761e6f6459dbd9dfd9952f4c189e62e756 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5138: b9abe0bf6c478c4f6cac56bff286d6926ad8c0ab @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_14073: 3105c8cfc60f6718c86988e9cb297708d836924b @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

3105c8cfc60f dma-fence: Store the timestamp in the same union as the cb_list
1de075a7a6cb dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal
c7c0ee948b31 dma-fence: Avoid list_del during fence->cb_list iteration
193bf5443d1e dma-fence: Shrink size of struct dma_fence
7fddd1caea50 dma-buf: Add selftests for dma-fence
e16973981faa dma-buf: Introduce selftesting framework

== Logs ==

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

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

* ✗ Fi.CI.IGT: failure for series starting with [1/6] dma-buf: Introduce selftesting framework (rev3)
  2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
                   ` (8 preceding siblings ...)
  2019-08-17 16:18 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2019-08-18  9:08 ` Patchwork
  9 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2019-08-18  9:08 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/6] dma-buf: Introduce selftesting framework (rev3)
URL   : https://patchwork.freedesktop.org/series/65353/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6727_full -> Patchwork_14073_full
====================================================

Summary
-------

  **FAILURE**

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

  

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@gem_exec_parallel@bcs0-contexts:
    - shard-hsw:          [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-hsw1/igt@gem_exec_parallel@bcs0-contexts.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-hsw6/igt@gem_exec_parallel@bcs0-contexts.html

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

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

### IGT changes ###

#### Issues hit ####

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

  * igt@gem_exec_balancer@smoke:
    - shard-iclb:         [PASS][5] -> [SKIP][6] ([fdo#110854])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb2/igt@gem_exec_balancer@smoke.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb7/igt@gem_exec_balancer@smoke.html

  * igt@gem_exec_schedule@preempt-other-chain-bsd:
    - shard-iclb:         [PASS][7] -> [SKIP][8] ([fdo#111325]) +6 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb3/igt@gem_exec_schedule@preempt-other-chain-bsd.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb1/igt@gem_exec_schedule@preempt-other-chain-bsd.html

  * igt@gem_exec_schedule@preemptive-hang-vebox:
    - shard-glk:          [PASS][9] -> [INCOMPLETE][10] ([fdo#103359] / [k.org#198133])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-glk3/igt@gem_exec_schedule@preemptive-hang-vebox.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-glk6/igt@gem_exec_schedule@preemptive-hang-vebox.html

  * igt@i915_pm_rc6_residency@rc6-accuracy:
    - shard-snb:          [PASS][11] -> [SKIP][12] ([fdo#109271])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-snb1/igt@i915_pm_rc6_residency@rc6-accuracy.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-snb4/igt@i915_pm_rc6_residency@rc6-accuracy.html

  * igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
    - shard-hsw:          [PASS][13] -> [FAIL][14] ([fdo#105767])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-hsw2/igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-hsw4/igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy.html

  * igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy:
    - shard-glk:          [PASS][15] -> [FAIL][16] ([fdo#104873])
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-glk2/igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-glk4/igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy.html

  * igt@kms_flip@2x-flip-vs-panning:
    - shard-hsw:          [PASS][17] -> [INCOMPLETE][18] ([fdo#103540]) +1 similar issue
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-hsw6/igt@kms_flip@2x-flip-vs-panning.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-hsw4/igt@kms_flip@2x-flip-vs-panning.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
    - shard-iclb:         [PASS][19] -> [FAIL][20] ([fdo#103167]) +7 similar issues
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

  * igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
    - shard-skl:          [PASS][21] -> [FAIL][22] ([fdo#103191])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-skl7/igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-skl6/igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence.html

  * igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
    - shard-skl:          [PASS][23] -> [FAIL][24] ([fdo#108145] / [fdo#110403]) +1 similar issue
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-skl3/igt@kms_plane_alpha_blend@pipe-c-coverage-7efc.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-skl4/igt@kms_plane_alpha_blend@pipe-c-coverage-7efc.html

  * igt@kms_psr@psr2_cursor_blt:
    - shard-iclb:         [PASS][25] -> [SKIP][26] ([fdo#109441]) +2 similar issues
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb2/igt@kms_psr@psr2_cursor_blt.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb7/igt@kms_psr@psr2_cursor_blt.html

  * igt@kms_rotation_crc@sprite-rotation-270:
    - shard-skl:          [PASS][27] -> [DMESG-WARN][28] ([fdo#106107])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-skl2/igt@kms_rotation_crc@sprite-rotation-270.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-skl9/igt@kms_rotation_crc@sprite-rotation-270.html

  * igt@kms_vblank@pipe-a-query-forked-busy-hang:
    - shard-apl:          [PASS][29] -> [INCOMPLETE][30] ([fdo#103927]) +2 similar issues
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-apl7/igt@kms_vblank@pipe-a-query-forked-busy-hang.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-apl7/igt@kms_vblank@pipe-a-query-forked-busy-hang.html

  * igt@kms_vblank@pipe-c-ts-continuation-suspend:
    - shard-skl:          [PASS][31] -> [INCOMPLETE][32] ([fdo#104108])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-skl4/igt@kms_vblank@pipe-c-ts-continuation-suspend.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-skl2/igt@kms_vblank@pipe-c-ts-continuation-suspend.html

  * igt@prime_vgem@fence-wait-bsd2:
    - shard-iclb:         [PASS][33] -> [SKIP][34] ([fdo#109276]) +22 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb1/igt@prime_vgem@fence-wait-bsd2.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb8/igt@prime_vgem@fence-wait-bsd2.html

  
#### Possible fixes ####

  * igt@gem_ctx_switch@all-light:
    - shard-iclb:         [INCOMPLETE][35] ([fdo#107713]) -> [PASS][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb5/igt@gem_ctx_switch@all-light.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb7/igt@gem_ctx_switch@all-light.html

  * igt@gem_eio@reset-stress:
    - shard-skl:          [FAIL][37] ([fdo#109661]) -> [PASS][38]
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-skl4/igt@gem_eio@reset-stress.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-skl2/igt@gem_eio@reset-stress.html

  * igt@gem_exec_schedule@independent-bsd2:
    - shard-iclb:         [SKIP][39] ([fdo#109276]) -> [PASS][40] +14 similar issues
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb8/igt@gem_exec_schedule@independent-bsd2.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb1/igt@gem_exec_schedule@independent-bsd2.html

  * igt@gem_exec_schedule@preempt-queue-bsd:
    - shard-iclb:         [SKIP][41] ([fdo#111325]) -> [PASS][42] +2 similar issues
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb1/igt@gem_exec_schedule@preempt-queue-bsd.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb8/igt@gem_exec_schedule@preempt-queue-bsd.html

  * igt@gem_workarounds@suspend-resume-context:
    - shard-apl:          [DMESG-WARN][43] ([fdo#108566]) -> [PASS][44] +3 similar issues
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-apl3/igt@gem_workarounds@suspend-resume-context.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-apl1/igt@gem_workarounds@suspend-resume-context.html

  * igt@i915_pm_rpm@gem-mmap-cpu:
    - shard-iclb:         [INCOMPLETE][45] ([fdo#107713] / [fdo#108840]) -> [PASS][46]
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb2/igt@i915_pm_rpm@gem-mmap-cpu.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb3/igt@i915_pm_rpm@gem-mmap-cpu.html

  * igt@kms_cursor_legacy@cursora-vs-flipa-atomic-transitions:
    - shard-apl:          [INCOMPLETE][47] ([fdo#103927]) -> [PASS][48] +5 similar issues
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-apl4/igt@kms_cursor_legacy@cursora-vs-flipa-atomic-transitions.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-apl8/igt@kms_cursor_legacy@cursora-vs-flipa-atomic-transitions.html

  * igt@kms_flip@flip-vs-panning-vs-hang-interruptible:
    - shard-skl:          [DMESG-WARN][49] ([fdo#106107]) -> [PASS][50]
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-skl7/igt@kms_flip@flip-vs-panning-vs-hang-interruptible.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-skl6/igt@kms_flip@flip-vs-panning-vs-hang-interruptible.html

  * igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite:
    - shard-iclb:         [FAIL][51] ([fdo#103167]) -> [PASS][52] +8 similar issues
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb6/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb8/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-rte:
    - shard-iclb:         [FAIL][53] ([fdo#103167] / [fdo#110378]) -> [PASS][54]
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-rte.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb7/igt@kms_frontbuffer_tracking@fbcpsr-1p-rte.html

  * igt@kms_plane@plane-position-covered-pipe-a-planes:
    - shard-snb:          [SKIP][55] ([fdo#109271]) -> [PASS][56] +2 similar issues
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-snb7/igt@kms_plane@plane-position-covered-pipe-a-planes.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-snb7/igt@kms_plane@plane-position-covered-pipe-a-planes.html

  * igt@kms_psr@psr2_cursor_mmap_cpu:
    - shard-iclb:         [SKIP][57] ([fdo#109441]) -> [PASS][58] +3 similar issues
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb7/igt@kms_psr@psr2_cursor_mmap_cpu.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html

  * igt@kms_setmode@basic:
    - shard-hsw:          [FAIL][59] ([fdo#99912]) -> [PASS][60]
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-hsw4/igt@kms_setmode@basic.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-hsw6/igt@kms_setmode@basic.html
    - shard-kbl:          [FAIL][61] ([fdo#99912]) -> [PASS][62]
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-kbl6/igt@kms_setmode@basic.html
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-kbl7/igt@kms_setmode@basic.html

  * igt@kms_vblank@pipe-c-ts-continuation-suspend:
    - shard-kbl:          [INCOMPLETE][63] ([fdo#103665]) -> [PASS][64]
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-kbl3/igt@kms_vblank@pipe-c-ts-continuation-suspend.html
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-kbl2/igt@kms_vblank@pipe-c-ts-continuation-suspend.html

  * igt@perf@polling:
    - shard-skl:          [FAIL][65] ([fdo#110728]) -> [PASS][66]
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-skl6/igt@perf@polling.html
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-skl9/igt@perf@polling.html

  * igt@tools_test@tools_test:
    - shard-kbl:          [SKIP][67] ([fdo#109271]) -> [PASS][68]
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-kbl4/igt@tools_test@tools_test.html
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-kbl6/igt@tools_test@tools_test.html

  
#### Warnings ####

  * igt@gem_ctx_isolation@vcs1-nonpriv:
    - shard-iclb:         [FAIL][69] ([fdo#111329]) -> [SKIP][70] ([fdo#109276])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb4/igt@gem_ctx_isolation@vcs1-nonpriv.html
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb3/igt@gem_ctx_isolation@vcs1-nonpriv.html

  * igt@gem_mocs_settings@mocs-isolation-bsd2:
    - shard-iclb:         [SKIP][71] ([fdo#109276]) -> [FAIL][72] ([fdo#111330])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6727/shard-iclb6/igt@gem_mocs_settings@mocs-isolation-bsd2.html
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14073/shard-iclb4/igt@gem_mocs_settings@mocs-isolation-bsd2.html

  
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
  [fdo#104873]: https://bugs.freedesktop.org/show_bug.cgi?id=104873
  [fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
  [fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
  [fdo#110378]: https://bugs.freedesktop.org/show_bug.cgi?id=110378
  [fdo#110403]: https://bugs.freedesktop.org/show_bug.cgi?id=110403
  [fdo#110728]: https://bugs.freedesktop.org/show_bug.cgi?id=110728
  [fdo#110854]: https://bugs.freedesktop.org/show_bug.cgi?id=110854
  [fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
  [fdo#111329]: https://bugs.freedesktop.org/show_bug.cgi?id=111329
  [fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


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

  No changes in participating hosts


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

  * CI: CI-20190529 -> None
  * Linux: CI_DRM_6727 -> Patchwork_14073

  CI-20190529: 20190529
  CI_DRM_6727: 4d570d761e6f6459dbd9dfd9952f4c189e62e756 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5138: b9abe0bf6c478c4f6cac56bff286d6926ad8c0ab @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_14073: 3105c8cfc60f6718c86988e9cb297708d836924b @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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

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

end of thread, other threads:[~2019-08-18  9:08 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-17 14:47 [PATCH 1/6] dma-buf: Introduce selftesting framework Chris Wilson
2019-08-17 14:47 ` [PATCH 2/6] dma-buf: Add selftests for dma-fence Chris Wilson
2019-08-17 14:47 ` [PATCH 3/6] dma-fence: Shrink size of struct dma_fence Chris Wilson
2019-08-17 14:47 ` [PATCH 4/6] dma-fence: Avoid list_del during fence->cb_list iteration Chris Wilson
2019-08-17 14:47 ` [PATCH 5/6] dma-fence: Simply wrap dma_fence_signal_locked with dma_fence_signal Chris Wilson
2019-08-17 15:16   ` Koenig, Christian
2019-08-17 15:23   ` [PATCH v3] " Chris Wilson
2019-08-17 15:25     ` Koenig, Christian
2019-08-17 14:47 ` [PATCH 6/6] dma-fence: Store the timestamp in the same union as the cb_list Chris Wilson
2019-08-17 15:20   ` Koenig, Christian
2019-08-17 15:27     ` Chris Wilson
2019-08-17 15:31       ` Koenig, Christian
2019-08-17 15:30   ` [PATCH v2] " Chris Wilson
2019-08-17 15:40     ` Koenig, Christian
2019-08-17 15:30 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev2) Patchwork
2019-08-17 15:53 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-17 15:56 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] dma-buf: Introduce selftesting framework (rev3) Patchwork
2019-08-17 16:18 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-18  9:08 ` ✗ Fi.CI.IGT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.