Quoting Tvrtko Ursulin (2017-11-15 09:11:13) > > On 14/11/2017 21:56, Chris Wilson wrote: > > We should long past the time of trying to use wait_for() from inside > > atomic contexts, so add a might_sleep() check to prevent misuse. > > > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > > Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > > --- > > drivers/gpu/drm/i915/intel_drv.h | 11 ++--------- > > 1 file changed, 2 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > > index fd64a5e8ea12..a898ded7efe9 100644 > > --- a/drivers/gpu/drm/i915/intel_drv.h > > +++ b/drivers/gpu/drm/i915/intel_drv.h > > @@ -47,14 +47,11 @@ > > * contexts. Note that it's important that we check the condition again after > > * having timed out, since the timeout could be due to preemption or similar and > > * we've never had a chance to check the condition before the timeout. > > - * > > - * TODO: When modesetting has fully transitioned to atomic, the below > > - * drm_can_sleep() can be removed and in_atomic()/!in_atomic() asserts > > - * added. > > */ > > #define _wait_for(COND, US, W) ({ \ > > unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ > > int ret__; \ > > + might_sleep(); \ > > for (;;) { \ > > bool expired__ = time_after(jiffies, timeout__); \ > > if (COND) { \ > > @@ -65,11 +62,7 @@ > > ret__ = -ETIMEDOUT; \ > > break; \ > > } \ > > - if ((W) && drm_can_sleep()) { \ > > - usleep_range((W), (W)*2); \ > > - } else { \ > > - cpu_relax(); \ > > - } \ > > + usleep_range((W), (W)*2); \ > > } \ > > ret__; \ > > }) > > > > Seems OK under my understanding how things work at least. > > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> > Thanks for the review. Maarten also gave his r-b on irc, and with an all green pw run, pushed. We now have no more drm_can_sleep() in i915! No more in_atomic() policy violations! -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx