Blob Blame History Raw
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sat, 27 Feb 2016 10:47:10 +0100
Subject: tick/broadcast: Make broadcast hrtimer irqsafe
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
Git-commit: c1eec9d99b9836b9731fe756172fb6b6ce6e6e77
Patch-mainline: Queued in subsystem maintainer repository
References: SLE Realtime Extension

Otherwise we end up with the following:

|=================================
|[ INFO: inconsistent lock state ]
|4.4.2-rt7+ #5 Not tainted
|---------------------------------
|inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
|ktimersoftd/0/4 [HC0[0]:SC0[0]:HE1:SE1] takes:
| (tick_broadcast_lock){?.....}, at: [<ffffffc000150db4>] tick_handle_oneshot_broadcast+0x58/0x27c
|{IN-HARDIRQ-W} state was registered at:
|  [<ffffffc000118198>] mark_lock+0x19c/0x6a0
|  [<ffffffc000119728>] __lock_acquire+0xb1c/0x2100
|  [<ffffffc00011b560>] lock_acquire+0xf8/0x230
|  [<ffffffc00061bf08>] _raw_spin_lock_irqsave+0x50/0x68
|  [<ffffffc000152188>] tick_broadcast_switch_to_oneshot+0x20/0x60
|  [<ffffffc0001529f4>] tick_switch_to_oneshot+0x64/0xd8
|  [<ffffffc000152b00>] tick_init_highres+0x1c/0x24
|  [<ffffffc000141e58>] hrtimer_run_queues+0x78/0x100
|  [<ffffffc00013f804>] update_process_times+0x38/0x74
|  [<ffffffc00014fc5c>] tick_periodic+0x60/0x140
|  [<ffffffc00014fd68>] tick_handle_periodic+0x2c/0x94
|  [<ffffffc00052b878>] arch_timer_handler_phys+0x3c/0x48
|  [<ffffffc00012d078>] handle_percpu_devid_irq+0x100/0x390
|  [<ffffffc000127f34>] generic_handle_irq+0x34/0x4c
|  [<ffffffc000128300>] __handle_domain_irq+0x90/0xf8
|  [<ffffffc000082554>] gic_handle_irq+0x5c/0xa4
|  [<ffffffc0000855ac>] el1_irq+0x6c/0xec
|  [<ffffffc000112bec>] default_idle_call+0x2c/0x44
|  [<ffffffc000113058>] cpu_startup_entry+0x3cc/0x410
|  [<ffffffc0006169f8>] rest_init+0x158/0x168
|  [<ffffffc000888954>] start_kernel+0x3a0/0x3b4
|  [<0000000080621000>] 0x80621000
|irq event stamp: 18723
|hardirqs last  enabled at (18723): [<ffffffc00061c188>] _raw_spin_unlock_irq+0x38/0x80
|hardirqs last disabled at (18722): [<ffffffc000140a4c>] run_hrtimer_softirq+0x2c/0x2f4
|softirqs last  enabled at (0): [<ffffffc0000c4744>] copy_process.isra.50+0x300/0x16d4
|softirqs last disabled at (0): [<          (null)>]           (null)

Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Mike Galbraith <mgalbraith@suse.de>
---
 kernel/time/tick-broadcast-hrtimer.c |    1 +
 1 file changed, 1 insertion(+)

--- a/kernel/time/tick-broadcast-hrtimer.c
+++ b/kernel/time/tick-broadcast-hrtimer.c
@@ -107,5 +107,6 @@ void tick_setup_hrtimer_broadcast(void)
 {
 	hrtimer_init(&bctimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 	bctimer.function = bc_handler;
+	bctimer.irqsafe = true;
 	clockevents_register_device(&ce_broadcast_hrtimer);
 }