1. 01 Nov, 2017 12 commits
  2. 31 Oct, 2017 2 commits
    • Thomas Gleixner's avatar
      Merge branch 'clockevents/4.15' of... · eccbf5fb
      Thomas Gleixner authored
      Merge branch 'clockevents/4.15' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core
      
      Pull clockevent updates from Daniel Lezcano:
      
       - Improve the generic clockevents dependency by factoring out the option
         in the Kconfig menu option (Arnd Bergmann)
      
       - Add missing "\n" in pr_err messages for fttmr010, owl and rockchip
         (Arvind Yadav)
      
       - Add missing timer_of_exit function to rollback timer_of_init (Benjamin
         Gaignard)
      
       - Fix path and add bindings to timers (Daniel Lezcano)
      
       - Cleanup and remove support for renesas,cmt-32* (Geert Uytterhoeven)
      
       - Add support for separate R-Car Gen2 (Magnus Damm)
      
       - Fix DEFINE_PER_CPU length definition to prevent warning at expansion
         time for the arm_arch_timer (Mark Rutland)
      
       - Remove pointless irq_save,restore in an already irq-disabled callback
         and add a shortcut optimization for the local cpu on mips-gic-timer
         (Matt Redfearn)
      eccbf5fb
    • Thomas Gleixner's avatar
      Merge branch 'fortglx/4.15/time' of... · fb56d689
      Thomas Gleixner authored
      Merge branch 'fortglx/4.15/time' of https://git.linaro.org/people/john.stultz/linux into timers/core
      
      Pull timekeeping updates from John Stultz:
      
       - More y2038 work from Arnd Bergmann
      
       - A new mechanism to allow RTC drivers to specify the resolution of the
         RTC so the suspend/resume code can make informed decisions whether to
         inject the suspended time or not in case of fast suspend/resume cycles.
      fb56d689
  3. 30 Oct, 2017 7 commits
    • Arnd Bergmann's avatar
      time: Move old timekeeping interfaces to timekeeping32.h · 6546911e
      Arnd Bergmann authored
      The interfaces based on 'struct timespec' and 'unsigned long' seconds
      are no longer recommended for new code, and we are trying to migrate to
      ktime_t based interfaces and other y2038-safe variants.
      
      This moves all the legacy interfaces from linux/timekeeping.h into a
      new timekeeping32.h to better document this.
      
      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 <stephen.boyd@linaro.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      6546911e
    • Arnd Bergmann's avatar
      time: Move time_t conversion helpers to time32.h · abc8f96e
      Arnd Bergmann authored
      On 64-bit architectures, the timespec64 based helpers in linux/time.h
      are defined as macros pointing to their timespec based counterparts.
      This made sense when they were first introduced, but as we are migrating
      away from timespec in general, it's much less intuitive now.
      
      This changes the macros to work in the exact opposite way: we always
      provide the timespec64 based helpers and define the old interfaces as
      macros for them. Now we can move those macros into linux/time32.h, which
      already contains the respective helpers for 32-bit architectures.
      
      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 <stephen.boyd@linaro.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      abc8f96e
    • Arnd Bergmann's avatar
      time: Move time_t based interfaces to time32.h · 5dbf2012
      Arnd Bergmann authored
      Interfaces based on 'struct timespec' or 'struct timeval' should no
      longer be used for new code, which can use either ktime_t or 'struct
      timespec64' instead.
      
      To make this a little clearer, this moves the various helpers into a new
      time32.h header. For the moment, this gets included by the normal time.h,
      but we may be able to separate it entirely when most users of time32.h
      are gone.
      
      Individual helpers in the new file can get removed once they become unused
      in the future.
      
      Since the contents of time32.h look a lot like what's in time64.h, I'm
      reordering them during the move to make them more similar, and to allow
      a follow-up patch to redirect the 'timespec' based functions to thei
      'timespec64' based counterparts on 64-bit architectures later.
      
      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 <stephen.boyd@linaro.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      [jstultz: Whitespace & checkpatch fixups]
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      5dbf2012
    • Arnd Bergmann's avatar
      time: Remove unused functions · 85bf19e7
      Arnd Bergmann authored
      The (slow but) ongoing work on conversion from timespec to timespec64
      has led some timespec based helper functions to become unused.
      
      No new code should use them, so we can remove the functions entirely.
      I'm planning to obsolete additional interfaces next and remove
      more of these.
      
      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 <stephen.boyd@linaro.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      85bf19e7
    • Arnd Bergmann's avatar
      timekeeping: Use timespec64 in timekeeping_inject_offset · 1572fa03
      Arnd Bergmann authored
      As part of changing all the timekeeping code to use 64-bit
      time_t consistently, this removes the uses of timeval
      and timespec as much as possible from do_adjtimex() and
      timekeeping_inject_offset(). The timeval_inject_offset_valid()
      and timespec_inject_offset_valid() just complicate this,
      so I'm folding them into the respective callers.
      
      This leaves the actual 'struct timex' definition, which
      is part of the user-space ABI and should be dealt with
      separately when we have agreed on the ABI change.
      
      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 <stephen.boyd@linaro.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      1572fa03
    • Arnd Bergmann's avatar
      timekeeping: Consolidate timekeeping_inject_offset code · e0956dcc
      Arnd Bergmann authored
      The code to check the adjtimex() or clock_adjtime() arguments is spread
      out across multiple files for presumably only historic reasons. As a
      preparatation for a rework to get rid of the use of 'struct timeval'
      and 'struct timespec' in there, this moves all the portions into
      kernel/time/timekeeping.c and marks them as 'static'.
      
      The warp_clock() function here is not as closely related as the others,
      but I feel it still makes sense to move it here in order to consolidate
      all callers of timekeeping_inject_offset().
      
      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 <stephen.boyd@linaro.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      [jstultz: Whitespace fixup]
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      e0956dcc
    • Jason Gunthorpe's avatar
      rtc: Allow rtc drivers to specify the tv_nsec value for ntp · 0f295b06
      Jason Gunthorpe authored
      ntp is currently hardwired to try and call the rtc set when wall clock
      tv_nsec is 0.5 seconds. This historical behaviour works well with certain
      PC RTCs, but is not universal to all rtc hardware.
      
      Change how this works by introducing the driver specific concept of
      set_offset_nsec, the delay between current wall clock time and the target
      time to set (with a 0 tv_nsecs).
      
      For x86-style CMOS set_offset_nsec should be -0.5 s which causes the last
      second to be written 0.5 s after it has started.
      
      For compat with the old rtc_set_ntp_time, the value is defaulted to
      + 0.5 s, which causes the next second to be written 0.5s before it starts,
      as things were before this patch.
      
      Testing shows many non-x86 RTCs would like set_offset_nsec ~= 0,
      so ultimately each RTC driver should set the set_offset_nsec according
      to its needs, and non x86 architectures should stop using
      update_persistent_clock64 in order to access this feature.
      Future patches will revise the drivers as needed.
      
      Since CMOS and RTC now have very different handling they are split
      into two dedicated code paths, sharing the support code, and ifdefs
      are replaced with IS_ENABLED.
      
      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 <stephen.boyd@linaro.org>
      Signed-off-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      0f295b06
  4. 29 Oct, 2017 2 commits
  5. 27 Oct, 2017 10 commits
  6. 20 Oct, 2017 1 commit
    • Kees Cook's avatar
      timer: Provide wrappers safe for use with LOCKDEP · 52f737c2
      Kees Cook authored
      Under LOCKDEP, the timer lock_class_key (set up in __setup_timer) needs
      to be tied to the caller's context, so an inline for timer_setup()
      won't work. We do, however, want to keep the inline version around for
      argument type checking, though, so this provides macro wrappers in the
      LOCKDEP case.
      
      This fixes the case of different timers sharing the same LOCKDEP instance,
      and producing a false positive warning:
      
      [  580.840858] ======================================================
      [  580.842299] WARNING: possible circular locking dependency detected
      [  580.843684] 4.14.0-rc4+ #17 Not tainted
      [  580.844554] ------------------------------------------------------
      [  580.845945] swapper/9/0 is trying to acquire lock:
      [  580.847024]  (slock-AF_INET){+.-.}, at: [<ffffffff84ea4c34>] tcp_write_timer+0x24/0xd0
      [  580.848834]
                     but task is already holding lock:
      [  580.850107]  ((timer)#2){+.-.}, at: [<ffffffff846df7c0>] call_timer_fn+0x0/0x300
      [  580.851663]
                     which lock already depends on the new lock.
      
      [  580.853439]
                     the existing dependency chain (in reverse order) is:
      [  580.855311]
                     -> #1 ((timer)#2){+.-.}:
      [  580.856538]        __lock_acquire+0x114d/0x11a0
      [  580.857506]        lock_acquire+0xb0/0x1d0
      [  580.858373]        del_timer_sync+0x3c/0xb0
      [  580.859260]        inet_csk_reqsk_queue_drop+0x7f/0x1b0
      ...
                     -> #0 (slock-AF_INET){+.-.}:
      [  580.884980]        check_prev_add+0x666/0x700
      [  580.885790]        __lock_acquire+0x114d/0x11a0
      [  580.886575]        lock_acquire+0xb0/0x1d0
      [  580.887289]        _raw_spin_lock+0x2c/0x40
      [  580.888021]        tcp_write_timer+0x24/0xd0
      ...
      [  580.900055]  Possible unsafe locking scenario:
      
      [  580.901043]        CPU0                    CPU1
      [  580.901797]        ----                    ----
      [  580.902540]   lock((timer)#2);
      [  580.903046]                                lock(slock-AF_INET);
      [  580.904006]                                lock((timer)#2);
      [  580.904915]   lock(slock-AF_INET);
      [  580.905502]
      
      In this report, del_timer_sync() is from:
      
      	inet_csk_reqsk_queue_drop()
      		reqsk_queue_unlink()
      			del_timer_sync(&req->rsk_timer)
      
      but tcp_write_timer()'s timer is attached to icsk_retransmit_timer. Both
      had the same lock_class_key, since they were using timer_setup(). Switching
      to a macro allows for a separate context, avoiding the false positive.
      
      Fixes: 686fef92 ("timer: Prepare to change timer callback argument type")
      Reported-by: default avatarCraig Gallek <cgallek@google.com>
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: netdev@vger.kernel.org
      Cc: "David S. Miller" <davem@davemloft.net>
      Link: https://lkml.kernel.org/r/20171019202838.GA43223@beast
      52f737c2
  7. 19 Oct, 2017 6 commits