Bug 53111 - vgaswitcheroo not working anymore
Summary: vgaswitcheroo not working anymore
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - non Intel) (show other bugs)
Hardware: All Linux
: P1 high
Assignee: drivers_video-dri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-27 17:16 UTC by cem.aydin
Modified: 2013-11-18 16:23 UTC (History)
5 users (show)

See Also:
Kernel Version: 3.7.4
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Workaround (405 bytes, patch)
2013-02-19 14:55 UTC, Aleksandr Mezin
Details | Diff
Print atpx function mask (651 bytes, patch)
2013-02-19 15:36 UTC, Alex Deucher
Details | Diff
possible fix (3.30 KB, patch)
2013-02-19 18:02 UTC, Alex Deucher
Details | Diff

Description cem.aydin 2013-01-27 17:16:52 UTC
I hope this is the right place to report this.

After update from 3.6.11-1 to 3.7.4-1 on Arch Linux vgaswitcheroo stopped working.

Downgrading to the previous kernel version (see above) solves the issue.

Unfortunately according to the logs it should be working. However I'm sure it does not cause the temperatures are >10°C higher than they should be (w/o load and CPU at lowest frequency). This is exactly the same behaviour as if I were not using vgaswitcheroo at all.

Output:
[root@hplaptop ~]# journalctl -b |grep switcheroo
Jan 27 17:59:44 hplaptop kernel: VGA switcheroo: detected switching method \_SB_.PCI0.GFX0.ATPX handle
Jan 27 17:59:44 hplaptop kernel: vga_switcheroo: enabled

[root@hplaptop ~]# journalctl -b |grep radeon
Jan 27 17:59:44 hplaptop kernel: [drm] radeon defaulting to kernel modesetting.
Jan 27 17:59:44 hplaptop kernel: [drm] radeon kernel modesetting enabled.
Jan 27 17:59:44 hplaptop kernel: radeon 0000:01:00.0: enabling device (0000 -> 0003)
Jan 27 17:59:44 hplaptop kernel: radeon 0000:01:00.0: VRAM: 1024M 0x0000000000000000 - 0x000000003FFFFFFF (1024M used)
Jan 27 17:59:44 hplaptop kernel: radeon 0000:01:00.0: GTT: 512M 0x0000000040000000 - 0x000000005FFFFFFF
Jan 27 17:59:44 hplaptop kernel: [drm] radeon: 1024M of VRAM memory ready
Jan 27 17:59:44 hplaptop kernel: [drm] radeon: 512M of GTT memory ready.
Jan 27 17:59:44 hplaptop kernel: radeon 0000:01:00.0: irq 46 for MSI/MSI-X
Jan 27 17:59:44 hplaptop kernel: radeon 0000:01:00.0: radeon: using MSI.
Jan 27 17:59:44 hplaptop kernel: [drm] radeon: irq initialized.
Jan 27 17:59:44 hplaptop kernel: radeon 0000:01:00.0: WB enabled
Jan 27 17:59:44 hplaptop kernel: radeon 0000:01:00.0: fence driver on ring 0 use gpu addr 0x0000000040000c00 and cpu addr 0xffff88015087cc00
Jan 27 17:59:44 hplaptop kernel: [drm] radeon: power management initialized
Jan 27 17:59:44 hplaptop kernel: fb1: radeondrmfb frame buffer device
Jan 27 17:59:44 hplaptop kernel: [drm] Initialized radeon 2.24.0 20080528 for 0000:01:00.0 on minor 1
Jan 27 17:59:44 hplaptop kernel: radeon: switched off

Hardware:
HP Pavilion dv6 CORE i5
Comment 1 Alex Deucher 2013-01-29 13:58:59 UTC
Can you bisect?
Comment 2 cem.aydin 2013-01-29 19:10:46 UTC
Usually I use the current arch package. Looking at the Arch Rollback Machine (http://arm.konnichi.com/search/index.php?a=64&q=^linux&core=1) shows that there was made a jump from 3.6.11 to 3.7.3. I was a bit surprised before to get 3.7.4 all of a sudden... I just tried 3.7.3 and the problem appears there already.

Doing a quick search I found this: https://bugzilla.novell.com/show_bug.cgi?id=798254 indicating that it's already broken on 3.7.1 (similar description, and _same_ lspci | grep VGA as mine:

[root@hplaptop cem]# lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Caicos [Radeon HD 6400M/7400M Series]

The old Arch bug mentioned there was mine, but note that it is _not_ related to this error cause in the meantime vgaswitcheroo was working.

Don't know if it's of interest but maybe see the link there: http://www.phoronix.com/scan.php?page=news_item&px=MTE4MDM
Comment 3 Aleksandr Mezin 2013-02-19 11:01:19 UTC
I have the same problem with
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Whistler XT [AMD Radeon HD 6700M Series]

Seems that the bug is introduced in this commit:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commit;h=492b49a2f21a7ce6cb0abce36017daa06036a626

Before it discrete card actually switches off.
Comment 5 Aleksandr Mezin 2013-02-19 13:52:09 UTC
Tested on vanilla 3.8. It has this patch.
Comment 6 Aleksandr Mezin 2013-02-19 14:55:44 UTC
Created attachment 93541 [details]
Workaround

I found a workaround.

atpx->functions.power_cntl is 0 on my machine. Without this check switcheroo works again.

lspci:
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
        Subsystem: Hewlett-Packard Company Device 3388
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Whistler XT [AMD Radeon HD 6700M Series] (rev ff)

It's muxless system.
Comment 7 Alex Deucher 2013-02-19 15:36:13 UTC
Created attachment 93591 [details]
Print atpx function mask

Can you attach the output of this patch?  I'd like to see the atpx function mask on your system.
Comment 8 Aleksandr Mezin 2013-02-19 15:55:26 UTC
atpx function mask: 0x00000031
Comment 9 Alex Deucher 2013-02-19 18:02:54 UTC
Created attachment 93601 [details]
possible fix

Does the attached patch fix the issue for you?
Comment 10 Aleksandr Mezin 2013-02-19 19:55:55 UTC
yes, it fixes the issue
Comment 11 Florian Mickler 2013-03-04 21:28:06 UTC
A patch referencing this bug report has been merged in Linux v3.9-rc1:

commit 43a23aa450cc19fe8996caf09e7e21ae5f6e56e8
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Tue Feb 19 12:55:52 2013 -0500

    drm/radeon: properly validate the atpx interface
Comment 12 Daniel Vetter 2013-04-20 18:21:28 UTC
*** Bug 55311 has been marked as a duplicate of this bug. ***

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