1. 03 7月, 2013 1 次提交
    • S
      clocksource: arm_global_timer: Add ARM global timer support · c1b40e44
      Stuart Menefy 提交于
      This is a simple driver for the global timer module found in the Cortex
      A9-MP cores from revision r1p0 onwards. This should be able to perform
      the functions of the system timer and the local timer in an SMP system.
      
      The global timer has the following features:
          The global timer is a 64-bit incrementing counter with an
      auto-incrementing feature. It continues incrementing after sending
      interrupts. The global timer is memory mapped in the private memory
      region.
          The global timer is accessible to all Cortex-A9 processors in the
      cluster. Each Cortex-A9 processor has a private 64-bit comparator that
      is used to assert a private interrupt when the global timer has reached
      the comparator value. All the Cortex-A9 processors in a design use the
      banked ID, ID27, for this interrupt. ID27 is sent to the Interrupt
      Controller as a Private Peripheral Interrupt. The global timer is
      clocked by PERIPHCLK.
      Signed-off-by: NStuart Menefy <stuart.menefy@st.com>
      Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@st.com>
      CC: Arnd Bergmann <arnd@arndb.de>
      CC: Rob Herring <robherring2@gmail.com>
      CC: Linus Walleij <linus.walleij@linaro.org>
      CC: Will Deacon <will.deacon@arm.com>
      CC: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      c1b40e44
  2. 02 7月, 2013 4 次提交
    • S
      clocksource: Add Marvell Orion SoC timer · 0c1dcfd5
      Sebastian Hesselbarth 提交于
      This patch add a DT enabled driver for timers found on Marvell Orion SoCs
      (Kirkwood, Dove, Orion5x, and Discovery Innovation). It installs a free-
      running clocksource on timer0 and a clockevent source on timer1.
      Corresponding device tree documentation is also added.
      Signed-off-by: NSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Tested-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Tested-by: NAndrew Lunn <andrew@lunn.ch>
      0c1dcfd5
    • T
      tick: Sanitize broadcast control logic · 07bd1172
      Thomas Gleixner 提交于
      The recent implementation of a generic dummy timer resulted in a
      different registration order of per cpu local timers which made the
      broadcast control logic go belly up.
      
      If the dummy timer is the first clock event device which is registered
      for a CPU, then it is installed, the broadcast timer is initialized
      and the CPU is marked as broadcast target.
      
      If a real clock event device is installed after that, we can fail to
      take the CPU out of the broadcast mask. In the worst case we end up
      with two periodic timer events firing for the same CPU. One from the
      per cpu hardware device and one from the broadcast.
      
      Now the problem is that we have no way to distinguish whether the
      system is in a state which makes broadcasting necessary or the
      broadcast bit was set due to the nonfunctional dummy timer
      installment.
      
      To solve this we need to keep track of the system state seperately and
      provide a more detailed decision logic whether we keep the CPU in
      broadcast mode or not.
      
      The old decision logic only clears the broadcast mode, if the newly
      installed clock event device is not affected by power states.
      
      The new logic clears the broadcast mode if one of the following is
      true:
      
        - The new device is not affected by power states.
      
        - The system is not in a power state affected mode
      
        - The system has switched to oneshot mode. The oneshot broadcast is
          controlled from the deep idle state. The CPU is not in idle at
          this point, so it's safe to remove it from the mask.
      
      If we clear the broadcast bit for the CPU when a new device is
      installed, we also shutdown the broadcast device when this was the
      last CPU in the broadcast mask.
      
      If the broadcast bit is kept, then we leave the new device in shutdown
      state and rely on the broadcast to deliver the timer interrupts via
      the broadcast ipis.
      Reported-and-tested-by: NStehle Vincent-B46079 <B46079@freescale.com>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Cc: John Stultz <john.stultz@linaro.org>,
      Cc: Mark Rutland <mark.rutland@arm.com>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1307012153060.4013@ionos.tec.linutronix.de
      Cc: stable@vger.kernel.org
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      07bd1172
    • T
      tick: Prevent uncontrolled switch to oneshot mode · 1f73a980
      Thomas Gleixner 提交于
      When the system switches from periodic to oneshot mode, the broadcast
      logic causes a possibility that a CPU which has not yet switched to
      oneshot mode puts its own clock event device into oneshot mode without
      updating the state and the timer handler.
      
      CPU0				CPU1
      				per cpu tickdev is in periodic mode
      				and switched to broadcast
      
      Switch to oneshot mode
       tick_broadcast_switch_to_oneshot()
        cpumask_copy(tick_oneshot_broacast_mask,
      	       tick_broadcast_mask);
      
        broadcast device mode = oneshot
      
      				Timer interrupt
      						
      				irq_enter()
      				 tick_check_oneshot_broadcast()
      				  dev->set_mode(ONESHOT);
      
      				tick_handle_periodic()
      				 if (dev->mode == ONESHOT)
      				   dev->next_event += period;
      				   FAIL.
      
      We fail, because dev->next_event contains KTIME_MAX, if the device was
      in periodic mode before the uncontrolled switch to oneshot happened.
      
      We must copy the broadcast bits over to the oneshot mask, because
      otherwise a CPU which relies on the broadcast would not been woken up
      anymore after the broadcast device switched to oneshot mode.
      
      So we need to verify in tick_check_oneshot_broadcast() whether the CPU
      has already switched to oneshot mode. If not, leave the device
      untouched and let the CPU switch controlled into oneshot mode.
      
      This is a long standing bug, which was never noticed, because the main
      user of the broadcast x86 cannot run into that scenario, AFAICT. The
      nonarchitected timer mess of ARM creates a gazillion of differently
      broken abominations which trigger the shortcomings of that broadcast
      code, which better had never been necessary in the first place.
      Reported-and-tested-by: NStehle Vincent-B46079 <B46079@freescale.com>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Cc: John Stultz <john.stultz@linaro.org>,
      Cc: Mark Rutland <mark.rutland@arm.com>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1307012153060.4013@ionos.tec.linutronix.de
      Cc: stable@vger.kernel.org
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      1f73a980
    • T
      tick: Make oneshot broadcast robust vs. CPU offlining · c9b5a266
      Thomas Gleixner 提交于
      In periodic mode we remove offline cpus from the broadcast propagation
      mask. In oneshot mode we fail to do so. This was not a problem so far,
      but the recent changes to the broadcast propagation introduced a
      constellation which can result in a NULL pointer dereference.
      
      What happens is:
      
      CPU0			CPU1
      			idle()
      			  arch_idle()
      			    tick_broadcast_oneshot_control(OFF);
      			      set cpu1 in tick_broadcast_force_mask
      			  if (cpu_offline())
      			     arch_cpu_dead()
      
      cpu_dead_cleanup(cpu1)
       cpu1 tickdevice pointer = NULL
      
      broadcast interrupt
        dereference cpu1 tickdevice pointer -> OOPS
      
      We dereference the pointer because cpu1 is still set in
      tick_broadcast_force_mask and tick_do_broadcast() expects a valid
      cpumask and therefor lacks any further checks.
      
      Remove the cpu from the tick_broadcast_force_mask before we set the
      tick device pointer to NULL. Also add a sanity check to the oneshot
      broadcast function, so we can detect such issues w/o crashing the
      machine.
      Reported-by: NPrarit Bhargava <prarit@redhat.com>
      Cc: athorlton@sgi.com
      Cc: CAI Qian <caiqian@redhat.com>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1306261303260.4013@ionos.tec.linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      c9b5a266
  3. 29 6月, 2013 6 次提交
  4. 28 6月, 2013 1 次提交
  5. 25 6月, 2013 4 次提交
  6. 22 6月, 2013 1 次提交
    • S
      sched_clock: Add temporary asm/sched_clock.h · 629a6a2b
      Stephen Boyd 提交于
      Some new users of the ARM sched_clock framework are going through
      the arm-soc tree. Before 38ff87f7 (sched_clock: Make ARM's
      sched_clock generic for all architectures, 2013-06-01) the header
      file was in asm, but now it's in linux. One solution would be to
      do an evil merge of the arm-soc tree and fix up the asm users,
      but it's easier to add a temporary asm header that we can remove
      along with the few stragglers after the merge window is over.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      629a6a2b
  7. 19 6月, 2013 1 次提交
  8. 18 6月, 2013 1 次提交
    • S
      ARM: sched_clock: Load cycle count after epoch stabilizes · 336ae118
      Stephen Boyd 提交于
      There is a small race between when the cycle count is read from
      the hardware and when the epoch stabilizes. Consider this
      scenario:
      
       CPU0                           CPU1
       ----                           ----
       cyc = read_sched_clock()
       cyc_to_sched_clock()
                                       update_sched_clock()
                                        ...
                                        cd.epoch_cyc = cyc;
        epoch_cyc = cd.epoch_cyc;
        ...
        epoch_ns + cyc_to_ns((cyc - epoch_cyc)
      
      The cyc on cpu0 was read before the epoch changed. But we
      calculate the nanoseconds based on the new epoch by subtracting
      the new epoch from the old cycle count. Since epoch is most likely
      larger than the old cycle count we calculate a large number that
      will be converted to nanoseconds and added to epoch_ns, causing
      time to jump forward too much.
      
      Fix this problem by reading the hardware after the epoch has
      stabilized.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      336ae118
  9. 13 6月, 2013 4 次提交
  10. 09 6月, 2013 1 次提交
  11. 06 6月, 2013 3 次提交
  12. 30 5月, 2013 4 次提交
    • J
      x86: Fix vrtc_get_time/set_mmss to use new timespec interface · ce0b0989
      John Stultz 提交于
      The patch "x86: Increase precision of x86_platform.get/set_wallclock"
      changed the x86 platform set_wallclock/get_wallclock interfaces to
      use nsec granular timespecs instead of a second granular interface.
      
      However, that patch missed converting the vrtc code, so this patch
      converts those functions to use timespecs.
      
      Many thanks to the kbuild test robot for finding this!
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      ce0b0989
    • C
      power: Add option to log time spent in suspend · 5c83545f
      Colin Cross 提交于
      Below is a patch from android kernel that maintains a histogram of
      suspend times. Please review and provide feedback.
      
      Statistices on the time spent in suspend are kept in
      /sys/kernel/debug/sleep_time.
      
      Cc: Android Kernel Team <kernel-team@android.com>
      Cc: Colin Cross <ccross@android.com>
      Cc: Todd Poynor <toddpoynor@google.com>
      Cc: San Mehat <san@google.com>
      Cc: Benoit Goby <benoit@android.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NColin Cross <ccross@android.com>
      Signed-off-by: NTodd Poynor <toddpoynor@google.com>
      [zoran.markovic@linaro.org: Re-formatted suspend time table to better
      fit expected values. Moved accounting of suspend time into timekeeping
      core. Removed CONFIG_SUSPEND_TIME flag and made the feature conditional
      on CONFIG_DEBUG_FS. Changed the file name to sleep_time to better fit
      terminology in timekeeping core. Changed seq_printf to seq_puts. Tweaked
      commit message]
      Signed-off-by: NZoran Markovic <zoran.markovic@linaro.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      5c83545f
    • T
      timerfd: Add alarm timers · 11ffa9d6
      Todd Poynor 提交于
      Add support for clocks CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM,
      thereby enabling wakeup alarm timers via file descriptors.
      Signed-off-by: NTodd Poynor <toddpoynor@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      11ffa9d6
    • T
      alarmtimer: Add functions for timerfd support · 6cffe00f
      Todd Poynor 提交于
      Add functions needed for hooking up alarmtimer to timerfd:
      
      * alarm_restart: Similar to hrtimer_restart, restart an alarmtimer after
        the expires time has already been updated (as with alarm_forward).
      
      * alarm_forward_now: Similar to hrtimer_forward_now, move the expires
        time forward to an interval from the current time of the associated clock.
      
      * alarm_start_relative: Start an alarmtimer with an expires time relative to
        the current time of the associated clock.
      
      * alarm_expires_remaining: Similar to hrtimer_expires_remaining, return the
        amount of time remaining until alarm expiry.
      Signed-off-by: NTodd Poynor <toddpoynor@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      6cffe00f
  13. 29 5月, 2013 5 次提交
  14. 28 5月, 2013 2 次提交
  15. 16 5月, 2013 2 次提交