Re: [hrtimer] WARNING: CPU: 0 PID: 0 at kernel/time/clockevents.c:318 clockevents_program_event()

From: Thomas Gleixner
Date: Thu Apr 16 2015 - 06:47:51 EST


On Thu, 16 Apr 2015, Fengguang Wu wrote:
> Hi Thomas,
>
> 0day kernel testing robot got the below dmesg and the first bad commit is

Thanks for the report. I found the issue and pushed the fix to
timers/wip. Patch below.

Thanks,

tglx

commit 0385d021dfeec82fdc94b4be5e74f45ababa7d73
Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Thu Apr 16 12:42:04 2015 +0200

tick: Prevent periodic handler from stomping over highres/nohz mode

We switch to highres/nohz from the hard interrupt context now. So the
periodic handler will see event mode periodic and try to reschedule
the timer interrupt. But that's not what we want as the hrtimer/nohz
code is taking care of it. Check whether the eventhandler has changed
and return.

Needs to be folded back for the final merge.

Fixes: 8ca99a56579 'hrtimer: Get rid of hrtimer softirq'
Reported-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 3ae6afa1eb98..ea5f9eae8f74 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -102,6 +102,16 @@ void tick_handle_periodic(struct clock_event_device *dev)

tick_periodic(cpu);

+#if defined(CONFIG_HIGH_RES_TIMERS) || defined(CONFIG_NO_HZ_COMMON)
+ /*
+ * The cpu might have transitioned to HIGHRES or NOHZ mode via
+ * update_process_times() -> run_local_timers() ->
+ * hrtimer_run_queues().
+ */
+ if (dev->event_handler != tick_handle_periodic)
+ return;
+#endif
+
if (dev->state != CLOCK_EVT_STATE_ONESHOT)
return;
for (;;) {



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/