aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@au1.ibm.com>2014-04-22 17:35:05 +1000
committerEli Qiao <taget@linux.vnet.ibm.com>2014-04-22 16:55:30 +0800
commitdbb1c98ee186dd6ee5bfe499140a1d8421565a1d (patch)
treea6cec647e421f07c1fd03e4a471f2309312b0f0c
parent3e4b562a7eb3c1250e9479c708f36f3a989ffad6 (diff)
downloadpowerkvm-dbb1c98ee186dd6ee5bfe499140a1d8421565a1d.tar.gz
tick-broadcast/cpuidle: Fix the programming of the broadcast hrtimer
Today CPUs in fast sleep are being woken up to handle their timers by the tick broadcast framework using a hrtimer queued on a nominated broadcast CPU. The hrtimer is programmed for the earlier of the next wakeup and a broadcast period which happens to be a jiffy. This programming is being done incorrectly today. The current time is noted, the tick broadcast interrupt handler is called, then the time at which the hrtimer needs to be programmed is decided. By then the noted current time would be stale and the hrtimer will be forward much ahead than required, leading to delayed broadcast interrupts being delivered to sleeping cpus. Fix this by noting the current time just before programming the hrtimer. Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
-rw-r--r--drivers/cpuidle/cpuidle-powerpc-book3s.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/cpuidle/cpuidle-powerpc-book3s.c b/drivers/cpuidle/cpuidle-powerpc-book3s.c
index f0c11576349202..e7624acf1ac8d9 100644
--- a/drivers/cpuidle/cpuidle-powerpc-book3s.c
+++ b/drivers/cpuidle/cpuidle-powerpc-book3s.c
@@ -209,11 +209,10 @@ static enum hrtimer_restart handle_broadcast(struct hrtimer *hrtimer)
struct clock_event_device *bc_evt = &bc_timer;
ktime_t interval, next_bc_tick, now;
- now = ktime_get();
-
if (!restart_broadcast(bc_evt))
return HRTIMER_NORESTART;
+ now = ktime_get();
interval = ktime_sub(bc_evt->next_event, now);
next_bc_tick = get_next_bc_tick();