Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1578834
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: alarm timer/timerfd expiration does not abort suspend operation |
| Date | 2017-02-10 23:40 +0100 |
| Message-ID | <t9s1c-10A-11@gated-at.bofh.it> (permalink) |
| References | <t9g01-1Hw-13@gated-at.bofh.it> <t9g01-1Hw-11@gated-at.bofh.it> <t9oAj-7fF-41@gated-at.bofh.it> <t9p3j-7EV-9@gated-at.bofh.it> <t9p3j-7EV-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Feb 10, 2017 at 8:23 PM, Gabriel Beddingfield <gabe@nestlabs.com> wrote: > Hi John, > > Re-sending because VGER rejected my hipster HTML mail... sorry! > > On Fri, Feb 10, 2017 at 10:49 AM, John Stultz <john.stultz@linaro.org> wrote: >>> I see a few ways to fix it: >>> >>> 1. Create a wakeup_source for each timerfd, and if it's an alarm timer >>> call >>> __pm_stay_awake() in timerfd_triggered() and __pm_relax() in >>> timerfd_read(). >>> 2. call pm_system_wakeup() in alarmtimer_fired() >>> 3. call `if (isalarm(ctx)) pm_system_wakeup();' in timerfd_triggered() >>> 4. call __pm_wakeup_event(ws, 2 * MSECS_PER_SEC) in alarmtimer_fired() >>> 5. call `if (isalarm(ctc)) __pm_wakeup_event(ws, 2 * MSECS_PER_SEC);' >>> in >>> timerfd_triggered() (using a static struct wakeup_source). > [snip] >>> * #4 Matches the current behavior of the "happy case" if and only if >>> userspace is using the 'wakeup' system, otherwise doesn't change any >>> behavior. But, I wonder how many people think the current behavior is a >>> bug. > [snip] >> The approach you took in your patch looks basically ok to me, though I >> >> think the __pm_wakeup_event() method in #4 sounds safer, just to avoid >> the problematic issue if no one is waiting on the fd. >> >> Though I worry I'm not quite understanding the con for that case >> properly, so maybe you can clarify what concerns you there? > > The concern is born of my personal experience: I was ignorant of the > "wakeup_count" protocol, and so I wasn't using it. Because of this > __pm_wakeup_event() would not block a suspend because I never wrote to > wakeup_count. On the other hand, method #2 will work unconditionally. Right. So if you want the timerfd behavior to not depend on whether or not wakeup_count is used by user space, #2 is the way to go. That said, creating a wakeup source for each timerfd would be nicer from the diagnostics perspective, so maybe you can combine #1 and #2 such that if user space doesn't use wakeup_count, alarmtimer_fired() will still abort suspends in a hard way? Thanks, Rafael
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: alarm timer/timerfd expiration does not abort suspend operation Thomas Gleixner <tglx@linutronix.de> - 2017-02-10 10:50 +0100
Re: alarm timer/timerfd expiration does not abort suspend operation John Stultz <john.stultz@linaro.org> - 2017-02-10 20:00 +0100
Re: alarm timer/timerfd expiration does not abort suspend operation Gabriel Beddingfield <gabe@nestlabs.com> - 2017-02-10 20:30 +0100
Re: alarm timer/timerfd expiration does not abort suspend operation "Rafael J. Wysocki" <rafael@kernel.org> - 2017-02-10 23:40 +0100
csiph-web