1. 24 3月, 2017 1 次提交
    • N
      clockevents: Make clockevents_config() static · 0695bd99
      Nicolai Stange 提交于
      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: NNicolai Stange <nicstange@gmail.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      0695bd99
  2. 08 2月, 2017 1 次提交
    • D
      clockevents: Add a clkevt-of mechanism like clksrc-of · 376bc271
      Daniel Lezcano 提交于
      The current code uses the CLOCKSOURCE_OF_DECLARE macro to fill the clksrc
      table with a t-uple (name, init_function).
      
      Unfortunately it ends up to the clockevent and the clocksource being
      both initialized with this macro. It is not a problem by itself but there
      is not a clear distinction between a clockevent and a clocksource in the
      code initialization path. Somebody can argue there are the same IP block
      and the same DT node. But conceptually from the software side, there are
      two distincts entities and as is they should be initialized separetely.
      Some drivers which do not have a clocksource end up by using the
      CLOCKSOURCE_OF_DECLARE macro to declare a clockevent.
      
      Another result is the fuzzy organization in the clocksource directory,
      where the clockevents are implemented in the same file than the
      clocksources or file labelled timer-something implementing a clocksource.
      
      This patch provides another macro to specifically declare a clockevent in
      the same way than the clocksource and gives the opportunity to write two
      separate drivers, one for the clocksource and another for the clockevents.
      
      Hopefully, that can help to do some housework in the directory, perhaps
      split the drivers in to entities, for example:
      	- clksrc-rockchip.c
      	- clkevt-rockchip.c
      
      Also, it gives the possibility to declare clocksources separately in the
      DT and then use a clocksource from IP block while while clockevents are
      used from another IP block.
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      376bc271
  3. 27 1月, 2016 1 次提交
  4. 14 9月, 2015 1 次提交
  5. 20 7月, 2015 1 次提交
  6. 02 6月, 2015 2 次提交
  7. 19 5月, 2015 1 次提交
    • V
      clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state · 8fff52fd
      Viresh Kumar 提交于
      When no timers/hrtimers are pending, the expiry time is set to a
      special value: 'KTIME_MAX'. This normally happens with
      NO_HZ_{IDLE|FULL} in both LOWRES/HIGHRES modes.
      
      When 'expiry == KTIME_MAX', we either cancel the 'tick-sched' hrtimer
      (NOHZ_MODE_HIGHRES) or skip reprogramming clockevent device
      (NOHZ_MODE_LOWRES).  But, the clockevent device is already
      reprogrammed from the tick-handler for next tick.
      
      As the clock event device is programmed in ONESHOT mode it will at
      least fire one more time (unnecessarily). Timers on few
      implementations (like arm_arch_timer, etc.) only support PERIODIC mode
      and their drivers emulate ONESHOT over that. Which means that on these
      platforms we will get spurious interrupts periodically (at last
      programmed interval rate, normally tick rate).
      
      In order to avoid spurious interrupts, the clockevent device should be
      stopped or its interrupts should be masked.
      
      A simple (yet hacky) solution to get this fixed could be: update
      hrtimer_force_reprogram() to always reprogram clockevent device and
      update clockevent drivers to STOP generating events (or delay it to
      max time) when 'expires' is set to KTIME_MAX. But the drawback here is
      that every clockevent driver has to be hacked for this particular case
      and its very easy for new ones to miss this.
      
      However, Thomas suggested to add an optional state ONESHOT_STOPPED to
      solve this problem: lkml.org/lkml/2014/5/9/508.
      
      This patch adds support for ONESHOT_STOPPED state in clockevents
      core. It will only be available to drivers that implement the
      state-specific callbacks instead of the legacy ->set_mode() callback.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Reviewed-by: NPreeti U. Murthy <preeti@linux.vnet.ibm.com>
      Cc: linaro-kernel@lists.linaro.org
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Kevin Hilman <khilman@linaro.org>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/b8b383a03ac07b13312c16850b5106b82e4245b5.1428031396.git.viresh.kumar@linaro.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      8fff52fd
  8. 03 4月, 2015 4 次提交
  9. 02 4月, 2015 1 次提交
    • I
      clockevents: Clean up clockchips.h · 9eed56e8
      Ingo Molnar 提交于
      Do various cleanups on the clockchips.h file:
      
       - indent preprocessor blocks to make it more clear which block we are in,
         this also makes merge resolution easier
      
       - comment larger preprocessor blocks consistently, using the:
      
           #if FOO
           ...
           #else /* !FOO: */
           ...
           #endif /* !FOO */
      
         notation.
      
       - unbreak lines
      
       - etc.
      
      No change in functionality.
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      9eed56e8
  10. 01 4月, 2015 4 次提交
  11. 27 3月, 2015 2 次提交
  12. 18 2月, 2015 1 次提交
    • V
      clockevents: Introduce mode specific callbacks · bd624d75
      Viresh Kumar 提交于
      It is not possible for the clockevents core to know which modes (other than
      those with a corresponding feature flag) are supported by a particular
      implementation. And drivers are expected to handle transition to all modes
      elegantly, as ->set_mode() would be issued for them unconditionally.
      
      Now, adding support for a new mode complicates things a bit if we want to use
      the legacy ->set_mode() callback. We need to closely review all clockevents
      drivers to see if they would break on addition of a new mode. And after such
      reviews, it is found that we have to do non-trivial changes to most of the
      drivers [1].
      
      Introduce mode-specific set_mode_*() callbacks, some of which the drivers may or
      may not implement. A missing callback would clearly convey the message that the
      corresponding mode isn't supported.
      
      A driver may still choose to keep supporting the legacy ->set_mode() callback,
      but ->set_mode() wouldn't be supporting any new modes beyond RESUME. If a driver
      wants to benefit from using a new mode, it would be required to migrate to
      the mode specific callbacks.
      
      The legacy ->set_mode() callback and the newly introduced mode-specific
      callbacks are mutually exclusive. Only one of them should be supported by the
      driver.
      
      Sanity check is done at the time of registration to distinguish between optional
      and required callbacks and to make error recovery and handling simpler. If the
      legacy ->set_mode() callback is provided, all mode specific ones would be
      ignored by the core but a warning is thrown if they are present.
      
      Call sites calling ->set_mode() directly are also updated to use
      __clockevents_set_mode() instead, as ->set_mode() may not be available anymore
      for few drivers.
      
       [1] https://lkml.org/lkml/2014/12/9/605
       [2] https://lkml.org/lkml/2015/1/23/255
      
      Suggested-by: Thomas Gleixner <tglx@linutronix.de> [2]
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Kevin Hilman <khilman@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
      Cc: linaro-kernel@lists.linaro.org
      Cc: linaro-networking@linaro.org
      Link: http://lkml.kernel.org/r/792d59a40423f0acffc9bb0bec9de1341a06fa02.1423788565.git.viresh.kumar@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      bd624d75
  13. 09 2月, 2014 1 次提交
  14. 07 2月, 2014 3 次提交
    • T
      time: Fixup fallout from recent clockevent/tick changes · f1689bb7
      Thomas Gleixner 提交于
      Make the stub function static inline instead of static and move the
      clockevents related function into the proper ifdeffed section.
      Reported-by: NFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Soren Brinkmann <soren.brinkmann@xilinx.com>
      Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
      f1689bb7
    • P
      tick: Introduce hrtimer based broadcast · 5d1638ac
      Preeti U Murthy 提交于
      On some architectures, in certain CPU deep idle states the local timers stop.
      An external clock device is used to wakeup these CPUs. The kernel support for the
      wakeup of these CPUs is provided by the tick broadcast framework by using the
      external clock device as the wakeup source.
      
      However not all implementations of architectures provide such an external
      clock device. This patch includes support in the broadcast framework to handle
      the wakeup of the CPUs in deep idle states on such systems by queuing a hrtimer
      on one of the CPUs, which is meant to handle the wakeup of CPUs in deep idle states.
      
      This patchset introduces a pseudo clock device which can be registered by the
      archs as tick_broadcast_device in the absence of a real external clock
      device. Once registered, the broadcast framework will work as is for these
      architectures as long as the archs take care of the BROADCAST_ENTER
      notification failing for one of the CPUs. This CPU is made the stand by CPU to
      handle wakeup of the CPUs in deep idle and it *must not enter deep idle states*.
      
      The CPU with the earliest wakeup is chosen to be this CPU. Hence this way the
      stand by CPU dynamically moves around and so does the hrtimer which is queued
      to trigger at the next earliest wakeup time. This is consistent with the case where
      an external clock device is present. The smp affinity of this clock device is
      set to the CPU with the earliest wakeup. This patchset handles the hotplug of
      the stand by CPU as well by moving the hrtimer on to the CPU handling the CPU_DEAD
      notification.
      
      Originally-from: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NPreeti U Murthy <preeti@linux.vnet.ibm.com>
      Cc: deepthi@linux.vnet.ibm.com
      Cc: paulmck@linux.vnet.ibm.com
      Cc: fweisbec@gmail.com
      Cc: paulus@samba.org
      Cc: srivatsa.bhat@linux.vnet.ibm.com
      Cc: svaidy@linux.vnet.ibm.com
      Cc: peterz@infradead.org
      Cc: benh@kernel.crashing.org
      Cc: rafael.j.wysocki@intel.com
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/20140207080632.17187.80532.stgit@preeti.in.ibm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      5d1638ac
    • P
      time: Change the return type of clockevents_notify() to integer · da7e6f45
      Preeti U Murthy 提交于
      The broadcast framework can potentially be made use of by archs which do not have an
      external clock device as well. Then, it is required that one of the CPUs need
      to handle the broadcasting of wakeup IPIs to the CPUs in deep idle. As a
      result its local timers should remain functional all the time. For such
      a CPU, the BROADCAST_ENTER notification has to fail indicating that its clock
      device cannot be shutdown. To make way for this support, change the return
      type of tick_broadcast_oneshot_control() and hence clockevents_notify() to
      indicate such scenarios.
      Signed-off-by: NPreeti U Murthy <preeti@linux.vnet.ibm.com>
      Cc: deepthi@linux.vnet.ibm.com
      Cc: paulmck@linux.vnet.ibm.com
      Cc: fweisbec@gmail.com
      Cc: paulus@samba.org
      Cc: srivatsa.bhat@linux.vnet.ibm.com
      Cc: svaidy@linux.vnet.ibm.com
      Cc: peterz@infradead.org
      Cc: benh@kernel.crashing.org
      Cc: rafael.j.wysocki@intel.com
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/20140207080606.17187.78306.stgit@preeti.in.ibm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      da7e6f45
  15. 02 10月, 2013 1 次提交
  16. 16 5月, 2013 3 次提交
  17. 01 4月, 2013 1 次提交
    • D
      timer: move enum definition out of ifdef section · 4dbad816
      Daniel Lezcano 提交于
      The next patch will setup automatically the broadcast timer for
      the different cpuidle driver when one idle state stops its timer.
      This will be part of the generic code.
      
      But some ARM boards, like s3c64xx, uses cpuidle but without the
      CONFIG_GENERIC_CLOCKEVENTS_BUILD set. Hence the cpuidle framework
      will be compiled with the code supposed to be generic, that is
      with clockevents_notify and the different enum.
      
      Also the function clockevents_notify is a noop macro, this is fine
      except the usual code is:
      
      	int cpu = smp_processor_id();
      	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
      
      and that raises a warning for the variable cpu which is not used.
      
      Move the clock_event_nofitiers enum definition out of the
      CONFIG_GENERIC_CLOCKEVENTS_BUILD section to prevent a compilation
      error when these are used in the code.
      
      Change the clockevents_notify macro to a static inline noop function
      to prevent a compilation warning.
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      4dbad816
  18. 22 3月, 2013 1 次提交
  19. 13 3月, 2013 1 次提交
    • T
      tick: Provide a check for a forced broadcast pending · eaa907c5
      Thomas Gleixner 提交于
      On the CPU which gets woken along with the target CPU of the broadcast
      the following happens:
      
        deep_idle()
      			<-- spurious wakeup
        broadcast_exit()
          set forced bit
        
        enable interrupts
          
      			<-- Nothing happens
      
        disable interrupts
      
        broadcast_enter()
      			<-- Here we observe the forced bit is set
        deep_idle()
      
      Now after that the target CPU of the broadcast runs the broadcast
      handler and finds the other CPU in both the broadcast and the forced
      mask, sends the IPI and stuff gets back to normal.
      
      So it's not actually harmful, just more evidence for the theory, that
      hardware designers have access to very special drug supplies.
      
      Now there is no point in going back to deep idle just to wake up again
      right away via an IPI. Provide a check which allows the idle code to
      avoid the deep idle transition.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: LAK <linux-arm-kernel@lists.infradead.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Arjan van de Veen <arjan@infradead.org>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Tested-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      Cc: Jason Liu <liu.h.jason@gmail.com>
      Link: http://lkml.kernel.org/r/20130306111537.565418308@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      eaa907c5
  20. 07 3月, 2013 1 次提交
    • D
      tick: Dynamically set broadcast irq affinity · d2348fb6
      Daniel Lezcano 提交于
      When a cpu goes to a deep idle state where its local timer is
      shutdown, it notifies the time frame work to use the broadcast timer
      instead.  Unfortunately, the broadcast device could wake up any CPU,
      including an idle one which is not concerned by the wake up at all. So
      in the worst case an idle CPU will wake up to send an IPI to the CPU
      whose timer expired.
      
      Provide an opt-in feature CLOCK_EVT_FEAT_DYNIRQ which tells the core
      that is should set the interrupt affinity of the broadcast interrupt
      to the cpu which has the earliest expiry time. This avoids unnecessary
      spurious wakeups and IPIs.
      
      [ tglx: Adopted to cpumask rework, silenced an uninitialized warning,
        massaged changelog ]
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Cc: viresh.kumar@linaro.org
      Cc: jacob.jun.pan@linux.intel.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: santosh.shilimkar@ti.com
      Cc: linaro-kernel@lists.linaro.org
      Cc: patches@linaro.org
      Cc: rickard.andersson@stericsson.com
      Cc: vincent.guittot@linaro.org
      Cc: linus.walleij@stericsson.com
      Cc: john.stultz@linaro.org
      Link: http://lkml.kernel.org/r/1362219013-18173-3-git-send-email-daniel.lezcano@linaro.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      d2348fb6
  21. 01 2月, 2013 2 次提交
  22. 04 9月, 2012 1 次提交
    • R
      timekeeping: Add suspend and resume of clock event devices · adc78e6b
      Rafael J. Wysocki 提交于
      Some clock event devices, for example such that belong to PM domains,
      need to be handled in a spcial way during the timekeeping suspend
      and resume (which takes place in the system core, or "syscore",
      stages of system power transitions) in analogy with clock sources.
      
      Introduce .suspend() and .resume() callbacks for clock event devices
      that will be executed by timekeeping_suspend/_resume(), respectively,
      next the the clock sources' .suspend() and .resume() callbacks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      adc78e6b
  23. 25 5月, 2012 1 次提交
  24. 08 9月, 2011 2 次提交
  25. 19 5月, 2011 2 次提交