summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_utils.h
diff options
context:
space:
mode:
authorChris Wilson2017-10-06 12:40:38 +0200
committerChris Wilson2017-10-06 18:49:46 +0200
commit7c26240e8a19240924b029215989f28995f16d8c (patch)
treef16c43f466b110831a435c0ed61a7c1a93892328 /drivers/gpu/drm/i915/i915_utils.h
parentdrm/i915: Fix pointer-to-int conversion (diff)
downloadkernel-qcow2-linux-7c26240e8a19240924b029215989f28995f16d8c.tar.gz
kernel-qcow2-linux-7c26240e8a19240924b029215989f28995f16d8c.tar.xz
kernel-qcow2-linux-7c26240e8a19240924b029215989f28995f16d8c.zip
drm/i915: Try harder to finish the idle-worker
If a worker requeues itself, it may switch to a different kworker pool, which flush_work() considers as complete. To be strict, we then need to keep flushing the work until it is no longer pending. References: https://bugs.freedesktop.org/show_bug.cgi?id=102456 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171006104038.22337-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_utils.h')
-rw-r--r--drivers/gpu/drm/i915/i915_utils.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index c242327d5217..af3d7cc53fa1 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -124,4 +124,17 @@ static inline void __list_del_many(struct list_head *head,
WRITE_ONCE(head->next, first);
}
+/*
+ * Wait until the work is finally complete, even if it tries to postpone
+ * by requeueing itself. Note, that if the worker never cancels itself,
+ * we will spin forever.
+ */
+static inline void drain_delayed_work(struct delayed_work *dw)
+{
+ do {
+ while (flush_delayed_work(dw))
+ ;
+ } while (delayed_work_pending(dw));
+}
+
#endif /* !__I915_UTILS_H */