Bug 23592 - Radeon tries to execute atombios on a card powered off by vgaswitcheroo
Summary: Radeon tries to execute atombios on a card powered off by vgaswitcheroo
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - non Intel) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Dave Airlie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-23 00:22 UTC by Javier S. Pedro
Modified: 2012-06-13 14:58 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.34+
Tree: Mainline
Regression: No


Attachments
dmesg with added WARN_ON() on atom_execute_table_locked (13.15 KB, text/plain)
2010-11-23 00:22 UTC, Javier S. Pedro
Details
attempt at fix by avoiding hitting the radeon driver. (2.39 KB, patch)
2011-04-05 08:07 UTC, Dave Airlie
Details | Diff

Description Javier S. Pedro 2010-11-23 00:22:28 UTC
Created attachment 37912 [details]
dmesg with added WARN_ON() on atom_execute_table_locked

During Xorg shutdown, dmesg gets filled with lots of repeating:

[  101.804993] [drm:atom_op_jump] *ERROR* atombios stuck in loop for more than 5secs aborting
[  101.805045] [drm:atom_execute_table_locked] *ERROR* atombios stuck executing CD0C (len 62, WS 0, PS 0) @ 0xCD28

Xorg does NOT terminate properly until after a handful of these messages, so the system takes a long time to shutdown.

Steps to reproduce, on a Acer 5820TG (Intel Clarkdale+Radeon Evergreen switchable graphics):
1. Boot kernel with vgaswitcheroo enabled.
2. Start Xorg with no xorg.conf. Defaults to using Intel card.
3. While Xorg is running, echo OFF > /sys/kernel/debug/vgaswitcheroo/switch (powers off the Radeon card).
4. Try to quit Xorg (either by SIGTERM or Zap key sequence).

Expected result:
Xorg quits in a few seconds

Actual results:
Lots of messages on dmesg, Xorg takes minutes to die.


For convenience, I added a WARN_ON() on atom_execute_table_locked() right where it printks the above warning message. The resulting backtrace is attached.

Seemingly, drm_helper_disable_unused_functions is called by the Intel driver which ends up calling some Readeon DPMS functions (atombios_crtc_disable) which eventually try to run Atombios code while rdev->powered_down is TRUE. 

A trivial workaround is to patch atombios_crtc_disable and do nothing if rdev->powered_down is TRUE. That works for me but I don't really know if it's exactly the ideal solution.
Comment 1 Dave Airlie 2011-04-05 08:07:05 UTC
Created attachment 53542 [details]
attempt at fix by avoiding hitting the radeon driver.
Comment 2 Florian Mickler 2011-04-19 08:44:33 UTC
A patch referencing this bug report has been merged in v2.6.39-rc4:

commit 0a0883c8433c743dad0a4d9ebe2717558f2c209e
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Apr 5 17:57:23 2011 +1000

    i915: restore only the mode of this driver on lastclose
Comment 3 Javier S. Pedro 2011-04-19 15:16:45 UTC
The attached patch also applied cleanly to 2.6.37 and worked for me.
Comment 4 Florian Mickler 2011-04-20 06:57:48 UTC
It is not marked as immediate stable backport. 

Please ping Dave Airlie (the drm maintainer) and Chris Wilson (i915) if this is already on it's way to the stable kernels.
Comment 5 Dave Airlie 2011-04-20 07:50:57 UTC
I actually reverted it for another patch that I'll get in really soon.
Comment 6 Florian Mickler 2011-04-20 10:14:13 UTC
A patch referencing a commit referencing this bug report has been merged in v2.6.39-rc4:

commit 2582b6efceb43dce63b4a1090d289934067a972d
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed Apr 13 09:20:24 2011 +1000

    Revert "i915: restore only the mode of this driver on lastclose"
Comment 7 Florian Mickler 2011-04-20 10:19:13 UTC
( I updated my script... not sure if that is overdoing it though... :) )

Note You need to log in before you can comment on or make changes to this bug.