Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488369

Re: [PATCH v4 2/2] rtc-cmos: Restore alarm after resume

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 2/2] rtc-cmos: Restore alarm after resume
Date 2016-09-21 22:10 +0200
Message-ID <sjW0a-545-21@gated-at.bofh.it> (permalink)
References <sjg0W-3wX-19@gated-at.bofh.it> <sjg0V-3wX-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 20/09/2016 at 01:12:44 +0200, Gabriele Mazzotta wrote :
> Some platform firmware may interfere with the RTC alarm over suspend,
> resulting in the kernel and hardware having different ideas about system
> state but also potentially causing problems with firmware that assumes the
> OS will clean this case up.  This patch restores the RTC alarm on resume
> to ensure that kernel and hardware are in sync.
> 
> The case we've seen is Intel Rapid Start, which is a firmware-mediated
> feature that automatically transitions systems from suspend-to-RAM to
> suspend-to-disk without OS involvement.  It does this by setting the RTC
> alarm and a flag that indicates that on wake it should perform the
> transition rather than re-starting the OS.  However, if the OS has set a
> wakeup alarm that would wake the machine earlier, it refuses to overwrite
> it and allows the system to wake instead.
> 
> This fails in the following situation:
> 
> 1) User configures Intel Rapid Start to transition after (say) 15
> minutes
> 2) User suspends to RAM. Firmware sets the wakeup alarm for 15 minutes
> in the future
> 3) User resumes after 5 minutes. Firmware does not reset the alarm, and
> as such it is still set for 10 minutes in the future
> 4) User suspends after 5 minutes. Firmware notices that the alarm is set
> for 5 minutes in the future, which is less than the 15 minute transition
> threshold. It therefore assumes that the user wants the machine to wake
> in 5 minutes
> 5) System resumes after 5 minutes
> 
> The worst case scenario here is that the user may have put the system in a
> bag between (4) and (5), resulting in it running in a confined space and
> potentially overheating.  This seems reasonably important.  The Rapid
> Start support code got added in 3.11, but it can be configured in the
> firmware regardless of kernel support.
> 
> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
> ---
>  drivers/rtc/rtc-cmos.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v4 2/2] rtc-cmos: Restore alarm after resume Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-09-20 01:20 +0200
  Re: [PATCH v4 2/2] rtc-cmos: Restore alarm after resume Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-09-21 22:10 +0200

csiph-web