[Pm-utils] upower/pm-utils deadlock when pm-suspend called by upowerd

Victor Lowther victor.lowther at gmail.com
Tue Jun 22 16:33:19 PDT 2010


On Tue, 2010-06-22 at 12:54 +0200, Vincent Untz wrote:
> Hi,
> 
> (I'm not subscribed, please cc me if you need input from me :-))
> 
> There's a nice deadlock when pm-suspend is called by upowerd:
> 
>  + upowerd calls pm-suspend with g_spawn_sync(). That's because it wants
>    to know if the call failed to return an error via dbus if needed.
> 
>  + pm-suspend suspends, everything is happy. Then it resumes.
> 
>  + the /usr/lib/pm-utils/sleep.d/00powersave hook calls pm-powersave
>    with no argument
> 
>  + pm-powersave needs to know if the computer is on battery or not. So
>    it calls on_ac_power.
> 
>  + on_ac_power knows that upower is cool, so it asks upower via dbus if
>    the computer is on battery... except that upowerd is still blocked in
>    g_spawn_sync()
> 
> The results of this is that the calling process is blocked for some time
> (a dbus timeout), which can result in ugly ghost windows. See
> https://bugzilla.novell.com/show_bug.cgi?id=615646 for example.
> 
> Richard is thinking that the pm-powersave part might be better handled
> by upowerd itself instead of a hook for pm-suspend...

pm-utils is supposed to be lower level than upowerd.  Since we no longer
rely on hal, we should just teach on_ac_power how to get what we need
straight from sysfs.

It looks pretty strightforward, I will have a patch shortly.

> Cheers,
> 
> Vincent
> 

-- 
Victor Lowther
LPIC2 UCP RHCE 


More information about the Pm-utils mailing list