> From: Theo de Raadt <[email protected]>
> Date: Fri, 07 Mar 2014 10:00:41 -0700
> 
> > My hopethesis about what's causing the problem here is that during the
> > DVACT_WAKEUP phase, some drivers actually sleep and that userland
> > processes actually get to run.
> 
> Yes, that is my theory too, about this specific driver.  Let's follow
> that thought.  If in DVACT_WAKEUP phase it is sleeping, then it follows
> that the previous code path through DVACT_RESUME was sleeping as well.
> And hitting that incredibly evil "if (cold) return;" path.

Not necessarily, could be a tsleep in a DVACT_WAKEUP handler of an
other driver that makes us do the context switch.  The cold = 2 diff
didn't reveal any tsleeps in inteldrm on my x220.  But then I never
had any issues here either.  Perhaps somebody who can reproduce the
problem should run the cold = 2 diff.

Also note that not all tsleeps are necessarily bad in DVACT_RESUME
handlers.  In some cases hardware needs to be polled and we don't want
to busy wait for that.  Although you could argue that instead of
calling tsleep we should roll our own function that does a delay or a
tsleep depending on the context.

> > This causes the X server (directly or
> > indirectly) to issue some drm ioctls when the hardware isn't quite
> > ready to deal with this, making the ioctl return with an error.  And
> > the xf86-video-intel driver doesn't deal with this very well.  The
> > question here is who is at fault here: the kernel (because it
> > shouldn't make the ioctl fail or perhaps make it fail with a different
> > error code), or the xf86-video-intel driver because it should
> > recognize this as a temporary failure and try again later.
> 
> Well, the DVACT_WAKEUP should have finished it's job.  The device-tree
> walking does not make progress until everyone wakes up, serially.  Something
> went wrong in that path.

DVACT_WAKEUP does finish its job.  It's just that it is doing so while
kernel threads and userland processes are running as well.  Drivers
need to be aware of this, and I'm not sure they all are.

Reply via email to