[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y1cldsgq.ffs@tglx>
Date: Fri, 19 Jan 2024 20:38:13 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: John Stultz <jstultz@...gle.com>, Pranav Prasad <pranavpp@...gle.com>
Cc: sboyd@...nel.org, linux-kernel@...r.kernel.org, Kelly Rossmoyer
<krossmo@...gle.com>
Subject: Re: [PATCH] alarmtimer: Expose information about next alarm to
userspace via sysfs
On Thu, Jan 18 2024 at 14:11, John Stultz wrote:
> I'm always a bit cautious when exposing stuff to userland,
> particularly if it's potentially racy as you mentioned in your
> description. One thought I had was might adding a similar check
> earlier in the suspend path on the kernel side provide similar benefit
> (without requiring userland changes)?
>
> Basically, if I understand the problem:
> echo mem > /sys/power/state
> <kernel goes through suspending everything>
> alarmtimer_suspend()
> if (next_alarm < TWO_SECONDS)
> return -EBUSY;
> <kernel has to resume everything, and all that time was wasted>
>
> So if instead we did:
> echo mem > /sys/power/state
> enter_state()
> if (alarmtimer_immenent())
> retrun -EBUSY
>
> So the kernel would come back much faster if the suspend was going to abort.
>
> I suspect you all have considered this already but wanted to
> understand what issues that approach has.
It has the same race issues as the user space readout has as far as I
understand and it's much simpler.
Thanks,
tglx
Powered by blists - more mailing lists