Bug 217728

Summary: Asus M3500QA failed to resume by timer (timerfd_settime)
Product: Power Management Reporter: Alexey Kuznetsov (axet)
Component: Hibernation/SuspendAssignee: Rafael J. Wysocki (rjw)
Status: NEW ---    
Severity: normal    
Priority: P3    
Hardware: AMD   
OS: Linux   
Kernel Version: 6.4.7 Subsystem:
Regression: No Bisected commit-id:

Description Alexey Kuznetsov 2023-07-29 18:55:47 UTC
Hello!

I'm using Asus Vivobook Laptop. Which fails to resume by timer set by timerfd_settime function call. It simply ignores the timer and keeps sleeping until I press any key. When key pressed notebook wakes up and treating key resume event as timer event.

I tested this using systemd and its HibernateDelaySec option, which allows to wake system during the sleep by timer to switch to hibernate state replacing suspend mode. During suspend notebook simply do nothing when timer hits, and when I press any key it wakes, and went to hibernate (treating key pressing wake event as timer event). Systemd has checks which should prevent hibernating if system wakes by key press, but those checks does not fails. I tested the same suspend / hibernate software on desktop - everything working fine.

This systemd code responsible for suspend / timer / hibernate logic:

tfd = timerfd_create(CLOCK_BOOTTIME_ALARM, TFD_NONBLOCK|TFD_CLOEXEC);
timerfd_settime(tfd, 0, &ts, NULL)
execute(sleep_config, SLEEP_HYBRID_SLEEP, NULL)
fd_wait_for_event(tfd, POLLIN, 0)
woken_by_timer = FLAGS_SET(r, POLLIN)
check_wakeup_type()

Basically it is POSIX calls responsible for setting timer alarms set and reading timer status.

I've tested on recent debian kernel Linux 6.1.0-10-amd64 and stable release from kernel.org  Linux 6.4.7 - same behavior.

It most likely hardware/EFI or kernel issue.

Full logs:

https://linux-hardware.org/?probe=d1a4b2769a