Possible race condition in `amd_s2idle.py`? -- Crash with `OSError: [Errno 16] Device or resource busy`.
Ahoj,
it seems that there is a race condition with the script amd_s2idle.py
.
I did a run of
amd_s2idle-analysis --log /tmp/s2idle.log --duration 2 --wait 2 --count 10 --force
(--force
is needed because 1. I have an external kernel module (bmi260
, for the internal gyroscope of the laptop), 2. the script tells that there are two options in the kernel that could conflict) at some point crashed with
Traceback (most recent call last):
File "/usr/bin/amd_s2idle-analysis", line 2452, in <module>
app.test_suspend(duration=duration, wait=wait, count=count)
File "/usr/bin/amd_s2idle-analysis", line 2286, in test_suspend
self.execute_suspend()
File "/usr/bin/amd_s2idle-analysis", line 125, in runner
ret = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/amd_s2idle-analysis", line 2214, in execute_suspend
with open(p, "w") as w:
OSError: [Errno 16] Device or resource busy
Here is the full terminal output of a run of that script:
Debugging script for s2idle on AMD systems
💻 GPD G1619-04 (Game machining Series 28P) running BIOS 0.35 (0.35) released 09/12/2023 and EC 0.14
🐧 Artix Linux
🐧 Kernel 6.8.1-1-longcmdline-cpuopt-custom-clang
🔋 Battery BAT0 (Standard SR Real Battery) is operating at 102.06% of design
Checking prerequisites for s2idle
🚦Logs are provided via dmesg, timestamps may not be accurate over multiple cycles
✅ AMD Ryzen 7 7840U w/ Radeon 780M Graphics (family 19 model 74)
✅ LPS0 _DSM enabled
✅ ACPI FADT supports Low-power S0 idle
❌ `amd_hsmp` driver may conflict with amd_pmc
❌ failed to communicate using `amd_pmc` driver
✅ USB4 driver `thunderbolt` loaded
✅ GPU driver `amdgpu` available
✅ System is configured for s2idle
✅ NVME Sandisk Corp PC SN740 NVMe SSD is configured for s2idle in BIOS
✅ NVME Sandisk Corp WD Black SN750 / PC SN730 NVMe SSD is configured for s2idle in BIOS
✅ GPIO driver `pinctrl_amd` available
❌ Kernel is tainted: 12288
Your system does not meet s2idle prerequisites!
Running 10 cycles (Test finish expected @ 2024-03-19 23:57:17.900450)
Suspend cycle 1: Started at 2024-03-19 23:56:38.901625 (cycle finish expected @ 2024-03-19 23:56:42.901645)
Results from last s2idle cycle
○ Suspend count: 7
○ Hardware sleep cycle count: 14
○ GPIOs active: ['58', '59', '58', '58', '58', '58', '58', '58', '58']
○ Wakeups triggered from IRQs: [1, 9, 36, 7]
○ Woke up from IRQ 9 (IR-IO-APIC 9-fasteoi acpi)
○ gpe0B increased from 20 to 21
○ gpe10 increased from 11 to 12
○ gpe19 increased from 9 to 10
✅ Userspace suspended for 0:00:30.499250
✅ In a hardware sleep state for 0:00:00
🔋 Battery BAT0 (Standard SR Real Battery) is operating at 102.06% of design
Suspend cycle 2: Started at 2024-03-19 23:57:10.401900 (cycle finish expected @ 2024-03-19 23:57:14.401919)
Traceback (most recent call last):
File "/usr/bin/amd_s2idle-analysis", line 2452, in <module>
app.test_suspend(duration=duration, wait=wait, count=count)
File "/usr/bin/amd_s2idle-analysis", line 2286, in test_suspend
self.execute_suspend()
File "/usr/bin/amd_s2idle-analysis", line 125, in runner
ret = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/amd_s2idle-analysis", line 2214, in execute_suspend
with open(p, "w") as w:
OSError: [Errno 16] Device or resource busy
And attached the /tmp/s2idle.log
.
Note that I manually had to wake up the system, in a first try it did wake up by itself after the 2 seconds, later not.
Regards!