From: Bastien Nocera <hadess@hadess.net>
To: John Stultz <john.stultz@linaro.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: A desktop environment[1] kernel wishlist
Date: Mon, 27 Oct 2014 15:19:39 +0100 [thread overview]
Message-ID: <1414419579.30379.49.camel@hadess.net> (raw)
In-Reply-To: <CALAqxLX2Q-2RBF1zY6JAWrqNiqBFG3vxUwUSLVS3qXpgSOb9xA@mail.gmail.com>
On Tue, 2014-10-21 at 12:10 -0700, John Stultz wrote:
> On Tue, Oct 21, 2014 at 11:09 AM, Bastien Nocera <hadess@hadess.net> wrote:
> > On Tue, 2014-10-21 at 11:00 -0700, John Stultz wrote:
> >> I suspect wakeup type reporting is maybe not the best way to go about
> >> this, since there may be a number of causes for wakeups and they can
> >> arrive closely together in different orders, which can result in
> >> races.
> >>
> >> For instance, if the machine suspends, and sets an alarm to be woken
> >> up at midnight to do a backup, if the user resumes their laptop at
> >> 11:59:59, should the backup still proceed at midnight?
> >
> > No. And I would expect that we would get a wake up type of "power
> > button" or "lid open" in this case.
> >
> >> What happens
> >> if the user starts to use their machine at 12:00:01?
> >
> > I would expect the backup to stop and be tried again later.
>
> What "event" would you be using to trigger stopping the backup?
>
>
> >> What about if
> >> the user walked away from their machine at 11:55:01, and the system
> >> would suspend at 12:00:01, should the backup commence at 12:00:00?
> >
> > That wouldn't happen because we'd set the wake up time when suspending.
> >
> >> Thus you probably want to have a "user present" status,
> >
> > We can do any sort of thing once the laptop is awake. But right now
> > there's no way to know whether the resume is due to a user action or
> > not.
>
> I'm suggesting its best if you don't care which specific irq brought
> the device out of suspend mode.
>
> You may want to monitor various events like the lid-open or
> power-button (as well as the timerfd for alarms), and use those for
> your logic, but again, because a number of different irqs might bring
> the system out of suspend and those irqs can possibly occur almost
> simultaneously, which specific one landed first and woke the system is
> really not that useful (and again prone to races).
>
> Now, I do think knowing which IRQ did bring you out of suspend is
> useful, but mostly for power-debugging when you're trying to optimize
> battery life. But for userland logic, I think its far too prone to
> races.
I also cannot know, from user-space, whether Wake-On-LAN,
Wake-On-Wireless-LAN, or the Wi-Fi card's "network proximity" triggered
coming out of suspend for example.
I can certainly check for the status of the lid, but I wouldn't know
whether a button was pressed to turn the machine back on, as the
firmware would eat that.
To make it short, I don't have a way to know, from user-space, whether
the event that took it out of suspend was programmatic, or user action.
I would add that, even if we said that races can occur, I have no easy
way to know, from user-space, whether the last thing that occurred was
the Wi-Fi card waking the machine up or the power button being pressed.
I'm sure all that information is available inside the kernel, but the
user-space interface for it is lacking.
> >> then use the
> >> timerfd() ALARM clockids to set any wakeups you'd like, and when they
> >> trigger (if the system was suspended or not), decide to do your backup
> >> based the conditionals you had above, using the user-present status in
> >> a similar way to how you use AC status.
> >>
> >> I'd suggest looking into some of the details on how Android does its
> >> wakelock logic, as well as the timerfd ALARM clockids, since I think
> >> this would provide what you need.
> >
> > It doesn't. There's still a whole class of hardware that isn't always on
> > as mobile SoCs are, and wakelocks aren't going to help if the kernel
> > isn't running and we don't know why it started running again.
>
> I'm not sure I parsed this properly. Mobile SoCs are quite frequently
> in suspend and not always on. They frequently resume both due to
> wakeup alarms, modem call irqs, and as a result of user-interaction
> like button presses.
>
>
> >> My bigger concern here with your use case though, is that you might be
> >> able to use ALARM timers more commonly, but that for much existing
> >> hardware, corner cases like programmatic resuming of a laptop while
> >> its packed in a bag somewhere might have thermal risks.
> >
> > I'm pretty sure that Windows has done this for years before we did. If
> > the laptop cannot suspend reliably, then the user would disable it. We
> > cannot keep designing around broken software.
>
> Sure. But its not reliably suspending I'm worried about, its
> accidentally resuming in an environment the hardware wasn't designed
> for. Its really more of a hardware design issue. I'm not suggesting
> you don't do it, but I just suspect you'll need to be careful about
> automatically enabling this on older hardware.
It could be opt-in if that's actually a problem.
next prev parent reply other threads:[~2014-10-27 14:20 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 8:49 Bastien Nocera
2014-10-21 13:11 ` Sergey
2014-10-22 2:58 ` Minchan Kim
2014-10-22 16:52 ` Dan Streetman
2014-10-22 20:16 ` Heinrich Schuchardt
2014-10-27 16:11 ` Sergey "Shnatsel" Davidoff
2014-10-27 9:23 ` Pavel Machek
2014-10-27 16:02 ` Sergey "Shnatsel" Davidoff
2014-10-31 9:36 ` Jan Kara
2014-11-03 18:21 ` Heinrich Schuchardt
2014-11-04 9:28 ` Jan Kara
2014-11-04 19:55 ` Heinrich Schuchardt
2014-11-05 17:18 ` Jan Kara
2014-10-21 17:04 ` John Stultz
2014-10-21 17:14 ` Bastien Nocera
2014-10-21 18:00 ` John Stultz
2014-10-21 18:09 ` Bastien Nocera
2014-10-21 19:10 ` John Stultz
2014-10-27 14:19 ` Bastien Nocera [this message]
2014-10-27 16:56 ` John Stultz
2014-10-28 22:57 ` One Thousand Gnomes
2014-10-30 14:41 ` Bastien Nocera
2014-10-30 23:39 ` One Thousand Gnomes
2014-10-31 14:03 ` Bastien Nocera
2014-11-03 14:17 ` One Thousand Gnomes
2014-10-30 14:35 ` Bastien Nocera
2014-10-30 23:25 ` One Thousand Gnomes
2014-10-31 14:01 ` Bastien Nocera
2014-11-21 19:08 ` Pavel Machek
2014-10-21 19:23 ` Andy Lutomirski
2014-10-22 17:04 ` Zygo Blaxell
2014-10-27 14:28 ` Bastien Nocera
2014-10-27 20:59 ` Zygo Blaxell
2014-10-28 12:36 ` Bastien Nocera
2014-10-28 14:36 ` John Stultz
2014-10-31 13:54 ` Bastien Nocera
2014-10-31 17:38 ` John Stultz
[not found] ` <CANszf4gaozN9YHzxUToRP9CaA1VVEV9vcz_X6LDL1zW3fH4Fow@mail.gmail.com>
2014-10-28 16:41 ` Fwd: " Rogelio Serrano
2014-10-27 9:28 ` Pavel Machek
2014-10-27 14:31 ` Bastien Nocera
2014-10-28 18:50 ` suspend to partition " Pavel Machek
2014-10-30 13:57 ` Bastien Nocera
2014-10-29 19:19 ` Andy Lutomirski
2014-10-29 20:26 ` Theodore Ts'o
2014-10-29 21:16 ` Pavel Machek
2014-10-30 14:45 ` Bastien Nocera
2014-10-30 14:53 ` Andy Lutomirski
2014-10-30 15:07 ` Bastien Nocera
2014-10-30 18:23 ` Pavel Machek
2014-10-31 13:57 ` Bastien Nocera
2014-10-30 15:05 ` Theodore Ts'o
2014-10-30 15:15 ` Bastien Nocera
2014-10-30 15:34 ` Theodore Ts'o
2014-10-30 15:36 ` Bastien Nocera
2014-10-30 17:41 ` Pavel Machek
2014-10-31 13:59 ` Bastien Nocera
2014-10-30 23:21 ` One Thousand Gnomes
2014-10-30 23:19 ` One Thousand Gnomes
2014-10-30 14:42 ` Bastien Nocera
2014-10-28 22:42 ` One Thousand Gnomes
2014-10-21 18:24 ` Geert Uytterhoeven
2014-10-27 14:20 ` Bastien Nocera
2014-10-27 15:31 ` Geert Uytterhoeven
2014-10-27 15:44 ` Bastien Nocera
2015-04-30 16:25 ` Bastien Nocera
2015-04-30 17:10 ` John Stultz
2015-04-30 17:23 ` Olof Johansson
2015-04-30 18:54 ` Chirantan Ekbote
2015-05-01 9:02 ` Tomeu Vizoso
2015-05-04 22:19 ` Rafael J. Wysocki
2015-05-05 6:05 ` Tomeu Vizoso
2015-05-05 12:31 ` Rafael J. Wysocki
2015-05-07 16:54 ` One Thousand Gnomes
2015-05-07 21:03 ` Rafael J. Wysocki
2015-05-08 7:09 ` Tomeu Vizoso
2015-05-04 22:12 ` Rafael J. Wysocki
2015-05-04 23:30 ` Chirantan Ekbote
2015-05-05 10:46 ` Bastien Nocera
2015-05-05 19:22 ` Chirantan Ekbote
2015-05-06 12:41 ` Bastien Nocera
2015-05-05 14:39 ` Alan Stern
2015-05-05 17:58 ` Chirantan Ekbote
2015-05-05 19:35 ` Alan Stern
2015-05-05 20:58 ` Chirantan Ekbote
2015-05-05 23:56 ` Rafael J. Wysocki
2015-05-05 23:38 ` David Lang
2015-05-05 23:51 ` Rafael J. Wysocki
2015-05-07 17:03 ` One Thousand Gnomes
2015-05-07 18:21 ` Chirantan Ekbote
2015-05-05 23:47 ` Rafael J. Wysocki
2015-05-06 17:40 ` Chirantan Ekbote
2015-05-07 23:19 ` Rafael J. Wysocki
2015-05-11 22:12 ` Pavel Machek
2015-05-12 0:45 ` Rafael J. Wysocki
2014-10-21 19:28 ` Andy Lutomirski
2014-10-21 19:43 ` Al Viro
2014-10-21 19:47 ` Andy Lutomirski
2014-10-27 13:55 ` Bastien Nocera
2014-10-27 15:12 ` Andy Lutomirski
2014-10-27 15:45 ` Bastien Nocera
2014-10-27 16:08 ` Andy Lutomirski
2014-10-27 16:09 ` Bastien Nocera
2014-10-27 16:22 ` Al Viro
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=1414419579.30379.49.camel@hadess.net \
--to=hadess@hadess.net \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.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
Powered by JetHome