Conversation
…pended
With the documented hibernation setup (NVreg_PreserveVideoMemoryAllocations=1
plus nvidia-hibernate.service), the system hangs after the hibernation image
has been written and never powers off. The last console line is
"[nvidia-drm] Unloading driver".
Sequence:
1. nvidia-sleep.sh writes "hibernate" to /proc/driver/nvidia/suspend:
nv_set_system_power_state() takes nv_system_pm_lock for write and
suspends the GPU (NV_FLAG_SUSPENDED).
2. The kernel freezes devices (nv_pmops_freeze), creates the snapshot and
thaws devices to write the image. nv_pmops_thaw() is a no-op, so the GPU
stays suspended and nv_system_pm_lock stays write-locked.
3. After the image is written, HibernateMode=shutdown (or reboot, or a
failed ACPI S4 entry) calls kernel_power_off() -> device_shutdown() ->
nv_pci_shutdown() -> nv_pci_remove_helper() -> nvidia_modeset_remove()
-> nv-drm unload, i.e. a full driver teardown against a suspended GPU.
This never completes.
The machine is about to lose power and the GPU state was already saved by
the suspend path, so a teardown is neither needed nor possible here. When
the device is still NV_FLAG_SUSPENDED, only clear bus mastering and return.
Normal shutdown and reboot are unaffected because the flag is not set then.
Tested on an RTX 5080 Laptop GPU (GB203, ASUS GU605CW) with 615.71.09 and
Linux 7.3-rc5: before, hibernation hung at "Unloading driver" every time
(also with 610.57.04); after, the system powers off right after the image is
written and resumes normally.
Signed-off-by: Hans van Essen <hans@expaso.nl>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With the documented hibernation setup (
NVreg_PreserveVideoMemoryAllocations=1+nvidia-hibernate.service), the system never powers off after the hibernation image has been written. The image is complete (resume works after a forced power-off), but the machine sits there with the last console line:Reproduced every time on 610.57.04 and 615.71.09 with
HibernateMode=shutdown(/sys/power/disk=shutdown).rebootmode and a failed ACPI S4 entry inplatformmode go through the samekernel_power_off()/device_shutdown()path.Root cause
nvidia-sleep.sh hibernatewrites to/proc/driver/nvidia/suspend→nv_set_system_power_state()takesnv_system_pm_lockfor write and suspends the GPU (NV_FLAG_SUSPENDED).nv_pmops_freeze), takes the snapshot and thaws devices to write the image.nv_pmops_thaw()is a no-op, so the GPU stays suspended andnv_system_pm_lockstays write-locked for the rest of the hibernation.kernel_power_off()→device_shutdown()→nv_pci_shutdown()→nv_pci_remove_helper()→nvidia_modeset_remove()→ nvidia-drm unload: a full driver teardown against a suspended GPU, which never completes.Fix
In
nv_pci_shutdown(), if the device is stillNV_FLAG_SUSPENDED, only clear bus mastering and return. The machine is about to lose power and the GPU state was already saved by the suspend path, so the teardown is neither needed nor possible. Normal shutdown/reboot are unaffected (the flag is not set then).Testing
HibernateMode=shutdown