Bug 98276

Summary: Kernel Panic on shutdown caused by "drm/amdgpu: always apply pci shutdown callbacks"
Product: DRI Reporter: Johannes Hirte <johannes.hirte>
Component: DRM/AMDgpuAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: mike
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dmesg output after unloading amdgpu.ko
none
possible fix none

Description Johannes Hirte 2016-10-16 09:55:27 UTC
Kernel 4.9-rc1 fails on shutdown/reboot with a panic. Bisect pointed me to 

00ea8cba5ef7b783f11cb1a0b900b7c18d2ce0b6 is the first bad commit
commit 00ea8cba5ef7b783f11cb1a0b900b7c18d2ce0b6
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Thu Sep 22 14:40:29 2016 -0400

    drm/amdgpu: always apply pci shutdown callbacks (v2)

    We can't properly detect all hypervisors and we
    need this to properly tear down the hardware.

    v2: trivial warning fix

    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

:040000 040000 868a00ff980f95dac82b908df0737342bf40cdc3 02bf2cf4e8797d37d454301afedf2f97735b60ca M      drivers

After removing this commit, everything works again. System is a Carrizo.
Comment 1 Alex Deucher 2016-10-16 17:46:43 UTC
Can you attach the panic messages?
Comment 2 Alex Deucher 2016-10-16 17:47:47 UTC
If you can't get them during a reboot/shutdown, you can reproduce it my unloading the module as they use the same code.  E.g., modprobe -r amdgpu
Comment 3 Johannes Hirte 2016-10-16 20:23:35 UTC
I only have a black screen when the panic happens. Rebuild the kernel with amdgpu as module for the unloading module option, but this way I can't remove the driver cause the module is in use.
Comment 4 Mike Lothian 2016-10-17 00:54:32 UTC
rmmod -f amdgpu should do the trick
Comment 5 Johannes Hirte 2016-10-17 08:17:27 UTC
(In reply to Mike Lothian from comment #4)
> rmmod -f amdgpu should do the trick

This way I can remove the module, but I don't get the panic. The screen goes black and I have to reboot via SysReq Keys.
Comment 6 Alex Deucher 2016-10-17 16:18:01 UTC
You can also unbind the console before unloading the module.

sudo bash -c "echo 0 > /sys/class/vtconsole/vtcon1/bind"
sudo modprobe -r amdgpu
Comment 7 Johannes Hirte 2016-10-17 20:16:54 UTC
(In reply to Alex Deucher from comment #6)
> You can also unbind the console before unloading the module.
> 
> sudo bash -c "echo 0 > /sys/class/vtconsole/vtcon1/bind"

First time this resulted in a black screen with a panic, next time the system hung, but reboot via SysReq Keys worked. Always happened on the unbind.
Comment 8 Johannes Hirte 2016-10-22 22:59:03 UTC
Created attachment 127488 [details]
dmesg output after unloading amdgpu.ko

I've retried removing the module via ssh session and the second time I was successful. The dmesg output is attached.
Comment 9 Ernst Sjöstrand 2016-10-24 07:56:03 UTC
Is this fixed somewhere now also?
Related to https://bugs.freedesktop.org/show_bug.cgi?id=98200 I guess?
Comment 10 Johannes Hirte 2016-10-24 11:48:06 UTC
(In reply to Ernst Sjöstrand from comment #9)
> Is this fixed somewhere now also?

still happens with 4.9-rc2 as well as 4.10-wip
Comment 11 Johannes Hirte 2016-11-03 21:21:27 UTC
As the dmesg shows a problem in the ACP code, I've just disabled it now and it works. Don't know what's the real problem, but without ACP my system reboot fine.
Comment 12 Alex Deucher 2016-11-03 21:52:52 UTC
Created attachment 127736 [details] [review]
possible fix

This should fix it.
Comment 13 Johannes Hirte 2016-11-04 13:40:21 UTC
(In reply to Alex Deucher from comment #12)
> Created attachment 127736 [details] [review] [review]
> possible fix
> 
> This should fix it.

Yes, this fixes the panic on reboot/unloading the driver.
Comment 14 Martin Peres 2019-11-19 08:10:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/drm/amd/issues/106.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.