Skip to contentSkip to conversation

New: Kernel crash after modprobe radeon runpm=1

Bug 73901 [email protected] 1 participant 20 messages Apr 12, 2014 – Jul 12, 2014

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=73901

Bug ID: 73901
Summary: Kernel crash after modprobe radeon runpm=1
Product: Drivers
Version: 2.5
Kernel Version: 3.14
Hardware: x86-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: high
Priority: P1
Component: Video(DRI - non Intel)
Assignee: [email protected]
Reporter: [email protected]
Regression: No

After modprobing radeon driver with runpm=1 notebook display panel output is immediatelly black (probably turned off) and after one or two seconds kernel freeze/crash (sysrq not working too). I was able to dump & sync syslog kernel output before freeze (called sync command in infinite loop on background). See attachment where is log from syslog daemon after modprobing radeon kernel module (with runpm=1). I'm not able to provide any other debug output as display is off and kernel crashing... Problem is reproducable always on notebook Dell Latitude E6440 which have muxless AMD Radeon HD 8690M graphic card.

Black screen is probably caused by intel driver at line:

[  171.913779] i915: switched off

And kernel crash by NULL derefence:

[  173.442690] BUG: unable to handle kernel NULL pointer dereference at

0000000000000008

My AMD graphics card is identified by lspci -nn as:
01:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Sun XT [Radeon HD 8670A/8670M/8690M] [1002:6660]

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #1 from Pali Rohár <[email protected]> --- Created attachment 131981
--> https://bugzilla.kernel.org/attachment.cgi?id=131981&action=edit
syslog output

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

Pali Rohár <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

 Attachment #131981|application/octet-stream    |text/plain
          mime type|                            |
Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

Alex Deucher <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #2 from Alex Deucher <[email protected]> --- what kernel are you using? Can you attach your full dmesg output without radeon.runpm=1?

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#4 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #3 from Pali Rohár <[email protected]> --- Created attachment 132211
--> https://bugzilla.kernel.org/attachment.cgi?id=132211&action=edit
dmesg output

I'm using version 3.14 (as specified in bugzilla). Dmesg output from kernel without any radeon params is attached.

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

Pali Rohár <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

 Attachment #132211|application/octet-stream    |text/plain
          mime type|                            |
Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #4 from Alex Deucher <[email protected]> ---
Your system does not appear to have the ATPX acpi methods that are required for runtime pm to work properly (required to power off the dGPU). You should see something like:
ATPX version X, functions 0xXXXXXXXX
in your dmesg output.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#7 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #5 from Pali Rohár <[email protected]> --- So I cannot turn off dGPU when it is not used?

Also I think that kernel should not crash when booting with (maybe incorrect?) param runpm.

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #6 from Pali Rohár <[email protected]> ---
Btw, I looked into DSDT/SSDT acpi tables and there is ATPX method (in SSDT7, scope \_SB.PCI0.GFX0).

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #7 from Alex Deucher <[email protected]> --- (In reply to Pali Rohár from comment #5)

Quoted 2 lines

So I cannot turn off dGPU when it is not used?

Correct. The driver requires that method to power on/off the dGPU.

Quoted 2 lines

Also I think that kernel should not crash when booting with (maybe incorrect?) param runpm.

Yes, that should probably be fixed.

(In reply to Pali Rohár from comment #6)

Quoted 2 lines

Btw, I looked into DSDT/SSDT acpi tables and there is ATPX method (in SSDT7, scope \_SB.PCI0.GFX0).

Did you enable vgaswitcheroo support in your kernel config?

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #8 from Pali Rohár <[email protected]> --- (In reply to Alex Deucher from comment #7)

Quoted 5 lines

(In reply to Pali Rohár from comment #6)

Quoted 2 lines

Btw, I looked into DSDT/SSDT acpi tables and there is ATPX method (in SSDT7, scope \_SB.PCI0.GFX0).

Did you enable vgaswitcheroo support in your kernel config?

Kernel is from http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-trusty/

And in file /boot/config-3.14.0-031400-generic I see:

CONFIG_VGA_SWITCHEROO=y

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #9 from Pali Rohár <[email protected]> ---
I looked into radeon_atpx_handler.c code and I found reason why radeon kernel driver does not detect ATPX...

First here is lspci output:
00:02.0 VGA compatible controller [0300]: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller [8086:0416] (rev 06) 01:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Sun XT [Radeon HD 8670A/8670M/8690M] [1002:6660]

Second here is relevant code of function radeon_atpx_detect(void) from file radeon_atpx_handler.c

    int vga_count = 0;

    while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
        vga_count++;

        has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
    }

    if (has_atpx && vga_count == 2) { ... ATPX was detected ... }

And some defines (from pci_ids.h):

#define PCI_CLASS_DISPLAY_VGA 0x0300
#define PCI_CLASS_DISPLAY_OTHER 0x0380

Because my Radeon card has pci class 0380 and not 0300 it is not checked for ATPX in while loop and so vgaswitcheroo is not enabled.

I created this quick & dirty patch and after that runpm=1 working without any crash.

radeon_atpx_handler.c 2014-04-14 23:50:53.354492060 +0200 renamed from radeon_atpx_handler.c.orig 2014-04-14 17:36:36.583744668 +0200 +1 -0
@@ -528,6 +528,12 @@ static bool radeon_atpx_detect(void)
         has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
     }
 
