From: Thomas Gleixner <tglx@linutronix.de>
To: John Stultz <jstultz@google.com>, Pranav Prasad <pranavpp@google.com>
Cc: sboyd@kernel.org, linux-kernel@vger.kernel.org,
Kelly Rossmoyer <krossmo@google.com>
Subject: Re: [PATCH] alarmtimer: Expose information about next alarm to userspace via sysfs
Date: Fri, 19 Jan 2024 20:38:13 +0100 [thread overview]
Message-ID: <87y1cldsgq.ffs@tglx> (raw)
In-Reply-To: <CANDhNCqyugdsais9bzaL8RxTxyBgme4W2ZdfayaS8HbqBHJraw@mail.gmail.com>
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
next prev parent reply other threads:[~2024-01-19 19:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 18:14 [PATCH] alarmtimer: Expose information about next alarm to userspace via sysfs Pranav Prasad
2024-01-18 22:11 ` John Stultz
2024-01-19 19:38 ` Thomas Gleixner [this message]
2024-01-19 23:09 ` Pranav Prasad
2024-01-20 10:48 ` kernel test robot
2024-01-21 20:07 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1cldsgq.ffs@tglx \
--to=tglx@linutronix.de \
--cc=jstultz@google.com \
--cc=krossmo@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pranavpp@google.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox