1. 26 10月, 2017 1 次提交
  2. 28 9月, 2017 1 次提交
  3. 31 5月, 2017 1 次提交
    • V
      rtc: interface: Validate alarm-time before handling rollover · da96aea0
      Vaibhav Jain 提交于
      In function __rtc_read_alarm() its possible for an alarm time-stamp to
      be invalid even after replacing missing components with current
      time-stamp. The condition 'alarm->time.tm_year < 70' will trigger this
      case and will cause the call to 'rtc_tm_to_time64(&alarm->time)'
      return a negative value for variable t_alm.
      
      While handling alarm rollover this negative t_alm (assumed to seconds
      offset from '1970-01-01 00:00:00') is converted back to rtc_time via
      rtc_time64_to_tm() which results in this error log with seemingly
      garbage values:
      
      "rtc rtc0: invalid alarm value: -2-1--1041528741
      2005511117:71582844:32"
      
      This error was generated when the rtc driver (rtc-opal in this case)
      returned an alarm time-stamp of '00-00-00 00:00:00' to indicate that
      the alarm is disabled. Though I have submitted a separate fix for the
      rtc-opal driver, this issue may potentially impact other
      existing/future rtc drivers.
      
      To fix this issue the patch validates the alarm time-stamp just after
      filling up the missing datetime components and if rtc_valid_tm() still
      reports it to be invalid then bails out of the function without
      handling the rollover.
      Reported-by: NSteve Best <sbest@redhat.com>
      Signed-off-by: NVaibhav Jain <vaibhav@linux.vnet.ibm.com>
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      da96aea0
  4. 26 12月, 2016 2 次提交
    • T
      ktime: Cleanup ktime_set() usage · 8b0e1953
      Thomas Gleixner 提交于
      ktime_set(S,N) was required for the timespec storage type and is still
      useful for situations where a Seconds and Nanoseconds part of a time value
      needs to be converted. For anything where the Seconds argument is 0, this
      is pointless and can be replaced with a simple assignment.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      8b0e1953
    • T
      ktime: Get rid of the union · 2456e855
      Thomas Gleixner 提交于
      ktime is a union because the initial implementation stored the time in
      scalar nanoseconds on 64 bit machine and in a endianess optimized timespec
      variant for 32bit machines. The Y2038 cleanup removed the timespec variant
      and switched everything to scalar nanoseconds. The union remained, but
      become completely pointless.
      
      Get rid of the union and just keep ktime_t as simple typedef of type s64.
      
      The conversion was done with coccinelle and some manual mopping up.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      2456e855
  5. 12 7月, 2016 1 次提交
  6. 04 6月, 2016 1 次提交
    • C
      rtc: interface: ignore expired timers when enqueuing new timers · 2b2f5ff0
      Colin Ian King 提交于
      This patch fixes a RTC wakealarm issue, namely, the event fires during
      hibernate and is not cleared from the list, causing hwclock to block.
      
      The current enqueuing does not trigger an alarm if any expired timers
      already exist on the timerqueue. This can occur when a RTC wake alarm
      is used to wake a machine out of hibernate and the resumed state has
      old expired timers that have not been removed from the timer queue.
      This fix skips over any expired timers and triggers an alarm if there
      are no pending timers on the timerqueue. Note that the skipped expired
      timer will get reaped later on, so there is no need to clean it up
      immediately.
      
      The issue can be reproduced by putting a machine into hibernate and
      waking it with the RTC wakealarm.  Running the example RTC test program
      from tools/testing/selftests/timers/rtctest.c after the hibernate will
      block indefinitely.  With the fix, it no longer blocks after the
      hibernate resume.
      
      BugLink: http://bugs.launchpad.net/bugs/1333569Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      2b2f5ff0
  7. 30 5月, 2016 1 次提交
  8. 15 3月, 2016 1 次提交
  9. 05 9月, 2015 1 次提交
  10. 25 6月, 2015 1 次提交
  11. 20 6月, 2015 1 次提交
  12. 17 4月, 2015 1 次提交
  13. 03 4月, 2015 1 次提交
  14. 24 1月, 2015 1 次提交
  15. 11 12月, 2014 2 次提交
  16. 09 8月, 2014 1 次提交
  17. 07 6月, 2014 1 次提交
  18. 04 4月, 2014 1 次提交
  19. 23 7月, 2013 1 次提交
    • Z
      rtc: Keep system awake until all expired RTC timers are handled · 14d0e347
      Zoran Markovic 提交于
      Current implementation of RTC interface allows for system suspend to
      occur in the following cases:
      (a) if a timer is set in the past and rtc_timer_do_work() is scheduled
      to handle it, and
      (b) if rtc_timer_do_work() is called to handle expired timers whose
      handlers implement a preemption point.
      
      A pending suspend request may be honoured in the above cases causing
      timer handling to be delayed until after the next resume. This is
      undesirable since timer handlers may have time-critical code to execute.
      
      This patch makes sure that the system stays awake until all expired
      timers are handled.
      
      Note that all calls to pm_stay_awake() are eventually paired with
      the single pm_relax() call in rtc_timer_do_work(), which is launched
      using schedule_work().
      
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Arve Hjonnevag <arve@android.com>
      Cc: Todd Poynor <toddpoynor@google.com>
      Signed-off-by: NZoran Markovic <zoran.markovic@linaro.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      14d0e347
  20. 04 7月, 2013 2 次提交
  21. 07 2月, 2013 1 次提交
  22. 09 8月, 2012 1 次提交
    • N
      RTC: Avoid races between RTC alarm wakeup and suspend. · 7523ceed
      NeilBrown 提交于
      If an RTC alarm fires just as suspend is happening, it is possible for
      suspend to complete and the alarm to be missed.
      
      To avoid the race, we must register the event with the PM core.
      
      As the event is made visible to userspace through a thread which is
      only scheduled by the interrupt, we need a pm_stay_awake/pm_relax
      pair preventing suspend from the interrupt until the thread completes
      its work.
      
      This makes the pm_wakeup_event() call in cmos_interrupt unnecessary as
      it provides suspend protection for all RTCs that use rtc_update_irq.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      7523ceed
  23. 16 3月, 2012 1 次提交
  24. 27 1月, 2012 3 次提交
    • R
      rtc: Disable the alarm in the hardware (v2) · 41c7f742
      Rabin Vincent 提交于
      Currently, the RTC code does not disable the alarm in the hardware.
      
      This means that after a sequence such as the one below (the files are in the
      RTC sysfs), the box will boot up after 2 minutes even though we've
      asked for the alarm to be turned off.
      
      	# echo $((`cat since_epoch`)+120) > wakealarm
      	# echo 0 > wakealarm
      	# poweroff
      
      Fix this by disabling the alarm when there are no timers to run.
      
      The original version of this patch was reverted. This version
      disables the irq directly instead of setting a disabled timer
      in the future.
      
      Cc: stable@kernel.org
      Cc: John Stultz <john.stultz@linaro.org>
      Signed-off-by: NRabin Vincent <rabin.vincent@stericsson.com>
      [Merged in the second revision from Rabin]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      41c7f742
    • N
      rtc: Expire alarms after the time is set. (v2) · 5f9679d2
      NeilBrown 提交于
      If the alarm time programming in the rtc is ever in the past, it won't fire,
      and any other alarm will be queued after it so they won't fire either.
      
      So any time that the alarm might be in the past, we need to trigger
      the irq handler to ensure the old alarm is cleared and the timer queue
      is fully in the future.
      
      This is done whenever the RTC clock is set.
      
      This is the second revision of this patch, which was earlier reverted.
      This version avoids the initialization problem, which is handled by
      a different patch.
      Tested-by: NSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      [Remove problematic initialization change, update commit log, also
      catch set_mmss case -jstultz]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      5f9679d2
    • J
      rtc: Avoid setting alarm to a time in the past · bd729d72
      John Stultz 提交于
      In some cases at boot up, the RTC alarm may be set in the past,
      but still have the enabled flag on. This was causing problems,
      because we would then enqueue the alarm into the timerqueue,
      but it would never fire. This would clog up the timerqueue
      and keep other alarms from working.
      
      The fix is to check the alarm against the current rtc time at
      boot and avoid enqueueing the alarm if it is in the past.
      Reported-by: NNeilBrown <neilb@suse.de>
      Tested-by: NNeilBrown <neilb@suse.de>
      Tested-by: NSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      bd729d72
  25. 11 1月, 2012 1 次提交
  26. 04 1月, 2012 2 次提交
    • L
      Revert "rtc: Expire alarms after the time is set." · f423fc62
      Linus Torvalds 提交于
      This reverts commit 93b2ec01.
      
      The call to "schedule_work()" in rtc_initialize_alarm() happens too
      early, and can cause oopses at bootup
      
      Neil Brown explains why we do it:
      
        "If you set an alarm in the future, then shutdown and boot again after
         that time, then you will end up with a timer_queue node which is in
         the past.
      
         When this happens the queue gets stuck.  That entry-in-the-past won't
         get removed until and interrupt happens and an interrupt won't happen
         because the RTC only triggers an interrupt when the alarm is "now".
      
         So you'll find that e.g.  "hwclock" will always tell you that
         'select' timed out.
      
         So we force the interrupt work to happen at the start just in case."
      
      and has a patch that convert it to do things in-process rather than with
      the worker thread, but right now it's too late to play around with this,
      so we just revert the patch that caused problems for now.
      Reported-by: NSander Eikelenboom <linux@eikelenboom.it>
      Requested-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Requested-by: NJohn Stultz <john.stultz@linaro.org>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f423fc62
    • L
      Revert "rtc: Disable the alarm in the hardware" · 157e8bf8
      Linus Torvalds 提交于
      This reverts commit c0afabd3.
      
      It causes failures on Toshiba laptops - instead of disabling the alarm,
      it actually seems to enable it on the affected laptops, resulting in
      (for example) the laptop powering on automatically five minutes after
      shutdown.
      
      There's a patch for it that appears to work for at least some people,
      but it's too late to play around with this, so revert for now and try
      again in the next merge window.
      
      See for example
      
      	http://bugs.debian.org/652869
      
      Reported-and-bisected-by: Andreas Friedrich <afrie@gmx.net> (Toshiba Tecra)
      Reported-by: Antonio-M. Corbi Bellot <antonio.corbi@ua.es> (Toshiba Portege R500)
      Reported-by: Marco Santos <marco.santos@waynext.com> (Toshiba Portege Z830)
      Reported-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>  (Toshiba Portege R830)
      Cc: Jonathan Nieder <jrnieder@gmail.com>
      Requested-by: NJohn Stultz <john.stultz@linaro.org>
      Cc: stable@kernel.org  # for the versions that applied this
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      157e8bf8
  27. 14 12月, 2011 1 次提交
    • N
      rtc: Expire alarms after the time is set. · 93b2ec01
      NeilBrown 提交于
      If the alarm time programming in the rtc is ever in the past, it won't fire,
      and any other alarm will be queued after it so they won't fire either.
      
      So any time that the alarm might be in the past, we need to trigger
      the irq handler to ensure the old alarm is cleared and the timer queue
      is fully in the future.
      
      This can happen:
       - when we first initialise the alarm
       - when we set the time in the rtc.
      
      so follow both of these by scheduling the timer work function.
      
      CC: stable@kernel.org
      Signed-off-by: NNeilBrown <neilb@suse.de>
      [Also catch set_mmss case -jstultz]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      93b2ec01
  28. 23 11月, 2011 1 次提交
    • R
      rtc: Disable the alarm in the hardware · c0afabd3
      Rabin Vincent 提交于
      Currently, the RTC code does not disable the alarm in the hardware.
      
      This means that after a sequence such as the one below (the files are in the
      RTC sysfs), the box will boot up after 2 minutes even though we've
      asked for the alarm to be turned off.
      
      	# echo $((`cat since_epoch`)+120) > wakealarm
      	# echo 0 > wakealarm
      	# poweroff
      
      Fix this by disabling the alarm when there are no timers to run.
      
      Cc: stable@kernel.org
      Cc: John Stultz <john.stultz@linaro.org>
      Signed-off-by: NRabin Vincent <rabin.vincent@stericsson.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      c0afabd3
  29. 01 11月, 2011 1 次提交
  30. 11 8月, 2011 1 次提交
    • J
      rtc: Fix RTC PIE frequency limit · 938f97bc
      John Stultz 提交于
      Thomas earlier submitted a fix to limit the RTC PIE freq, but
      picked 5000Hz out of the air. Willy noticed that we should
      instead use the 8192Hz max from the rtc man documentation.
      
      Cc: Willy Tarreau <w@1wt.eu>
      Cc: stable@kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      938f97bc
  31. 27 7月, 2011 4 次提交