1. 20 7月, 2018 2 次提交
  2. 13 7月, 2018 1 次提交
  3. 11 7月, 2018 1 次提交
    • M
      timekeeping: Update multiplier when NTP frequency is set directly · b061c7a5
      Miroslav Lichvar 提交于
      When the NTP frequency is set directly from userspace using the
      ADJ_FREQUENCY or ADJ_TICK timex mode, immediately update the
      timekeeper's multiplier instead of waiting for the next tick.
      
      This removes a hidden non-deterministic delay in setting of the
      frequency and allows an extremely tight control of the system clock
      with update rates close to or even exceeding the kernel HZ.
      
      The update is limited to archs using modern timekeeping
      (!ARCH_USES_GETTIMEOFFSET).
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Miroslav Lichvar <mlichvar@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Signed-off-by: NMiroslav Lichvar <mlichvar@redhat.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      b061c7a5
  4. 02 7月, 2018 3 次提交
  5. 24 6月, 2018 3 次提交
  6. 22 6月, 2018 1 次提交
  7. 19 6月, 2018 4 次提交
  8. 12 6月, 2018 1 次提交
  9. 27 5月, 2018 1 次提交
    • T
      PM / suspend: Prevent might sleep splats · c1a957d1
      Thomas Gleixner 提交于
      timekeeping suspend/resume calls read_persistent_clock() which takes
      rtc_lock. That results in might sleep warnings because at that point
      we run with interrupts disabled.
      
      We cannot convert rtc_lock to a raw spinlock as that would trigger
      other might sleep warnings.
      
      As a workaround we disable the might sleep warnings by setting
      system_state to SYSTEM_SUSPEND before calling sysdev_suspend() and
      restoring it to SYSTEM_RUNNING afer sysdev_resume(). There is no lock
      contention because hibernate / suspend to RAM is single-CPU at this
      point.
      
      In s2idle's case the system_state is set to SYSTEM_SUSPEND before
      timekeeping_suspend() which is invoked by the last CPU. In the resume
      case it set back to SYSTEM_RUNNING after timekeeping_resume() which is
      invoked by the first CPU in the resume case. The other CPUs will block
      on tick_freeze_lock.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      [bigeasy: cover s2idle in tick_freeze() / tick_unfreeze()]
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c1a957d1
  10. 19 5月, 2018 4 次提交
    • A
      timekeeping: Add ktime_get_coarse_with_offset · b9ff604c
      Arnd Bergmann 提交于
      I have run into a couple of drivers using current_kernel_time()
      suffering from the y2038 problem, and they could be converted
      to using ktime_t, but don't have interfaces that skip the nanosecond
      calculation at the moment.
      
      This introduces ktime_get_coarse_with_offset() as a simpler
      variant of ktime_get_with_offset(), and adds wrappers for the
      three time domains we support with the existing function.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: y2038@lists.linaro.org
      Cc: John Stultz <john.stultz@linaro.org>
      Link: https://lkml.kernel.org/r/20180427134016.2525989-5-arnd@arndb.de
      b9ff604c
    • A
      timekeeping: Standardize on ktime_get_*() naming · fb7fcc96
      Arnd Bergmann 提交于
      The current_kernel_time64, get_monotonic_coarse64, getrawmonotonic64,
      get_monotonic_boottime64 and timekeeping_clocktai64 interfaces have
      rather inconsistent naming, and they differ in the calling conventions
      by passing the output either by reference or as a return value.
      
      Rename them to ktime_get_coarse_real_ts64, ktime_get_coarse_ts64,
      ktime_get_raw_ts64, ktime_get_boottime_ts64 and ktime_get_clocktai_ts64
      respectively, and provide the interfaces with macros or inline
      functions as needed.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: y2038@lists.linaro.org
      Cc: John Stultz <john.stultz@linaro.org>
      Link: https://lkml.kernel.org/r/20180427134016.2525989-4-arnd@arndb.de
      fb7fcc96
    • A
      timekeeping: Clean up ktime_get_real_ts64 · edca71fe
      Arnd Bergmann 提交于
      In a move to make ktime_get_*() the preferred driver interface into the
      timekeeping code, sanitizes ktime_get_real_ts64() to be a proper exported
      symbol rather than an alias for getnstimeofday64().
      
      The internal __getnstimeofday64() is no longer used, so remove that
      and merge it into ktime_get_real_ts64().
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: y2038@lists.linaro.org
      Cc: John Stultz <john.stultz@linaro.org>
      Link: https://lkml.kernel.org/r/20180427134016.2525989-3-arnd@arndb.de
      edca71fe
    • A
      timekeeping: Remove timespec64 hack · 4f0fad9a
      Arnd Bergmann 提交于
      At this point, we have converted most of the kernel to use timespec64
      consistently in place of timespec, so it seems it's time to make
      timespec64 the native structure and define timespec in terms of that
      one on 64-bit architectures.
      
      Starting with gcc-5, the compiler can completely optimize away the
      timespec_to_timespec64 and timespec64_to_timespec functions on 64-bit
      architectures. With older compilers, we introduce a couple of extra
      copies of local variables, but those are easily avoided by using
      the timespec64 based interfaces consistently, as we do in most of the
      important code paths already.
      
      The main upside of removing the hack is that printing the tv_sec
      field of a timespec64 structure can now use the %lld format
      string on all architectures without a cast to time64_t. Without
      this patch, the field is a 'long' type and would have to be printed
      using %ld on 64-bit architectures.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: y2038@lists.linaro.org
      Cc: John Stultz <john.stultz@linaro.org>
      Link: https://lkml.kernel.org/r/20180427134016.2525989-2-arnd@arndb.de
      4f0fad9a
  11. 17 5月, 2018 1 次提交
  12. 16 5月, 2018 2 次提交
  13. 13 5月, 2018 3 次提交
  14. 02 5月, 2018 5 次提交
  15. 26 4月, 2018 2 次提交
    • T
      Revert: Unify CLOCK_MONOTONIC and CLOCK_BOOTTIME · a3ed0e43
      Thomas Gleixner 提交于
      Revert commits
      
      92af4dcb ("tracing: Unify the "boot" and "mono" tracing clocks")
      127bfa5f ("hrtimer: Unify MONOTONIC and BOOTTIME clock behavior")
      7250a404 ("posix-timers: Unify MONOTONIC and BOOTTIME clock behavior")
      d6c7270e ("timekeeping: Remove boot time specific code")
      f2d6fdbf ("Input: Evdev - unify MONOTONIC and BOOTTIME clock behavior")
      d6ed449a ("timekeeping: Make the MONOTONIC clock behave like the BOOTTIME clock")
      72199320 ("timekeeping: Add the new CLOCK_MONOTONIC_ACTIVE clock")
      
      As stated in the pull request for the unification of CLOCK_MONOTONIC and
      CLOCK_BOOTTIME, it was clear that we might have to revert the change.
      
      As reported by several folks systemd and other applications rely on the
      documented behaviour of CLOCK_MONOTONIC on Linux and break with the above
      changes. After resume daemons time out and other timeout related issues are
      observed. Rafael compiled this list:
      
      * systemd kills daemons on resume, after >WatchdogSec seconds
        of suspending (Genki Sky).  [Verified that that's because systemd uses
        CLOCK_MONOTONIC and expects it to not include the suspend time.]
      
      * systemd-journald misbehaves after resume:
        systemd-journald[7266]: File /var/log/journal/016627c3c4784cd4812d4b7e96a34226/system.journal
      corrupted or uncleanly shut down, renaming and replacing.
        (Mike Galbraith).
      
      * NetworkManager reports "networking disabled" and networking is broken
        after resume 50% of the time (Pavel).  [May be because of systemd.]
      
      * MATE desktop dims the display and starts the screensaver right after
        system resume (Pavel).
      
      * Full system hang during resume (me).  [May be due to systemd or NM or both.]
      
      That happens on debian and open suse systems.
      
      It's sad, that these problems were neither catched in -next nor by those
      folks who expressed interest in this change.
      Reported-by: NRafael J. Wysocki <rjw@rjwysocki.net>
      Reported-by: Genki Sky <sky@genki.is>,
      Reported-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Kevin Easton <kevin@guarana.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Salyzyn <salyzyn@android.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      a3ed0e43
    • T
      tick/sched: Do not mess with an enqueued hrtimer · 1f71addd
      Thomas Gleixner 提交于
      Kaike reported that in tests rdma hrtimers occasionaly stopped working. He
      did great debugging, which provided enough context to decode the problem.
      
      CPU 3			     	      	     CPU 2
      
      idle
      start sched_timer expires = 712171000000
       queue->next = sched_timer
      					    start rdmavt timer. expires = 712172915662
      					    lock(baseof(CPU3))
      tick_nohz_stop_tick()
      tick = 716767000000			    timerqueue_add(tmr)
      
      hrtimer_set_expires(sched_timer, tick);
        sched_timer->expires = 716767000000  <---- FAIL
      					     if (tmr->expires < queue->next->expires)
      hrtimer_start(sched_timer)		          queue->next = tmr;
      lock(baseof(CPU3))
      					     unlock(baseof(CPU3))
      timerqueue_remove()
      timerqueue_add()
      
      ts->sched_timer is queued and queue->next is pointing to it, but then
      ts->sched_timer.expires is modified.
      
      This not only corrupts the ordering of the timerqueue RB tree, it also
      makes CPU2 see the new expiry time of timerqueue->next->expires when
      checking whether timerqueue->next needs to be updated. So CPU2 sees that
      the rdma timer is earlier than timerqueue->next and sets the rdma timer as
      new next.
      
      Depending on whether it had also seen the new time at RB tree enqueue, it
      might have queued the rdma timer at the wrong place and then after removing
      the sched_timer the RB tree is completely hosed.
      
      The problem was introduced with a commit which tried to solve inconsistency
      between the hrtimer in the tick_sched data and the underlying hardware
      clockevent. It split out hrtimer_set_expires() to store the new tick time
      in both the NOHZ and the NOHZ + HIGHRES case, but missed the fact that in
      the NOHZ + HIGHRES case the hrtimer might still be queued.
      
      Use hrtimer_start(timer, tick...) for the NOHZ + HIGHRES case which sets
      timer->expires after canceling the timer and move the hrtimer_set_expires()
      invocation into the NOHZ only code path which is not affected as it merily
      uses the hrtimer as next event storage so code pathes can be shared with
      the NOHZ + HIGHRES case.
      
      Fixes: d4af6d93 ("nohz: Fix spurious warning when hrtimer and clockevent get out of sync")
      Reported-by: N"Wan Kaike" <kaike.wan@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NFrederic Weisbecker <frederic@kernel.org>
      Cc: "Marciniszyn Mike" <mike.marciniszyn@intel.com>
      Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
      Cc: linux-rdma@vger.kernel.org
      Cc: "Dalessandro Dennis" <dennis.dalessandro@intel.com>
      Cc: "Fleck John" <john.fleck@intel.com>
      Cc: stable@vger.kernel.org
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: "Weiny Ira" <ira.weiny@intel.com>
      Cc: "linux-rdma@vger.kernel.org"
      Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1804241637390.1679@nanos.tec.linutronix.de
      Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1804242119210.1597@nanos.tec.linutronix.de
      
      1f71addd
  16. 19 4月, 2018 6 次提交