Can ETIME be returned instead of EBUSY in the kernel suspend flow?

From: Pranav Prasad
Date: Tue Jan 30 2024 - 16:14:00 EST


Hi!

I am proposing a patch in which I want to return the errno code ETIME instead of
EBUSY in enter_state() in the kernel suspend flow. Currently, EBUSY is returned
when an imminent alarm is pending which is checked in alarmtimer_suspend() in
alarmtimer.c. The proposed patch series moves the check to enter_state() in
suspend.c to catch a potential suspend failure early in the suspend
flow. I want to
replace EBUSY with ETIME to make it more diagnosable in userspace, and may
be more appropriate considering a timer is about to expire.

I am reaching out to get an opinion from the suspend maintainers if this would
act as any potential risk in the suspend flow which only has EBUSY, EAGAIN, and
EINVAL as return error codes currently. The patch of interest is attached with
this email. Thank you!

Regards,
Pranav Prasad

Attachment: Proposed_ETIME_Solution.patch
Description: Binary data