+    while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL)

{
+ vga_count++;
+
+ has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
+ }
+

     if (has_atpx && vga_count == 2) {
         acpi_get_name(radeon_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME,

&buffer);
printk(KERN_INFO "VGA switcheroo: detected switching method %s
handle\n",

Now also vgaswitcheroo debugfs file appeared:

$ sudo cat /sys/kernel/debug/vgaswitcheroo/switch
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynPwr:0000:01:00.0

Alex, I think that now you have everything needed for implementing proper fix for this bug.

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #10 from Alex Deucher <[email protected]> --- Created attachment 132301
--> https://bugzilla.kernel.org/attachment.cgi?id=132301&action=edit
fix ATPX detection on non-VGA dGPUs

Thanks for sorting this out.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#13 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #11 from Alex Deucher <[email protected]> --- Created attachment 132311
--> https://bugzilla.kernel.org/attachment.cgi?id=132311&action=edit
avoid a possible crash when runpm is forced on non-ATPX systems

Fix runpm=1 handling on non-PX systems.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#14 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #12 from Pali Rohár <[email protected]> --- (In reply to Alex Deucher from comment #10)

Quoted 4 lines

Created attachment 132301 [details]
fix ATPX detection on non-VGA dGPUs

Thanks for sorting this out.

This patch is same as mine, already tested and is working.

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #13 from Pali Rohár <[email protected]> --- (In reply to Alex Deucher from comment #11)

Quoted 4 lines

Created attachment 132311 [details]
avoid a possible crash when runpm is forced on non-ATPX systems

Fix runpm=1 handling on non-PX systems.

It is not possible to apply this patch on top of 3.14 nor on top of linus master (55101e2d6ce1c780f6ee8fee5f37306971aac6cd)

linux/drivers/gpu/drm/radeon$ patch -p5 -i 0002-drm-radeon-don-t-allow-runpm-1-on-systems-with-out-A.patch patching file radeon_kms.c
Hunk #1 FAILED at 107.
1 out of 1 hunk FAILED -- saving rejects to file radeon_kms.c.rej

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #14 from Alex Deucher <[email protected]> --- (In reply to Pali Rohár from comment #13)

Quoted 6 lines

(In reply to Alex Deucher from comment #11)

Quoted 4 lines

Created attachment 132311 [details]
avoid a possible crash when runpm is forced on non-ATPX systems

Fix runpm=1 handling on non-PX systems.

Quoted 8 lines

It is not possible to apply this patch on top of 3.14 nor on top of linus master (55101e2d6ce1c780f6ee8fee5f37306971aac6cd)

linux/drivers/gpu/drm/radeon$ patch -p5 -i 0002-drm-radeon-don-t-allow-runpm-1-on-systems-with-out-A.patch patching file radeon_kms.c
Hunk #1 FAILED at 107.
1 out of 1 hunk FAILED -- saving rejects to file radeon_kms.c.rej

It relies on other patches in the radeon -fixes tree. It should apply against:
http://cgit.freedesktop.org/~deathsimple/linux/log/?h=drm-fixes-3.15-wip

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #15 from Pali Rohár <[email protected]> ---
Now I tested this patch with 3.15-rc2 kernel and no kernel crash with runpm=1 anymore...

But there is another problem, runpm=1 somehow not working correctly. It does not poweroff radeon card when it is not used.

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#18 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

--- Comment #16 from Pali Rohár <[email protected]> --- My bad, I'm using tlp which calling:

$ echo on > /sys/bus/pci/devices/0000:01:00.0/power/control
when notebook is running on ac. And this prevent runpm to work correctly. After
I blacklisted radeon card in tlp then runpm started working correctly.
Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#19 lore raw

[Bug 73901] Kernel crash after modprobe radeon runpm=1

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=73901

Pali Rohár <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |CODE_FIX

--- Comment #17 from Pali Rohár <[email protected]> --- Ok, when set auto control via

$ echo auto > /sys/bus/pci/devices/0000:01:00.0/power/control

card is automatically turned off when it is not used. When I set on via

$ echo on > /sys/bus/pci/devices/0000:01:00.0/power/control

then it is always on. So it working as expected and closing this bug as fixed.

Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel