drm/i915: Park the signaler before sleeping
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 3 Apr 2017 10:51:24 +0000 (11:51 +0100)
committerJani Nikula <jani.nikula@intel.com>
Wed, 26 Apr 2017 13:27:52 +0000 (16:27 +0300)
If the signal to park arrives before we sleep, then we need to check
kthread_should_park() before sleeping to avoid missing the signal.
Otherwise, if the signal arrives whilst we are processing completed
requests, we will reset the current->state back to TASK_INTERRUPTIBLE
and so miss the wakeup.

Fixes: fe3288b5da2c ("drm/i915: Park the breadcrumbs signaler across a GPU reset")
Signed-off-by: Chris 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/20170403105124.8969-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
(cherry picked from commit b1becb88268beb72df6495e35d3d76c138d215bb)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/intel_breadcrumbs.c

index b6ea192ad5500809dc38f5d6d3927a9e111e6b8b..308c56a021abb5f4a3634e665e2161444016951c 100644 (file)
@@ -629,6 +629,9 @@ static int intel_breadcrumbs_signaler(void *arg)
                } else {
                        DEFINE_WAIT(exec);
 
+                       if (kthread_should_park())
+                               kthread_parkme();
+
                        if (kthread_should_stop()) {
                                GEM_BUG_ON(request);
                                break;
@@ -641,9 +644,6 @@ static int intel_breadcrumbs_signaler(void *arg)
 
                        if (request)
                                remove_wait_queue(&request->execute, &exec);
-
-                       if (kthread_should_park())
-                               kthread_parkme();
                }
                i915_gem_request_put(request);
        } while (1);