Repository navigation
Where should I post this? 60s suspend timeout in nvkms_read_lock_pm_lock() (580.178.04, open and proprietary) #1609
Replies: 1 comment
|
Your perf trace already shows the cause. It is a known clash between the NVIDIA driver and systemd's user session freezing. Since systemd 256, systemd-sleep freezes user.slice with the cgroup freezer before it suspends. Before that, nvidia-suspend.service writes to /proc/driver/nvidia/suspend. That makes the driver take its PM lock for writing. Any gnome-shell ioctl into nvidia-modeset then has to wait for that lock. In nvidia-modeset-linux.c the wait looks like this. while (!down_read_trylock(&nvkms_pm_lock)) {
try_to_freeze();
cond_resched();
}That loop is your 56% nvkms_ioctl_from_kapi and 44% down_read_trylock. It is also why the thread shows state R. The cgroup freezer can only stop a task when it returns to user space. This task never leaves the kernel, so user.slice never freezes. systemd gives up after a minute and suspends anyway. Then the kernel's own freezer catches the thread at try_to_freeze() and the suspend works. That matches your 60 second gap. It also explains why the open and proprietary modules behave the same. They share this code. The usual fix is to tell systemd not to freeze user sessions for sleep. Arch ships this in nvidia-utils as a drop-in called 10-nvidia-no-freeze-session.conf. You can add the same thing by hand. If you use hibernate or suspend-then-hibernate, put the same file under those services too. After that, systemd-sleep logs "User sessions remain unfrozen on explicit request" and the timeout should be gone. systemd prints a warning with that line. It mainly matters for encrypted home directories and suspend-then-hibernate. About where to post. The README says issues here are for problems specific to the open modules. Since the proprietary module does the same, the forum is the better place. You can skip the forum signup. The README also lists linux-bugs@nvidia.com as a reporting channel. Attach the output of nvidia-bug-report.sh if you write to them. |
Uh oh!
There was an error while loading. Please reload this page.
hi, not really sure where to post this. i tried signing up for the nvidia developer forum but it wanted me to fill out a bunch of business/organisation details. i know the issues here are supposed to be specific to the open module so i thought i'd post here instead.
basically my pc CONSISTENTLY takes an extra 60 seconds to suspend and i've spent quite a while trying to figure out why.
my specs:
whenever i run systemctl suspend, the nvidia suspend service finishes successfully but then this happens:
it eventually suspends and i can wake it up again.
i've tried both deep and s2idle, disabling all my gnome extensions, restarting my desktop session and closing applications like spotify. still happens.
i monitored the cgroups during suspend and noticed that
org.gnome.Shell@ubuntu.servicewasn't freezing. the main gnome-shell thread was in state R in the samples i took during the timeout.i ran perf on the thread for 30 seconds during the timeout and got this (excerpt from my first test on the open driver):
the call stack included
CreateSurface,__GI___ioctl,drmIoctlanddrmModeAddFB2WithModifiers.i wanted to see if it was specific to the open module so i switched to the proprietary one of the same version (580.178.04) without changing my kernel. same issue.
log on proprietary
ran perf again on proprietary:
perf on proprietary
this was interesting because it actually showed
nvkms_read_lock_pm_lock()andtry_to_freeze()in the call stacks.i switched back to open and did another test just to be sure:
perf after switching back to open
this time it was trying to destroy a framebuffer rather than create one, like on proprietary. all 3 profiles had around 2k samples and no lost samples.
i had a look at
nvkms_read_lock_pm_lock()in the source code and noticed the loop withdown_read_trylock(),try_to_freeze()andcond_resched().https://github.com/NVIDIA/open-gpu-kernel-modules/blob/580.178.04/kernel-open/nvidia-modeset/nvidia-modeset-linux.c#L485-L515
from what i understand, the kernel suspend freezer and the cgroup freezer aren't the same thing, so could the thread be stuck trying to acquire the read lock while the PM write lock is held and therefore not be able to freeze?
also my nvidia config has:
idk if this is an issue with the locking itself or the order the suspend services run in. i haven't confirmed whats holding the lock or found a fix yet.
i've saved the nvidia-bug-report logs, raw perf data and suspend logs for both drivers and can share if needed
still learning about all of this so please correct me if i've misunderstood something. does anyone know whats happening here or where i should report this?
thanks!
All reactions