[Intel-gfx] [PATCH 09/46] drm/i915: Add unit tests for the breadcrumb rbtree, wakeups

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 2 13:02:55 UTC 2017


On Thu, Feb 02, 2017 at 12:49:58PM +0000, Tvrtko Ursulin wrote:
> 
> On 02/02/2017 09:08, Chris Wilson wrote:
> >+static bool wait_for_ready(struct igt_wakeup *w)
> >+{
> >+	DEFINE_WAIT(ready);
> >+
> >+	if (atomic_dec_and_test(w->done))
> >+		wake_up_atomic_t(w->done);
> >+
> >+	if (test_bit(STOP, &w->flags))
> >+		goto out;
> >+
> >+	set_bit(IDLE, &w->flags);
> 
> I think this needs to be before atomic_dec_and_test(w->done), to
> avoid that same assert racing with the threads. Because immediately
> after the wake_up_atomic above the main loop starts asserting the
> IDLE bit which is not guaranteed to be set yet.

Before wake_up_atomic_t which is the same thing, yup.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list