1. 07 Apr, 2017 30 commits
  2. 31 Mar, 2017 2 commits
  3. 23 Mar, 2017 8 commits
    • Tom Hromatka's avatar
      sysrq: Reset the watchdog timers while displaying high-resolution timers · 01070427
      Tom Hromatka authored
      On systems with a large number of CPUs, running sysrq-<q> can cause
      watchdog timeouts.  There are two slow sections of code in the sysrq-<q>
      path in timer_list.c.
      
      1. print_active_timers() - This function is called by print_cpu() and
         contains a slow goto loop.  On a machine with hundreds of CPUs, this
         loop took approximately 100ms for the first CPU in a NUMA node.
         (Subsequent CPUs in the same node ran much quicker.)  The total time
         to print all of the CPUs is ultimately long enough to trigger the
         soft lockup watchdog.
      
      2. print_tickdevice() - This function outputs a large amount of textual
         information.  This function also took approximately 100ms per CPU.
      
      Since sysrq-<q> is not a performance critical path, there should be no
      harm in touching the nmi watchdog in both slow sections above.  Touching
      it in just one location was insufficient on systems with hundreds of
      CPUs as occasional timeouts were still observed during testing.
      
      This issue was observed on an Oracle T7 machine with 128 CPUs, but I
      anticipate it may affect other systems with similarly large numbers of
      CPUs.
      Signed-off-by: default avatarTom Hromatka <tom.hromatka@oracle.com>
      Reviewed-by: default avatarRob Gardner <rob.gardner@oracle.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      01070427
    • David Engraf's avatar
      timers, sched_clock: Update timeout for clock wrap · 1b8955bc
      David Engraf authored
      The scheduler clock framework may not use the correct timeout for the clock
      wrap. This happens when a new clock driver calls sched_clock_register()
      after the kernel called sched_clock_postinit(). In this case the clock wrap
      timeout is too long thus sched_clock_poll() is called too late and the clock
      already wrapped.
      
      On my ARM system the scheduler was no longer scheduling any other task than
      the idle task because the sched_clock() wrapped.
      Signed-off-by: default avatarDavid Engraf <david.engraf@sysgo.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      1b8955bc
    • John Stultz's avatar
      MAINTAINERS: Add Stephen Boyd as timekeeping reviewer · e1c09219
      John Stultz authored
      After showing expertise and presenting on the timekeeping
      subsystem at ELC[1], Stephen clearly should be included in
      the maintainer list.
      
      [1] https://www.youtube.com/watch?v=Puv4mW55bF8Acked-by: default avatarStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      e1c09219
    • Nicolai Stange's avatar
      clockevents: Make clockevents_config() static · 0695bd99
      Nicolai Stange authored
      A clockevent device's rate should be configured before or at registration
      and changed afterwards through clockevents_update_freq() only.
      
      For the configuration at registration, we already have
      clockevents_config_and_register().
      
      Right now, there are no clockevents_config() users outside of the
      clockevents core.
      
      To mitigiate the risk of drivers errorneously reconfiguring their rates
      through clockevents_config() *after* device registration, make
      clockevents_config() static.
      Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      0695bd99
    • Nicolai Stange's avatar
      clocksource: h8300_timer8: Don't reset rate in ->set_state_oneshot() · a17e0178
      Nicolai Stange authored
      With the upcoming NTP correction related rate adjustments to be implemented
      in the clockevents core, the latter needs to get informed about every rate
      change of a clockevent device made after its registration.
      
      Currently, h8300_timer8 violates this requirement in that it registers its
      clockevent device with the correct rate, but resets its ->mult and ->rate
      values in timer8_clock_event_start(), called from its ->set_state_oneshot()
      function.
      
      It seems like
        commit 4633f4ca ("clocksource/drivers/h8300: Cleanup startup and
                              remove module code."),
      which introduced the rate initialization at registration, missed to remove
      the manual setting of ->mult and ->shift from timer8_clock_event_start().
      
      Purge the setting of ->mult, ->shift, ->min_delta_ns and ->max_delta_ns
      from timer8_clock_event_start().
      Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      a17e0178
    • Nicolai Stange's avatar
      clocksource: em_sti: Compute rate before registration · 4e53aa2f
      Nicolai Stange authored
      With the upcoming NTP correction related rate adjustments to be implemented
      in the clockevents core, the latter needs to get informed about every rate
      change of a clockevent device made after its registration.
      
      Currently, em_sti violates this requirement in that it registers its
      clockevent device with a dummy rate and sets its final rate through
      clockevents_config() called from its ->set_state_oneshot().
      
      This patch moves the setting of the clockevent device's rate to its
      registration.
      
      I checked all current em_sti users in arch/arm/mach-shmobile and right now,
      none of them changes any rate in any clock tree relevant to em_sti after
      their respective time_init(). Since all em_sti instances are created after
      time_init(), none of them should ever observe any clock rate changes.
      
      - Determine the ->rate value in em_sti_probe() at device probing rather
        than at first usage.
      - Set the clockevent device's rate at its registration.
      - Although not strictly necessary for the upcoming clockevent core changes,
        set the clocksource's rate at its registration for consistency.
      Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      4e53aa2f
    • Nicolai Stange's avatar
      clocksource: em_sti: Split clock prepare and enable steps · 3814ae09
      Nicolai Stange authored
      Currently, the em_sti driver prepares and enables the needed clock in
      em_sti_enable(), potentially called through its clockevent device's
      ->set_state_oneshot().
      
      However, the clk_prepare() step may sleep whereas tick_program_event() and
      thus, ->set_state_oneshot(), can be called in atomic context.
      
      Split the clk_prepare_enable() in em_sti_enable() into two steps:
      - prepare the clock at device probing via clk_prepare()
      - and enable it in em_sti_enable() via clk_enable().
      Slightly reorder resource initialization in em_sti_probe() in order to
      facilitate error handling in later patches.
      Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      3814ae09
    • Nicolai Stange's avatar
      clocksource: sh_tmu: Compute rate before registration again · c3c0a20d
      Nicolai Stange authored
      With the upcoming NTP correction related rate adjustments to be implemented
      in the clockevents core, the latter needs to get informed about every rate
      change of a clockevent device made after its registration.
      
      Currently, sh_tmu violates this requirement in that it registers its
      clockevent device with a dummy rate and sets its final rate through
      clockevents_config() called from its ->set_state_oneshot() and
      ->set_state_periodic() functions respectively.
      
      This patch moves the setting of the clockevent device's rate to its
      registration.
      
      Note that there has been some back and forth regarding this question with
      respect to the clocksource also provided by this driver:
        commit 66f49121 ("clocksource: sh_tmu: compute mult and shift before
                              registration")
      moves the rate determination from the clocksource's ->enable() function to
      before its registration. OTOH, the later
        commit 0aeac458 ("clocksource: sh_tmu: __clocksource_updatefreq_hz()
                              update")
      basically reverts this, saying
        "Without this patch the old code uses clocksource_register() together
         with a hack that assumes a never changing clock rate."
      
      However, I checked all current sh_tmu users in arch/sh as well as in
      arch/arm/mach-shmobile carefully and right now, none of them changes any
      rate in any clock tree relevant to sh_tmu after their respective
      time_init(). Since all sh_tmu instances are created after time_init(), none
      of them should ever observe any clock rate changes.
      
      What's more, both, a clocksource as well as a clockevent device, can
      immediately get selected for use at their registration and thus, enabled
      at this point already. So it's probably safer to assume a "never changing
      clock rate" here.
      
      - Move the struct sh_tmu_channel's ->rate member to struct sh_tmu_device:
        it's a property of the underlying clock which is in turn specific to
        the sh_tmu_device.
      - Determine the ->rate value in sh_tmu_setup() at device probing rather
        than at first usage.
      - Set the clockevent device's rate at its registration.
      - Although not strictly necessary for the upcoming clockevent core changes,
        set the clocksource's rate at its registration for consistency.
      Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      c3c0a20d