another interesting lock recursion!

Daniel Vetter daniel at ffwll.ch
Tue Mar 25 03:49:22 PDT 2014


On Tue, Mar 25, 2014 at 08:05:30PM +1000, Dave Airlie wrote:
> On Tue, Mar 25, 2014 at 6:24 PM, Daniel Vetter <daniel at ffwll.ch> wrote:
> > On Tue, Mar 25, 2014 at 6:53 AM, Dave Airlie <airlied at gmail.com> wrote:
> >> So with runtime pm on nouveau, if the card gets powered down, and then
> >> you access a connector via sysfs,
> >>
> >> drm_sysfs.c:status_show locks the connector and calls into the driver,
> >> the driver then does a runtime_get_sync, which causes resume to happen
> >> which causes modesetting to reset the mode, which tries to take all
> >> the locks, and it all deadlocks in a pile,
> >>
> >> Ideas to fix this, move the runtime_get_sync into the drm_sysfs code,
> >> or allow the drivers to provide their own status show functions,
> >> moving the runtime get into the sysfs code probably involves having
> >> conditionals for device that support runtime PM at all, otherwise who
> >> knows what might happen,
> >
> > You need special runtime suspend/resume functions so that sysfs access
> > doesn't try to resurrect the world by accident (and so goes into the
> > modeset code when not needed). i915 runtime PM does that and a lot
> > more (we can runtime suspend even when the device is open, debugfs,
> > sysfs, i2c and any other probing and poking just wake up the minimal
> > parts of the device and state and so on ...). If you look at our
> > runtime_suspend/resum functions there's very little we actually do ...
> 
> Our runtime pm is completely different than i915, since the chip is
> completely off, with a hard power switch which the GPU isn't aware off
> so we have to switch it back on again and post it do anything, even
> probe a connector, and if you post it you may as well reset the mode,
> granted maybe we don't need to care about the modeset I might play a
> bit tomorrow with just removing the modeset from the runtime resume
> path.

Imo if you runtime suspend while there's something being displayed users
will get angry ;-) So there shouldn't be any need to restore modeset state
really, hence why you need to split system suspend/resume from runtime
suspend resume.

And even though i915 doesn't forget quite everything we also need to put
pretty much all the hw state back in upon system resume (i.e. pretty much
all the registers are gone), so fundametally I don't see that big a
difference. Of course since this is integrated gfx we don't have to reinit
the memory controller and stuff like that, since that's outside of the
gfx.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list