mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tick/broadcast: set next event of bc to KTIME_MAX
@ 2018-02-02  3:02 Qiao Zhou
  2018-02-05  2:17 ` kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Qiao Zhou @ 2018-02-02  3:02 UTC (permalink / raw)
  To: fweisbec, tglx, mingo, linux-kernel; +Cc: Qiao Zhou

In tick_handle_oneshot_broadcast, it doesn't reprogram tick-broadcast
when no more event to set. In hardware it's true, but the next event
value on broadcast device is expired, which will be used in idle
broadcast enter. It may cause no more timer set in system in below case.

nte_l: next_timer_event on local timer 
nte_b: next_timer_event on broadcast timer
time: in ms, assume HZ = 128

     core0                core1             broadcast timer
990: nte_l = 1004         nte_l = 1004      nte_b = 1000
     enter idle           enter idle        nte_b = 1000 
-----------------------------------------------------------
     996: non-timer interrupt wake up both core0 & core1   
-----------------------------------------------------------
996: core0/1 exit idle, clear broadcast oneshot mask, set
     local timer next event(nte_l = 996 + 8 = 1004)
1000:broadcast interrupt comes, one shot mask is 0. do not
     program broadcast next time event.(nte_b = 1000)
1002:core0/1 enter idle, shut down local timer. since nte_l
     is larger than nte_b, do not program broadcast timer.
1004:no more timer interrupt, not report rcu quiescent state
     completion. no new timer is set in tick_nohz_idle_enter
     when core0/1 enter/exit idle. at last system will crash.

tick_program_event(dev->next_event, 1) is not guaranteed to generate
local timer interrupt when exiting idle. When local timer is shutdown,
we need to compare local next event to updated broadcast next event.
So when there is no broadcast next event to set on hardware, we need
to set software next_event to KTIME_MAX.

Signed-off-by: Qiao Zhou <qiaozhou@asrmicro.com>
---
 kernel/time/tick-broadcast.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index b398c2e..7648326 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -661,6 +661,14 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
 	 */
 	if (next_event != KTIME_MAX)
 		tick_broadcast_set_event(dev, next_cpu, next_event);
+	else
+		/*
+		 * not program broadcast timer, but set the value to show that
+		 * the next event is not set, which is used in
+		 * __tick_broadcast_oneshot_control in idle tick_broadcast
+		 * enter/exit control flow.
+		 */
+		dev->next_event.tv64 = KTIME_MAX;
 
 	raw_spin_unlock(&tick_broadcast_lock);
 
-- 
2.7.4

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

end of thread, other threads:[~2018-02-05  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02  3:02 [PATCH] tick/broadcast: set next event of bc to KTIME_MAX Qiao Zhou
2018-02-05  2:17 ` kbuild test robot
2018-02-05  8:24   ` qiaozhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®