1. 02 11月, 2017 14 次提交
  2. 01 11月, 2017 2 次提交
    • T
      Merge branch 'clockevents/4.15' of... · eccbf5fb
      Thomas Gleixner 提交于
      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
    • T
      Merge branch 'fortglx/4.15/time' of... · fb56d689
      Thomas Gleixner 提交于
      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. 31 10月, 2017 7 次提交
    • A
      time: Move old timekeeping interfaces to timekeeping32.h · 6546911e
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      6546911e
    • A
      time: Move time_t conversion helpers to time32.h · abc8f96e
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      abc8f96e
    • A
      time: Move time_t based interfaces to time32.h · 5dbf2012
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      [jstultz: Whitespace & checkpatch fixups]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      5dbf2012
    • A
      time: Remove unused functions · 85bf19e7
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      85bf19e7
    • A
      timekeeping: Use timespec64 in timekeeping_inject_offset · 1572fa03
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      1572fa03
    • A
      timekeeping: Consolidate timekeeping_inject_offset code · e0956dcc
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      [jstultz: Whitespace fixup]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      e0956dcc
    • J
      rtc: Allow rtc drivers to specify the tv_nsec value for ntp · 0f295b06
      Jason Gunthorpe 提交于
      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: NJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      0f295b06
  4. 30 10月, 2017 1 次提交
  5. 29 10月, 2017 1 次提交
  6. 27 10月, 2017 10 次提交
  7. 20 10月, 2017 5 次提交
    • K
      timer: Provide wrappers safe for use with LOCKDEP · 52f737c2
      Kees Cook 提交于
      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: NCraig Gallek <cgallek@google.com>
      Suggested-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NThomas 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
    • M
      clocksource/drivers/mips-gic-timer: Add fastpath for local timer updates · f16ff2bd
      Matt Redfearn 提交于
      Always accessing the compare register via the CM redirect region is
      (relatively) slow. If the timer being updated is the current CPUs
      then this can be shortcutted by writing to the CM VP local region.
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      f16ff2bd
    • M
      clocksource/drivers/mips-gic-timer: Remove pointless irq_save,restore · 7957b07b
      Matt Redfearn 提交于
      The function gic_next_event is always called with interrupts disabled, so
      the local_irq_save / local_irq_restore are pointless - remove them.
      
      [Daniel Lezcano: Fixed warning by removing unused variable 'flags']
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Suggested-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Reported-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      7957b07b
    • M
      clocksource/drivers/arm_arch_timer: Fix DEFINE_PER_CPU expansion · a7fb4577
      Mark Rutland 提交于
      Our ctags mangling script can't handle newlines inside of a
      DEFINE_PER_CPU(), leading to an annoying message whenever tags are
      built:
      
        ctags: Warning: drivers/clocksource/arm_arch_timer.c:302: null expansion of name pattern "\1"
      
      This was dealt with elsewhere in commit:
      
        25528213 ("tags: Fix DEFINE_PER_CPU expansions")
      
      ... by ensuring each DEFINE_PER_CPU() was contained on a single line,
      even where this would violate the usual code style (checkpatch warnings
      and all).
      
      Let's do the same for the arch timer driver, and get rid of the
      distraction.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      a7fb4577
    • A
      clocksource/drivers/arm_arch_timer: Validate CNTFRQ after enabling frame · 21492e13
      Ard Biesheuvel 提交于
      The ACPI GTDT code validates the CNTFRQ field of each MMIO timer
      frame against the CNTFRQ system register of the current CPU, to
      ensure that they are equal, which is mandated by the architecture.
      
      However, reading the CNTFRQ field of a frame is not possible until
      the RFRQ bit in the frame's CNTACRn register is set, and doing so
      before that willl produce the following error:
      
        arch_timer: [Firmware Bug]: CNTFRQ mismatch: frame @ 0x00000000e0be0000: (0x00000000), CPU: (0x0ee6b280)
        arch_timer: Disabling MMIO timers due to CNTFRQ mismatch
        arch_timer: Failed to initialize memory-mapped timer.
      
      The reason is that the CNTFRQ field is RES0 if access is not enabled.
      
      So move the validation of CNTFRQ into the loop that iterates over the
      timers to find the best frame, but defer it until after we have selected
      the best frame, which should also have enabled the RFRQ bit.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      21492e13