1. 19 Mar, 2020 2 commits
    • Ahmed S. Darwish's avatar
      time/sched_clock: Expire timer in hardirq context · 2c8bd588
      Ahmed S. Darwish authored
      To minimize latency, PREEMPT_RT kernels expires hrtimers in preemptible
      softirq context by default. This can be overriden by marking the timer's
      expiry with HRTIMER_MODE_HARD.
      
      sched_clock_timer is missing this annotation: if its callback is preempted
      and the duration of the preemption exceeds the wrap around time of the
      underlying clocksource, sched clock will get out of sync.
      
      Mark the sched_clock_timer for expiry in hard interrupt context.
      Signed-off-by: default avatarAhmed S. Darwish <a.darwish@linutronix.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20200309181529.26558-1-a.darwish@linutronix.de
      2c8bd588
    • Thomas Gleixner's avatar
      Merge tag 'timers-v5.7' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core · 048495eb
      Thomas Gleixner authored
      Pull clockevent/clocksource updates from Daniel Lezcano:
      
      - Avoid creating dead devices by flagging the driver with OF_POPULATED
        in order to prevent the platform to create another device (Saravana Kannan)
      
      - Remove unused includes from imx family drivers (Anson Huang)
      
      - timer-dm-ti rework to prepare for pwm and suspend support (Lokesh Vutla)
      
      - Fix the rate for the global clock on the pit64b (Claudiu Beznea)
      
      - Fix timer-cs5535 by requesting an irq with non-NULL dev_id (Afzal Mohammed)
      
      - Replace setup_irq() by request_irq() (Afzal Mohammed)
      
      - Add support for the TCU of X1000 (Zhou Yanjie)
      
      - Drop the bogus omap_dm_timer_of_set_source() function (Suman Anna)
      
      - Do not update the counter when updating the period in order to
        prevent a disruption when the pwm is used (Lokesh Vutla)
      
      - Improve owl_timer_init() failure messages (Matheus Castello)
      
      - Add driver for the Ingenic JZ47xx OST (Maarten ter Huurne)
      
      - Pass the interrupt and the shutdown callbacks in the init function
        for ast2600 support (Joel Stanley)
      
      - Add the ast2600 compatible string for the fttmr010 (Joel Stanley)
      048495eb
  2. 17 Mar, 2020 3 commits
  3. 16 Mar, 2020 8 commits
  4. 12 Mar, 2020 1 commit
  5. 04 Mar, 2020 5 commits
    • Waiman Long's avatar
      tick/common: Make tick_periodic() check for missing ticks · d441dceb
      Waiman Long authored
      The tick_periodic() function is used at the beginning part of the
      bootup process for time keeping while the other clock sources are
      being initialized.
      
      The current code assumes that all the timer interrupts are handled in
      a timely manner with no missing ticks. That is not actually true. Some
      ticks are missed and there are some discrepancies between the tick time
      (jiffies) and the timestamp reported in the kernel log.  Some systems,
      however, are more prone to missing ticks than the others.  In the extreme
      case, the discrepancy can actually cause a soft lockup message to be
      printed by the watchdog kthread. For example, on a Cavium ThunderX2
      Sabre arm64 system:
      
       [   25.496379] watchdog: BUG: soft lockup - CPU#14 stuck for 22s!
      
      On that system, the missing ticks are especially prevalent during the
      smp_init() phase of the boot process. With an instrumented kernel,
      it was found that it took about 24s as reported by the timestamp for
      the tick to accumulate 4s of time.
      
      Investigation and bisection done by others seemed to point to the
      commit 73f38166 ("arm64: Advertise mitigation of Spectre-v2, or
      lack thereof") as the culprit. It could also be a firmware issue as
      new firmware was promised that would fix the issue.
      
      To properly address this problem, stop assuming that there will be no
      missing tick in tick_periodic(). Modify it to follow the example of
      tick_do_update_jiffies64() by using another reference clock to check for
      missing ticks. Since the watchdog timer uses running_clock(), it is used
      here as the reference. With this applied, the soft lockup problem in the
      affected arm64 system is gone and tick time tracks much more closely to the
      timestamp time.
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20200207193929.27308-1-longman@redhat.com
      d441dceb
    • Wen Yang's avatar
      hrtimer: Cast explicitely to u32t in __ktime_divns() · 38f7b0b1
      Wen Yang authored
      do_div() does a 64-by-32 division at least on 32bit platforms, while the
      divisor 'div' is explicitly casted to unsigned long, thus 64-bit on 64-bit
      platforms.
      
      The code already ensures that the divisor is less than 2^32. Hence the
      proper cast type is u32.
      Signed-off-by: default avatarWen Yang <wenyang@linux.alibaba.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20200130130851.29204-1-wenyang@linux.alibaba.com
      38f7b0b1
    • Wen Yang's avatar
      timekeeping: Prevent 32bit truncation in scale64_check_overflow() · 4cbbc3a0
      Wen Yang authored
      While unlikely the divisor in scale64_check_overflow() could be >= 32bit in
      scale64_check_overflow(). do_div() truncates the divisor to 32bit at least
      on 32bit platforms.
      
      Use div64_u64() instead to avoid the truncation to 32-bit.
      
      [ tglx: Massaged changelog ]
      Signed-off-by: default avatarWen Yang <wenyang@linux.alibaba.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20200120100523.45656-1-wenyang@linux.alibaba.com
      4cbbc3a0
    • Eric W. Biederman's avatar
      posix-cpu-timers: Stop disabling timers on mt-exec · b95e31c0
      Eric W. Biederman authored
      The reasons why the extra posix_cpu_timers_exit_group() invocation has been
      added are not entirely clear from the commit message.  Today all that
      posix_cpu_timers_exit_group() does is stop timers that are tracking the
      task from firing.  Every other operation on those timers is still allowed.
      
      The practical implication of this is posix_cpu_timer_del() which could
      not get the siglock after the thread group leader has exited (because
      sighand == NULL) would be able to run successfully because the timer
      was already dequeued.
      
      With that locking issue fixed there is no point in disabling all of the
      timers.  So remove this ``tempoary'' hack.
      
      Fixes: e0a70217 ("posix-cpu-timers: workaround to suppress the problems with mt exec")
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/87o8tityzs.fsf@x220.int.ebiederm.org
      
      b95e31c0
    • Eric W. Biederman's avatar
      posix-cpu-timers: Store a reference to a pid not a task · 55e8c8eb
      Eric W. Biederman authored
      posix cpu timers do not handle the death of a process well.
      
      This is most clearly seen when a multi-threaded process calls exec from a
      thread that is not the leader of the thread group.  The posix cpu timer code
      continues to pin the old thread group leader and is unable to find the
      siglock from there.
      
      This results in posix_cpu_timer_del being unable to delete a timer,
      posix_cpu_timer_set being unable to set a timer.  Further to compensate for
      the problems in posix_cpu_timer_del on a multi-threaded exec all timers
      that point at the multi-threaded task are stopped.
      
      The code for the timers fundamentally needs to check if the target
      process/thread is alive.  This needs an extra level of indirection. This
      level of indirection is already available in struct pid.
      
      So replace cpu.task with cpu.pid to get the needed extra layer of
      indirection.
      
      In addition to handling things more cleanly this reduces the amount of
      memory a timer can pin when a process exits and then is reaped from
      a task_struct to the vastly smaller struct pid.
      
      Fixes: e0a70217 ("posix-cpu-timers: workaround to suppress the problems with mt exec")
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/87wo86tz6d.fsf@x220.int.ebiederm.org
      55e8c8eb
  6. 01 Mar, 2020 3 commits
  7. 27 Feb, 2020 7 commits
  8. 25 Feb, 2020 1 commit
  9. 21 Feb, 2020 3 commits
  10. 17 Feb, 2020 7 commits