linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/2] clockevents: Stop unused clockevent devices
@ 2015-04-03  3:34 Viresh Kumar
  2015-04-03  3:34 ` [PATCH V2 1/2] clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state Viresh Kumar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Viresh Kumar @ 2015-04-03  3:34 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Peter Zijlstra
  Cc: linaro-kernel, linux-kernel, Frederic Weisbecker, Kevin Hilman,
	Daniel Lezcano, Preeti U Murthy, Viresh Kumar

Hi,

A clockevent device is used to service timers/hrtimers requests and the next
event (when it should fire) is decided by the timer/hrtimer expiring next. When
no timers/hrtimers are pending to be serviced, the expiry time is set to a
special value: KTIME_MAX.

This would normally happen 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 unused clockevent device should be
stopped or its interrupts should be masked.

Thomas suggested to add an optional state ONESHOT_STOPPED to solve this problem:
lkml.org/lkml/2014/5/9/508.

First patch implements the required infrastructure to start/stop clockevent
device. The second patch stops/starts clockevent devices as and when required.

It is also pushed here:

git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git tick/oneshot-stopped

@Preeti: I have applied your Reviewed-by only for the first commit as others
have changed significantly. Feel free to give it again :)

V1->V2:
- Peter & Ingo suggested to to start/stop clockevent device from
  tick_program_event() instead of the call sites that called
  tick_program_event().

--
viresh

Viresh Kumar (2):
  clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state
  Clockevents: Stop unused clockevent devices

 include/linux/clockchips.h |  7 ++++++-
 kernel/time/clockevents.c  | 18 +++++++++++++++++-
 kernel/time/hrtimer.c      |  6 ++----
 kernel/time/tick-oneshot.c | 16 ++++++++++++++++
 kernel/time/timer_list.c   |  6 ++++++
 5 files changed, 47 insertions(+), 6 deletions(-)

-- 
2.3.0.rc0.44.ga94655d


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-19 14:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-03  3:34 [PATCH V2 0/2] clockevents: Stop unused clockevent devices Viresh Kumar
2015-04-03  3:34 ` [PATCH V2 1/2] clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state Viresh Kumar
2015-05-19 14:39   ` [tip:timers/core] " tip-bot for Viresh Kumar
2015-04-03  3:34 ` [PATCH V2 2/2] Clockevents: Stop unused clockevent devices Viresh Kumar
2015-05-19 14:39   ` [tip:timers/core] clockevents: " tip-bot for Viresh Kumar
2015-05-07  7:50 ` [PATCH V2 0/2] " Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).