upowerd locks up, crashing X, with optimus hybrid graphics in power saving mode

Bug #1087175 reported by David Schoen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upower (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have an interaction problem between upowerd and Optimus Hybrid graphics drivers.

I think potentially this should be split in to a few bugs (i.e. the kernel video driver should probably respond with something whether or not the card does, upowerd shouldn't fail because of a buggy driver and GDM/X shouldn't become unresponsive due to upowerd failing), but thought I'd start with this one to get feedback.

Summary of what's happening: When I have the discrete video card powered off to save power, upowerd attempts to read from a file in sys that does not respond and can cause GDM/X to lock up when it attempts to talk to upowerd.

Detail and testing strategy follows...

To make the laptop stable I have disabled upowerd with:
: # mv /usr/lib/upower/upowerd{,.disabled}
and then booted up.

Without doing this I can not login because the laptop crashes quickly after displaying the GDM login prompt (and poking around from another laptop over ssh indicated upowerd might be up to something).

I have an Optimus (hybrid) video card that is not well supported under Ubuntu (Linux generally) so to save power I keep the discrete (DIS) component powered off:
: # cat /sys/kernel/debug/vgaswitcheroo/switch
: 0:IGD:+:Pwr:0000:00:02.0
: 1:DIS: :Off:0000:01:00.0

If I switch it on:
: # echo ON > /sys/kernel/debug/vgaswitcheroo/switch
: # cat /sys/kernel/debug/vgaswitcheroo/switch
: 0:IGD:+:Pwr:0000:00:02.0
: 1:DIS: :Pwr:0000:01:00.0

and then let upowerd start:
: # strace -f -o upowerd_vid-on.strace /usr/lib/upower/upowerd.disabled
... everything seems to behave just fine.

However if I turn the discrete card back off:
: # echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
: # cat /sys/kernel/debug/vgaswitcheroo/switch
: 0:IGD:+:Pwr:0000:00:02.0
: 1:DIS: :Off:0000:01:00.0

and then start it again:
: # strace -f -o upowerd_vid-off.strace /usr/lib/upower/upowerd.disabled

My %sy (system cpu) in top goes up to 75% for 1 core and load average continually rises (I'm guessing this is due to random process on the system trying to talk to an unresponsive upowerd). Any processes that have anything at all to do with upowerd seem to get stuck, e.g. niether the strace or a tail following its output can be killed with ^C and they sit in either sleeping or waiting on disk states:
: # ps aux | egrep 'strace|tail|upowerd' | grep -v grep
: root 6444 0.0 0.0 4648 824 pts/0 S+ 19:01 0:00 strace -f -o upowerd_vid-off.strace /usr/lib/upower/upowerd.disabled
: root 6445 0.0 0.0 220176 4572 pts/0 Rl+ 19:01 0:00 /usr/lib/upower/upowerd.disabled
: root 6470 0.0 0.0 0 0 pts/3 D+ 19:01 0:00 [tail]

(tail will not even respond to "kill -9 ...").

... at which point I can enable the discrete card again:
: # echo ON > /sys/kernel/debug/vgaswitcheroo/switch
and all of the processes die and the load average drops.

The interesting lines from the strace are:
: 6445 lstat("/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1/card1-VGA-2/status", {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
: 6445 open("/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1/card1-VGA-2/status", O_RDONLY|O_CLOEXEC) = 14
: 6445 read(14,
basically: upowerd tried to do a blocking read from "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1/card1-VGA-2/status" and nothing happened (it sits there indefinitely).

Isolating a little further, I've found that I can cat from the file upowerd is attempting to read from with the discrete card on:
: # echo ON > /sys/kernel/debug/vgaswitcheroo/switch
: # cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1/card1-VGA-2/status
: connected
but with it off, cat stalls indefinitely (which is why I think I may need to lodge another bug around the driver):
: # echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
: # cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1/card1-VGA-2/status

If I enable the card from another console I get "disconnected" echo'd back from the "cat" call.

I've tested cat stalling in 3.2.0-{34,32,23}-generic and gotten the same behavior.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: upower 0.9.15-3git1
ProcVersionSignature: Ubuntu 3.2.0-34.53-generic 3.2.33
Uname: Linux 3.2.0-34-generic x86_64
ApportVersion: 2.0.1-0ubuntu15
Architecture: amd64
Date: Thu Dec 6 19:54:21 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
MarkForUpload: True
SourcePackage: upower
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
David Schoen (neerolyte) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.