1. 03 6月, 2018 4 次提交
    • N
      powerpc: allow soft-NMI watchdog to cover timer interrupts with large decrementers · a7cba02d
      Nicholas Piggin 提交于
      Large decrementers (e.g., POWER9) can take a very long time to wrap,
      so when the timer iterrupt handler sets the decrementer to max so as
      to avoid taking another decrementer interrupt when hard enabling
      interrupts before running timers, it effectively disables the soft
      NMI coverage for timer interrupts.
      
      Fix this by using the traditional 31-bit value instead, which wraps
      after a few seconds. masked interrupt code does the same thing, and
      in normal operation neither of these paths would ever wrap even the
      31 bit value.
      
      Note: the SMP watchdog should catch timer interrupt lockups, but it
      is preferable for the local soft-NMI to catch them, mainly to avoid
      the IPI.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      a7cba02d
    • N
      powerpc: generic clockevents broadcast receiver call tick_receive_broadcast · 3f984620
      Nicholas Piggin 提交于
      The broadcast tick recipient can call tick_receive_broadcast rather
      than re-running the full timer interrupt.
      
      It does not have to check for the next event time, because the sender
      already determined the timer has expired. It does not have to test
      irq_work_pending, because that's a direct decrementer interrupt and
      does not go through the clock events subsystem. And it does not have
      to read PURR because that was removed with the previous patch.
      
      This results in no code size change, but both the decrementer and
      broadcast path lengths are reduced.
      
      Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      3f984620
    • N
      powerpc/pseries: lparcfg calculate PURR on demand · 3d3a6021
      Nicholas Piggin 提交于
      For SPLPAR, lparcfg provides a sum of PURR registers for all CPUs.
      Currently this is done by reading PURR in context switch and timer
      interrupt, and storing that into a per-CPU variable. These are summed
      to provide the value.
      
      This does not work with all timer schemes (e.g., NO_HZ_FULL), and it
      is sub-optimal for performance because it reads the PURR register on
      every context switch, although that's been difficult to distinguish
      from noise in the contxt_switch microbenchmark.
      
      This patch implements the sum by calling a function on each CPU, to
      read and add PURR values of each CPU.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      3d3a6021
    • N
      powerpc/64: irq_work avoid interrupt when called with hardware irqs enabled · ebb37cf3
      Nicholas Piggin 提交于
      irq_work_raise should not cause a decrementer exception unless it is
      called from NMI context. Doing so often just results in an immediate
      masked decrementer interrupt:
      
         <...>-550    90d...    4us : update_curr_rt <-dequeue_task_rt
         <...>-550    90d...    5us : dbs_update_util_handler <-update_curr_rt
         <...>-550    90d...    6us : arch_irq_work_raise <-irq_work_queue
         <...>-550    90d...    7us : soft_nmi_interrupt <-soft_nmi_common
         <...>-550    90d...    7us : printk_nmi_enter <-soft_nmi_interrupt
         <...>-550    90d.Z.    8us : rcu_nmi_enter <-soft_nmi_interrupt
         <...>-550    90d.Z.    9us : rcu_nmi_exit <-soft_nmi_interrupt
         <...>-550    90d...    9us : printk_nmi_exit <-soft_nmi_interrupt
         <...>-550    90d...   10us : cpuacct_charge <-update_curr_rt
      
      The soft_nmi_interrupt here is the call into the watchdog, due to the
      decrementer interrupt firing with irqs soft-disabled. This is
      harmless, but sub-optimal.
      
      When it's not called from NMI context or with interrupts enabled, mark
      the decrementer pending in the irq_happened mask directly, rather than
      having the masked decrementer interupt handler do it. This will be
      replayed at the next local_irq_enable. See the comment for details.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ebb37cf3
  2. 03 4月, 2018 1 次提交
  3. 14 3月, 2018 1 次提交
  4. 19 1月, 2018 4 次提交
  5. 02 7月, 2017 1 次提交
  6. 22 6月, 2017 1 次提交
    • P
      powerpc: Convert VDSO update function to use new update_vsyscall interface · d4cfb113
      Paul Mackerras 提交于
      This converts the powerpc VDSO time update function to use the new
      interface introduced in commit 576094b7 ("time: Introduce new
      GENERIC_TIME_VSYSCALL", 2012-09-11).  Where the old interface gave
      us the time as of the last update in seconds and whole nanoseconds,
      with the new interface we get the nanoseconds part effectively in
      a binary fixed-point format with tk->tkr_mono.shift bits to the
      right of the binary point.
      
      With the old interface, the fractional nanoseconds got truncated,
      meaning that the value returned by the VDSO clock_gettime function
      would have about 1ns of jitter in it compared to the value computed
      by the generic timekeeping code in the kernel.
      
      The powerpc VDSO time functions (clock_gettime and gettimeofday)
      already work in units of 2^-32 seconds, or 0.23283 ns, because that
      makes it simple to split the result into seconds and fractional
      seconds, and represent the fractional seconds in either microseconds
      or nanoseconds.  This is good enough accuracy for now, so this patch
      avoids changing how the VDSO works or the interface in the VDSO data
      page.
      
      This patch converts the powerpc update_vsyscall_old to be called
      update_vsyscall and use the new interface.  We convert the fractional
      second to units of 2^-32 seconds without truncating to whole nanoseconds.
      (There is still a conversion to whole nanoseconds for any legacy users
      of the vdso_data/systemcfg stamp_xtime field.)
      
      In addition, this improves the accuracy of the computation of tb_to_xs
      for those systems with high-frequency timebase clocks (>= 268.5 MHz)
      by doing the right shift in two parts, one before the multiplication and
      one after, rather than doing the right shift before the multiplication.
      (We can't do all of the right shift after the multiplication unless we
      use 128-bit arithmetic.)
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      Acked-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      d4cfb113
  7. 21 6月, 2017 1 次提交
  8. 30 5月, 2017 1 次提交
  9. 15 4月, 2017 1 次提交
    • N
      powerpc/time: Set ->min_delta_ticks and ->max_delta_ticks · 115631c3
      Nicolai Stange 提交于
      In preparation for making the clockevents core NTP correction aware,
      all clockevent device drivers must set ->min_delta_ticks and
      ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
      clockevent device's rate is going to change dynamically and thus, the
      ratio of ns to ticks ceases to stay invariant.
      
      Make the powerpc arch's clockevent driver initialize these fields properly.
      
      This patch alone doesn't introduce any change in functionality as the
      clockevents core still looks exclusively at the (untouched) ->min_delta_ns
      and ->max_delta_ns. As soon as this has changed, a followup patch will
      purge the initialization of ->min_delta_ns and ->max_delta_ns from this
      driver.
      
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Oliver O'Halloran <oohall@gmail.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Signed-off-by: NNicolai Stange <nicstange@gmail.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      115631c3
  10. 02 3月, 2017 2 次提交
  11. 23 2月, 2017 1 次提交
  12. 01 2月, 2017 6 次提交
  13. 14 1月, 2017 5 次提交
  14. 25 12月, 2016 2 次提交
  15. 15 11月, 2016 2 次提交
  16. 13 9月, 2016 1 次提交
  17. 08 8月, 2016 1 次提交
  18. 09 7月, 2016 1 次提交
  19. 05 7月, 2016 1 次提交
    • O
      powerpc/timer: Large Decrementer support · 79901024
      Oliver O'Halloran 提交于
      Power ISAv3 adds a large decrementer (LD) mode which increases the size
      of the decrementer register. The size of the enlarged decrementer
      register is between 32 and 64 bits with the exact size being dependent
      on the implementation. When in LD mode, reads are sign extended to 64
      bits and a decrementer exception is raised when the high bit is set (i.e
      the value goes below zero). Writes however are truncated to the physical
      register width so some care needs to be taken to ensure that the high
      bit is not set when reloading the decrementer. This patch adds support
      for using the LD inside the host kernel on processors that support it.
      
      When LD mode is supported firmware will supply the ibm,dec-bits property
      for CPU nodes to allow the kernel to determine the maximum decrementer
      value. Enabling LD mode is a hypervisor privileged operation so the kernel
      can only enable it manually when running in hypervisor mode. Guests that
      support LD mode can request it using the "ibm,client-architecture-support"
      firmware call (not implemented in this patch) or some other platform
      specific method. If this property is not supplied then the traditional
      decrementer width of 32 bit is assumed and LD mode will not be enabled.
      
      This patch was based on initial work by Jack Miller.
      Signed-off-by: NOliver O'Halloran <oohall@gmail.com>
      Signed-off-by: NBalbir Singh <bsingharora@gmail.com>
      Acked-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      79901024
  20. 04 6月, 2016 1 次提交
  21. 12 4月, 2016 1 次提交
  22. 16 12月, 2015 1 次提交
    • D
      powerpc: Remove broken GregorianDay() · 00b912b0
      Daniel Axtens 提交于
      GregorianDay() is supposed to calculate the day of the week
      (tm->tm_wday) for a given day/month/year. In that calcuation it
      indexed into an array called MonthOffset using tm->tm_mon-1. However
      tm_mon is zero-based, not one-based, so this is off-by-one. It also
      means that every January, GregoiranDay() will access element -1 of
      the MonthOffset array.
      
      It also doesn't appear to be a correct algorithm either: see in
      contrast kernel/time/timeconv.c's time_to_tm function.
      
      It's been broken forever, which suggests no-one in userland uses
      this. It looks like no-one in the kernel uses tm->tm_wday either
      (see e.g. drivers/rtc/rtc-ds1305.c:319).
      
      tm->tm_wday is conventionally set to -1 when not available in
      hardware so we can simply set it to -1 and drop the function.
      (There are over a dozen other drivers in drivers/rtc that do
      this.)
      
      Found using UBSAN.
      
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andrew Morton <akpm@linux-foundation.org> # as an example of what UBSan finds.
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
      Cc: rtc-linux@googlegroups.com
      Signed-off-by: NDaniel Axtens <dja@axtens.net>
      Acked-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      00b912b0