Commit 30274569 authored by Thomas Gleixner's avatar Thomas Gleixner

clockevents: check broadcast device not tick device

Impact: Possible hang on CPU online observed on AMD C1E machines.

The broadcast setup code looks at the mode of the tick device to
determine whether it needs to be shut down or setup. This is wrong
when the broadcast mode is set to one shot already. This can happen
when a CPU is brought online as it goes through the periodic setup
first.

The problem went unnoticed as sane systems do not call into that code
before the switch to one shot for the clock event device happens.
The AMD C1E idle routine switches over immediately and thereby shuts
down the just setup device before the first interrupt happens.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 49d670fb
...@@ -235,7 +235,7 @@ static void tick_do_broadcast_on_off(void *why) ...@@ -235,7 +235,7 @@ static void tick_do_broadcast_on_off(void *why)
case CLOCK_EVT_NOTIFY_BROADCAST_FORCE: case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
if (!cpu_isset(cpu, tick_broadcast_mask)) { if (!cpu_isset(cpu, tick_broadcast_mask)) {
cpu_set(cpu, tick_broadcast_mask); cpu_set(cpu, tick_broadcast_mask);
if (td->mode == TICKDEV_MODE_PERIODIC) if (bc->mode == TICKDEV_MODE_PERIODIC)
clockevents_shutdown(dev); clockevents_shutdown(dev);
} }
if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE) if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
...@@ -245,7 +245,7 @@ static void tick_do_broadcast_on_off(void *why) ...@@ -245,7 +245,7 @@ static void tick_do_broadcast_on_off(void *why)
if (!tick_broadcast_force && if (!tick_broadcast_force &&
cpu_isset(cpu, tick_broadcast_mask)) { cpu_isset(cpu, tick_broadcast_mask)) {
cpu_clear(cpu, tick_broadcast_mask); cpu_clear(cpu, tick_broadcast_mask);
if (td->mode == TICKDEV_MODE_PERIODIC) if (bc->mode == TICKDEV_MODE_PERIODIC)
tick_setup_periodic(dev, 0); tick_setup_periodic(dev, 0);
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment