1. 02 5月, 2018 4 次提交
  2. 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
  3. 19 4月, 2018 6 次提交
  4. 17 4月, 2018 2 次提交
  5. 10 4月, 2018 1 次提交
  6. 09 4月, 2018 5 次提交
  7. 08 4月, 2018 2 次提交
  8. 06 4月, 2018 4 次提交
    • R
      cpuidle: Return nohz hint from cpuidle_select() · 45f1ff59
      Rafael J. Wysocki 提交于
      Add a new pointer argument to cpuidle_select() and to the ->select
      cpuidle governor callback to allow a boolean value indicating
      whether or not the tick should be stopped before entering the
      selected state to be returned from there.
      
      Make the ladder governor ignore that pointer (to preserve its
      current behavior) and make the menu governor return 'false" through
      it if:
       (1) the idle exit latency is constrained at 0, or
       (2) the selected state is a polling one, or
       (3) the expected idle period duration is within the tick period
           range.
      
      In addition to that, the correction factor computations in the menu
      governor need to take the possibility that the tick may not be
      stopped into account to avoid artificially small correction factor
      values.  To that end, add a mechanism to record tick wakeups, as
      suggested by Peter Zijlstra, and use it to modify the menu_update()
      behavior when tick wakeup occurs.  Namely, if the CPU is woken up by
      the tick and the return value of tick_nohz_get_sleep_length() is not
      within the tick boundary, the predicted idle duration is likely too
      short, so make menu_update() try to compensate for that by updating
      the governor statistics as though the CPU was idle for a long time.
      
      Since the value returned through the new argument pointer of
      cpuidle_select() is not used by its caller yet, this change by
      itself is not expected to alter the functionality of the code.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      45f1ff59
    • R
      jiffies: Introduce USER_TICK_USEC and redefine TICK_USEC · efefc977
      Rafael J. Wysocki 提交于
      Since the subsequent changes will need a TICK_USEC definition
      analogous to TICK_NSEC, rename the existing TICK_USEC as
      USER_TICK_USEC, update its users and redefine TICK_USEC
      accordingly.
      Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: NFrederic Weisbecker <frederic@kernel.org>
      efefc977
    • R
      sched: idle: Do not stop the tick upfront in the idle loop · 2aaf709a
      Rafael J. Wysocki 提交于
      Push the decision whether or not to stop the tick somewhat deeper
      into the idle loop.
      
      Stopping the tick upfront leads to unpleasant outcomes in case the
      idle governor doesn't agree with the nohz code on the duration of the
      upcoming idle period.  Specifically, if the tick has been stopped and
      the idle governor predicts short idle, the situation is bad regardless
      of whether or not the prediction is accurate.  If it is accurate, the
      tick has been stopped unnecessarily which means excessive overhead.
      If it is not accurate, the CPU is likely to spend too much time in
      the (shallow, because short idle has been predicted) idle state
      selected by the governor [1].
      
      As the first step towards addressing this problem, change the code
      to make the tick stopping decision inside of the loop in do_idle().
      In particular, do not stop the tick in the cpu_idle_poll() code path.
      Also don't do that in tick_nohz_irq_exit() which doesn't really have
      enough information on whether or not to stop the tick.
      
      Link: https://marc.info/?l=linux-pm&m=150116085925208&w=2 # [1]
      Link: https://tu-dresden.de/zih/forschung/ressourcen/dateien/projekte/haec/powernightmares.pdfSuggested-by: NFrederic Weisbecker <frederic@kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NFrederic Weisbecker <frederic@kernel.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      2aaf709a
    • R
      time: tick-sched: Reorganize idle tick management code · 0e776768
      Rafael J. Wysocki 提交于
      Prepare the scheduler tick code for reworking the idle loop to
      avoid stopping the tick in some cases.
      
      The idea is to split the nohz idle entry call to decouple the idle
      time stats accounting and preparatory work from the actual tick stop
      code, in order to later be able to delay the tick stop once we reach
      more power-knowledgeable callers.
      
      Move away the tick_nohz_start_idle() invocation from
      __tick_nohz_idle_enter(), rename the latter to
      __tick_nohz_idle_stop_tick() and define tick_nohz_idle_stop_tick()
      as a wrapper around it for calling it from the outside.
      
      Make tick_nohz_idle_enter() only call tick_nohz_start_idle() instead
      of calling the entire __tick_nohz_idle_enter(), add another wrapper
      disabling and enabling interrupts around tick_nohz_idle_stop_tick()
      and make the current callers of tick_nohz_idle_enter() call it too
      to retain their current functionality.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NFrederic Weisbecker <frederic@kernel.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      0e776768
  9. 05 4月, 2018 1 次提交
    • D
      syscalls/core: Prepare CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y for compat syscalls · 7303e30e
      Dominik Brodowski 提交于
      It may be useful for an architecture to override the definitions of the
      COMPAT_SYSCALL_DEFINE0() and __COMPAT_SYSCALL_DEFINEx() macros in
      <linux/compat.h>, in particular to use a different calling convention
      for syscalls. This patch provides a mechanism to do so, based on the
      previously introduced CONFIG_ARCH_HAS_SYSCALL_WRAPPER. If it is enabled,
      <asm/sycall_wrapper.h> is included in <linux/compat.h> and may be used
      to define the macros mentioned above. Moreover, as the syscall calling
      convention may be different if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is set,
      the compat syscall function prototypes in <linux/compat.h> are #ifndef'd
      out in that case.
      
      As some of the syscalls and/or compat syscalls may not be present,
      the COND_SYSCALL() and COND_SYSCALL_COMPAT() macros in kernel/sys_ni.c
      as well as the SYS_NI() and COMPAT_SYS_NI() macros in
      kernel/time/posix-stubs.c can be re-defined in <asm/syscall_wrapper.h> iff
      CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled.
      Signed-off-by: NDominik Brodowski <linux@dominikbrodowski.net>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20180405095307.3730-5-linux@dominikbrodowski.netSigned-off-by: NIngo Molnar <mingo@kernel.org>
      7303e30e
  10. 29 3月, 2018 1 次提交
    • T
      alarmtimer: Init nanosleep alarm timer on stack · bd031430
      Thomas Gleixner 提交于
      syszbot reported the following debugobjects splat:
      
       ODEBUG: object is on stack, but not annotated
       WARNING: CPU: 0 PID: 4185 at lib/debugobjects.c:328
      
       RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:327 [inline]
       debug_object_init+0x17/0x20 lib/debugobjects.c:391
       debug_hrtimer_init kernel/time/hrtimer.c:410 [inline]
       debug_init kernel/time/hrtimer.c:458 [inline]
       hrtimer_init+0x8c/0x410 kernel/time/hrtimer.c:1259
       alarm_init kernel/time/alarmtimer.c:339 [inline]
       alarm_timer_nsleep+0x164/0x4d0 kernel/time/alarmtimer.c:787
       SYSC_clock_nanosleep kernel/time/posix-timers.c:1226 [inline]
       SyS_clock_nanosleep+0x235/0x330 kernel/time/posix-timers.c:1204
       do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x42/0xb7
      
      This happens because the hrtimer for the alarm nanosleep is on stack, but
      the code does not use the proper debug objects initialization.
      
      Split out the code for the allocated use cases and invoke
      hrtimer_init_on_stack() for the nanosleep related functions.
      
      Reported-by: syzbot+a3e0726462b2e346a31d@syzkaller.appspotmail.com
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: syzkaller-bugs@googlegroups.com
      Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1803261528270.1585@nanos.tec.linutronix.de
      bd031430
  11. 22 3月, 2018 1 次提交
  12. 19 3月, 2018 1 次提交
    • A
      y2038: Introduce struct __kernel_old_timeval · a84d1169
      Arnd Bergmann 提交于
      Dealing with 'struct timeval' users in the y2038 series is a bit tricky:
      
      We have two definitions of timeval that are visible to user space,
      one comes from glibc (or some other C library), the other comes from
      linux/time.h. The kernel copy is what we want to be used for a number of
      structures defined by the kernel itself, e.g. elf_prstatus (used it core
      dumps), sysinfo and rusage (used in system calls).  These generally tend
      to be used for passing time intervals rather than absolute (epoch-based)
      times, so they do not suffer from the y2038 overflow. Some of them
      could be changed to use 64-bit timestamps by creating new system calls,
      others like the core files cannot easily be changed.
      
      An application using these interfaces likely also uses gettimeofday()
      or other interfaces that use absolute times, and pass 'struct timeval'
      pointers directly into kernel interfaces, so glibc must redefine their
      timeval based on a 64-bit time_t when they introduce their y2038-safe
      interfaces.
      
      The only reasonable way forward I see is to remove the 'timeval'
      definion from the kernel's uapi headers, and change the interfaces that
      we do not want to (or cannot) duplicate for 64-bit times to use a new
      __kernel_old_timeval definition instead. This type should be avoided
      for all new interfaces (those can use 64-bit nanoseconds, or the 64-bit
      version of timespec instead), and should be used with great care when
      converting existing interfaces from timeval, to be sure they don't suffer
      from the y2038 overflow, and only with consensus for the particular user
      that using __kernel_old_timeval is better than moving to a 64-bit based
      interface. The structure name is intentionally chosen to not conflict
      with user space types, and to be ugly enough to discourage its use.
      
      Note that ioctl based interfaces that pass a bare 'timeval' pointer
      cannot change to '__kernel_old_timeval' because the user space source
      code refers to 'timeval' instead, and we don't want to modify the user
      space sources if possible. However, any application that relies on a
      structure to contain an embedded 'timeval' (e.g. by passing a pointer
      to the member into a function call that expects a timeval pointer) is
      broken when that structure gets converted to __kernel_old_timeval. I
      don't see any way around that, and we have to rely on the compiler to
      produce a warning or compile failure that will alert users when they
      recompile their sources against a new libc.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Link: https://lkml.kernel.org/r/20180315161739.576085-1-arnd@arndb.de
      a84d1169
  13. 13 3月, 2018 5 次提交
    • T
      hrtimer: Unify MONOTONIC and BOOTTIME clock behavior · 127bfa5f
      Thomas Gleixner 提交于
      Now that th MONOTONIC and BOOTTIME clocks are indentical remove all the special
      casing.
      
      The user space visible interfaces still support both clocks, but their behavior
      is identical.
      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>
      Link: http://lkml.kernel.org/r/20180301165150.410218515@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      127bfa5f
    • T
      posix-timers: Unify MONOTONIC and BOOTTIME clock behavior · 7250a404
      Thomas Gleixner 提交于
      Now that the MONOTONIC and BOOTTIME clocks are indentical remove all the special
      casing.
      
      The user space visible interfaces still support both clocks, but their behavior
      is identical.
      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>
      Link: http://lkml.kernel.org/r/20180301165150.315745557@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      7250a404
    • T
      timekeeping: Remove boot time specific code · d6c7270e
      Thomas Gleixner 提交于
      Now that the MONOTONIC and BOOTTIME clocks are the same, remove all the
      special handling from timekeeping. Keep wrappers for the existing users of
      the *boot* timekeeper interfaces.
      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>
      Link: http://lkml.kernel.org/r/20180301165150.236279497@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      d6c7270e
    • T
      timekeeping: Make the MONOTONIC clock behave like the BOOTTIME clock · d6ed449a
      Thomas Gleixner 提交于
      The MONOTONIC clock is not fast forwarded by the time spent in suspend on
      resume. This is only done for the BOOTTIME clock. The reason why the
      MONOTONIC clock is not forwarded is historical: the original Linux
      implementation was using jiffies as a base for the MONOTONIC clock and
      jiffies have never been advanced after resume.
      
      At some point when timekeeping was unified in the core code, the
      MONONOTIC clock was advanced after resume which also advanced jiffies causing
      interesting side effects. As a consequence the the MONOTONIC clock forwarding
      was disabled again and the BOOTTIME clock was introduced, which allows to read
      time since boot.
      
      Back then it was not possible to completely distangle the MONOTONIC clock and
      jiffies because there were still interfaces which exposed the MONOTONIC clock
      behaviour based on the timer wheel and therefore jiffies.
      
      As of today none of the MONOTONIC clock facilities depends on jiffies
      anymore so the forwarding can be done seperately. This is achieved by
      forwarding the variables which are used for the jiffies update after resume
      before the tick is restarted,
      
      In timekeeping resume, the change is rather simple. Instead of updating the
      offset between the MONOTONIC clock and the REALTIME/BOOTTIME clocks, advance the
      time keeper base for the MONOTONIC and the MONOTONIC_RAW clocks by the time
      spent in suspend.
      
      The MONOTONIC clock is now the same as the BOOTTIME clock and the offset between
      the REALTIME and the MONOTONIC clocks is the same as before suspend.
      
      There might be side effects in applications, which rely on the
      (unfortunately) well documented behaviour of the MONOTONIC clock, but the
      downsides of the existing behaviour are probably worse.
      
      There is one obvious issue. Up to now it was possible to retrieve the time
      spent in suspend by observing the delta between the MONOTONIC clock and the
      BOOTTIME clock. This is not longer available, but the previously introduced
      mechanism to read the active non-suspended monotonic time can mitigate that
      in a detectable fashion.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      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>
      Link: http://lkml.kernel.org/r/20180301165150.062975504@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      d6ed449a
    • T
      timekeeping: Add the new CLOCK_MONOTONIC_ACTIVE clock · 72199320
      Thomas Gleixner 提交于
      The planned change to unify the behaviour of the MONOTONIC and BOOTTIME
      clocks vs. suspend removes the ability to retrieve the active
      non-suspended time of a system.
      
      Provide a new CLOCK_MONOTONIC_ACTIVE clock which returns the active
      non-suspended time of the system via clock_gettime().
      
      This preserves the old behaviour of CLOCK_MONOTONIC before the
      BOOTTIME/MONOTONIC unification.
      
      This new clock also allows applications to detect programmatically that
      the MONOTONIC and BOOTTIME clocks are identical.
      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>
      Link: http://lkml.kernel.org/r/20180301165149.965235774@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      72199320
  14. 10 3月, 2018 2 次提交
  15. 09 3月, 2018 1 次提交
    • P
      sched/nohz: Clean up nohz enter/exit · 00357f5e
      Peter Zijlstra 提交于
      The primary observation is that nohz enter/exit is always from the
      current CPU, therefore NOHZ_TICK_STOPPED does not in fact need to be
      an atomic.
      
      Secondary is that we appear to have 2 nearly identical hooks in the
      nohz enter code, set_cpu_sd_state_idle() and
      nohz_balance_enter_idle(). Fold the whole set_cpu_sd_state thing into
      nohz_balance_{enter,exit}_idle.
      
      Removes an atomic op from both enter and exit paths.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      00357f5e
  16. 01 3月, 2018 1 次提交
    • L
      timers: Forward timer base before migrating timers · c52232a4
      Lingutla Chandrasekhar 提交于
      On CPU hotunplug the enqueued timers of the unplugged CPU are migrated to a
      live CPU. This happens from the control thread which initiated the unplug.
      
      If the CPU on which the control thread runs came out from a longer idle
      period then the base clock of that CPU might be stale because the control
      thread runs prior to any event which forwards the clock.
      
      In such a case the timers from the unplugged CPU are queued on the live CPU
      based on the stale clock which can cause large delays due to increased
      granularity of the outer timer wheels which are far away from base:;clock.
      
      But there is a worse problem than that. The following sequence of events
      illustrates it:
      
       - CPU0 timer1 is queued expires = 59969 and base->clk = 59131.
      
         The timer is queued at wheel level 2, with resulting expiry time = 60032
         (due to level granularity).
      
       - CPU1 enters idle @60007, with next timer expiry @60020.
      
       - CPU0 is hotplugged at @60009
      
       - CPU1 exits idle and runs the control thread which migrates the
         timers from CPU0
      
         timer1 is now queued in level 0 for immediate handling in the next
         softirq because the requested expiry time 59969 is before CPU1 base->clk
         60007
      
       - CPU1 runs code which forwards the base clock which succeeds because the
         next expiring timer. which was collected at idle entry time is still set
         to 60020.
      
         So it forwards beyond 60007 and therefore misses to expire the migrated
         timer1. That timer gets expired when the wheel wraps around again, which
         takes between 63 and 630ms depending on the HZ setting.
      
      Address both problems by invoking forward_timer_base() for the control CPUs
      timer base. All other places, which might run into a similar problem
      (mod_timer()/add_timer_on()) already invoke forward_timer_base() to avoid
      that.
      
      [ tglx: Massaged comment and changelog ]
      
      Fixes: a683f390 ("timers: Forward the wheel clock whenever possible")
      Co-developed-by: NNeeraj Upadhyay <neeraju@codeaurora.org>
      Signed-off-by: NNeeraj Upadhyay <neeraju@codeaurora.org>
      Signed-off-by: NLingutla Chandrasekhar <clingutla@codeaurora.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20180118115022.6368-1-clingutla@codeaurora.org
      c52232a4
  17. 28 2月, 2018 1 次提交