Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Feb 2021 00:00:48 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 253733] vesa.ko: Invalid BIOS call when resuming from S3 suspend/sleep causes nvidia driver hang
Message-ID:  <bug-253733-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253733

            Bug ID: 253733
           Summary: vesa.ko: Invalid BIOS call when resuming from S3
                    suspend/sleep causes nvidia driver hang
           Product: Base System
           Version: 12.2-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: sblachmann@gmail.com

In vesa.ko there is a function that gets called when resuming from sleep, e=
.g.
at resuming after S3 suspend via 'zzz'.
This function does a BIOS call, which is related to restoring the graphics
cards' previous state it had before powering off.

On Nvidia cards this BIOS function seems to be implemented in a different w=
ay
than on most other cards.
For this reason, calling this BIOS function causes the Nvidia graphics driv=
er
to hang, failing to resume.
(For technical background, read my discussion with jkim in PR 224069:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224069 )

Reproducing the bug is easy:
-Install FreeBSD (eg using GENERIC kernel).
-Enable sc (kern.vty=3D"sc" in /boot/loader.conf).
-Install xorg. Install and configure nvidia driver. Reboot and start xorg v=
ia
startx.
-Enter "zzz" in a xterm.
-Watch the system/driver hang, keyboard (PS/2) and mouse becoming unrespons=
ive
when attempting to switch back to graphics mode.
-Hitting the power button results no visible change, until after timeout a
message about an unresponsive stop job (presumably the nvidia driver) appea=
rs
shortly before powering off.

For reproducing the bug it is essential to use GENERIC kernel!
Because, working around by building and installing a custom kernel without
"options VESA" fixes the hang after suspend/resume. It is also important to=
 not
have vt and its helper modules (vt_efifb etc) in the kernel, as these pull =
in
the vesa.ko showstopper module.

Already back in 2017 I found that skipping (commenting out) the Nvidia BIOS
call fixes the issue, making resume work reliably.

So I believe the proper fix would be:
1. check whether the graphics card is Nvidia
2. if it is Nvidia, skip that BIOS call in /usr/src/sys/dev/fb/vesa.c line =
520.

Pseudocode for a patch might look like this:

(+)if (! nvidia_card_is_installed) {
x86bios_intr(&regs, 0x10);
(+)}


Side note:
All my systems use the sc console, not the vt console.
So I do not know the system behaviour when using vt.
Thus please use sc in text mode when reproducing the bug!

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253733-227>