From owner-freebsd-bugs@freebsd.org Sun Feb 21 00:00:48 2021 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4866153CA94 for ; Sun, 21 Feb 2021 00:00:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4Djlnr1Mfsz4t6S for ; Sun, 21 Feb 2021 00:00:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 2ECBF53CA93; Sun, 21 Feb 2021 00:00:48 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E8EC53C8BD for ; Sun, 21 Feb 2021 00:00:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Djlnr0mTSz4tHG for ; Sun, 21 Feb 2021 00:00:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D4E149C for ; Sun, 21 Feb 2021 00:00:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 11L00l0J066021 for ; Sun, 21 Feb 2021 00:00:47 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 11L00lUf066020 for bugs@FreeBSD.org; Sun, 21 Feb 2021 00:00:47 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f 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 Date: Sun, 21 Feb 2021 00:00:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 12.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: sblachmann@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 00:00:48 -0000 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(®s, 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.=