View previous topic :: View next topic |
Author |
Message |
krotuss Apprentice
Joined: 01 Aug 2008 Posts: 246
|
Posted: Tue Nov 26, 2024 8:00 pm Post subject: elogind blocks at /sys/power/state |
|
|
Hi,
I cant suspend one of my gentoo machines from gui because elogind blocks on write to '/sys/power/state'.
Code: | openat(AT_FDCWD, "/sys/power/state", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 22
openat(AT_FDCWD, "/sys/power/disk", O_WRONLY|O_NOCTTY|O_CLOEXEC) = 26
fcntl(26, F_GETFL) = 0x8001 (flags O_WRONLY|O_LARGEFILE)
write(26, "suspend\n", 8) = 8
close(26) = 0
memfd_create("system-sleep", MFD_CLOEXEC) = 26
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [HUP INT QUIT TERM CHLD RT_2], 8) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f9c378dec10) = 15015
rt_sigprocmask(SIG_SETMASK, [HUP INT QUIT TERM CHLD RT_2], NULL, 8) = 0
waitid(P_PID, 15015, {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=15015, si_uid=0, si_status=0, si_utime=0, si_stime=0}, WEXITED, NULL) = 0
lseek(26, 0, SEEK_SET) = 0
sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="<38>", iov_len=4}, {iov_base="DATE ", iov_len=16}, {iov_base="elogind-daemon", iov_len=14}, {iov_base="[4657]: ", iov_len=8}, {iov_base="Entering sleep state 'suspend'.."..., iov_len=34}], msg_iovlen=5, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 76
write(22, "mem\n", 4 |
dmesg
Code: | [17821.878772] PM: suspend entry (deep)
[17823.113788] Filesystems sync: 1.235 seconds
|
When I use 'echo mem > /sys/power/state' system suspends without issues.
I have even tried this program to see if writes to '/sys/power/disk' and '/sys/power/state' in rapid succession can not be a problem:
Code: | #include <fcntl.h>
#include <string.h>
#include <unistd.h>
#define SUSPEND "suspend\n"
#define MEM "mem\n"
int main (int argc, char *argv[])
{
int diskFd = open("/sys/power/disk", O_WRONLY);
int stateFd = open("/sys/power/state", O_WRONLY);
write(diskFd, SUSPEND, strlen(SUSPEND));
write(stateFd, MEM, strlen(MEM));
return 0;
}
|
It also works. Can it be caused by timing, and/or by those syscalls that elogind does in between? Is there a way to debug this on kernel side?
What i find strange is that when I attach/detach strace elogind moves on and system suspends, although graphics is messed up at resume and I have to switch terminals to fix it. This does not happen with other methods. Maybe elogind does some extra stuff to GPU, and that is also reason why it blocks? |
|
Back to top |
|
|
Yamakuzure Advocate
Joined: 21 Jun 2006 Posts: 2298 Location: Adendorf, Germany
|
Posted: Mon Dec 02, 2024 7:50 am Post subject: |
|
|
elogind does not do any manual syscalls other than to fopen() /sys/power/mem_sleep to write "deep" or "s2idle" into it according to what you configured and then to fopen() /sys/power/state to write "mem" to it.
However, there has been a problem with elogind trying to send dbus messages to itself, which had been fixed in the 255 series by forking out the sleep functionality. Maybe it is that?
btw: You do not write to /sys/power/disk when suspending a machine, only when trying to hibernate. _________________ Edited 220,176 times by Yamakuzure |
|
Back to top |
|
|
krotuss Apprentice
Joined: 01 Aug 2008 Posts: 246
|
Posted: Mon Dec 02, 2024 10:51 am Post subject: |
|
|
It blocks at vt_waitactive:
Code: | vt_waitactive
vt_move_to_console
pm_prepare_console
pm_suspend
state_store
kernfs_fop_write_iter
vfs_write
ksys_write
do_syscall_64
entry_SYSCALL_64_after_hwframe |
and only if triggered from wayland session (at least so it seems), but 'echo mem > /sys/power/state' from wayland works. So it seems that something (wayland?) is blocking terminal, but why echo works? Can it have something to do with that that elogind is daemonized?
Yamakuzure wrote: | btw: You do not write to /sys/power/disk when suspending a machine, only when trying to hibernate. |
Yet that is what elogind does. I find that strange too. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|