Bug 261749 - graphics/drm-kmod: Kernel panic after unloading radeonkms and loading any other graphics driver module
Summary: graphics/drm-kmod: Kernel panic after unloading radeonkms and loading any oth...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-x11 (Nobody)
URL: https://www.freshports.org/graphics/d...
Keywords: crash, needs-qa
Depends on:
Blocks:
 
Reported: 2022-02-06 16:58 UTC by Stefan B.
Modified: 2022-10-20 00:09 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback? (x11)
koobs: maintainer-feedback? (danfe)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan B. 2022-02-06 16:58:14 UTC
How to reproduce:

1. kldload radeonkms (no matter whether via rc.conf or manually via console. It loads even if there is no radeon hardware present!).
2. kldunload radeonkms.
3. kldload nvidia. BANG! GPF PANIC!

It happens no matter whether sc or vt console are being used.
This issue is particularly annoying when you swapped the radeon graphics card for a nvidia one and want reconfigure the system to run with the nvidia, after booting with the rc.conf still containing the radeonkms module kldload.

Because, it should not be necessary to have to reboot only because of radeonkms corrupting the kernel.

Test system is HP Z800 with FreeBSD 13-RELEASE-p7.
Nvidia driver here is 390 (Quadro 2000). But my feeling is the Nvidia driver version will not matter.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-06 23:12:55 UTC
Thank you for the report Stefan. Could you please include, as attachments:

- pkg version -v output
- pciconf -lv output
- /var/run/dmesg.boot output
- screenshot of the panic message (if available)

It would be great, if you can, to enable automatic crash dumps and processing, and to provide a panic backtrace. It may also be useful to build nvidia and drm ports WITH_DEBUG before doing so.
Comment 2 Stefan B. 2022-02-09 03:33:30 UTC
Dear Kubilay!

Honestly, I think it is unnecessary to collect all these attachments you requested.

I did some more tests.
The amdgpu and i915kms modules behave fine. They do not crash the computer.
Only radeonkms behaves bad.

And it does not matter which nvidia version you use.
Having previously loaded radeonkms panics the computer, no matter whether you load 340, 390 or the current (470) driver.

It is so easy to reproduce, so, again, I doubt it makes sense to post these attachments.
I will change the bug description accordingly.
Comment 3 Stefan B. 2022-02-09 03:56:36 UTC
BTW, after I posted the last comment, I thought of testing whether crashing the kernel might "work" also if instead of nvidia, I kldload amdgpu or i915kms after kldunloading radeonkms.

And yes, it "works", too.
So I guess I have to change the PR title again...
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2022-10-20 00:09:59 UTC
Does the commit that's linked from <https://github.com/freebsd/drm-kmod/issues/168#issuecomment-1142618864> help to think about a possible fix here?