Commit fe3288b5 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Park the breadcrumbs signaler across a GPU reset

The signal threads may be running concurrently with the GPU reset. The
completion from the GPU run asynchronous with the reset and two threads
may see different snapshots of the state, and the signaler may mark a
request as complete as we try to reset it. We don't tolerate 2 different
views of the same state and complain if we try to mark a request as
failed if it is already complete. Disable the signal threads during
reset to prevent this conflict (even though the conflict implies that
the state we resetting to is invalid, we have already made our
decision!).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99733
References: https://bugs.freedesktop.org/show_bug.cgi?id=99671Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170212172002.23072-4-chris@chris-wilson.co.ukReviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
parent 1d309634
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "intel_frontbuffer.h" #include "intel_frontbuffer.h"
#include "intel_mocs.h" #include "intel_mocs.h"
#include <linux/dma-fence-array.h> #include <linux/dma-fence-array.h>
#include <linux/kthread.h>
#include <linux/reservation.h> #include <linux/reservation.h>
#include <linux/shmem_fs.h> #include <linux/shmem_fs.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -2643,6 +2644,17 @@ int i915_gem_reset_prepare(struct drm_i915_private *dev_priv) ...@@ -2643,6 +2644,17 @@ int i915_gem_reset_prepare(struct drm_i915_private *dev_priv)
for_each_engine(engine, dev_priv, id) { for_each_engine(engine, dev_priv, id) {
struct drm_i915_gem_request *request; struct drm_i915_gem_request *request;
/* Prevent the signaler thread from updating the request
* state (by calling dma_fence_signal) as we are processing
* the reset. The write from the GPU of the seqno is
* asynchronous and the signaler thread may see a different
* value to us and declare the request complete, even though
* the reset routine have picked that request as the active
* (incomplete) request. This conflict is not handled
* gracefully!
*/
kthread_park(engine->breadcrumbs.signaler);
/* Prevent request submission to the hardware until we have /* Prevent request submission to the hardware until we have
* completed the reset in i915_gem_reset_finish(). If a request * completed the reset in i915_gem_reset_finish(). If a request
* is completed by one engine, it may then queue a request * is completed by one engine, it may then queue a request
...@@ -2796,8 +2808,10 @@ void i915_gem_reset_finish(struct drm_i915_private *dev_priv) ...@@ -2796,8 +2808,10 @@ void i915_gem_reset_finish(struct drm_i915_private *dev_priv)
lockdep_assert_held(&dev_priv->drm.struct_mutex); lockdep_assert_held(&dev_priv->drm.struct_mutex);
for_each_engine(engine, dev_priv, id) for_each_engine(engine, dev_priv, id) {
tasklet_enable(&engine->irq_tasklet); tasklet_enable(&engine->irq_tasklet);
kthread_unpark(engine->breadcrumbs.signaler);
}
} }
static void nop_submit_request(struct drm_i915_gem_request *request) static void nop_submit_request(struct drm_i915_gem_request *request)
......
...@@ -490,6 +490,9 @@ static int intel_breadcrumbs_signaler(void *arg) ...@@ -490,6 +490,9 @@ static int intel_breadcrumbs_signaler(void *arg)
break; break;
schedule(); schedule();
if (kthread_should_park())
kthread_parkme();
} }
} while (1); } while (1);
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment