[lkml]   [2014]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[tip:timers/urgent] tick: Clear broadcast pending bit when switching to oneshot
Commit-ID:  dd5fd9b91a77b4c9c28b7ef9c181b1a875820d0a
Author: Thomas Gleixner <>
AuthorDate: Tue, 11 Feb 2014 14:35:40 +0100
Committer: Thomas Gleixner <>
CommitDate: Thu, 13 Feb 2014 21:55:54 +0100

tick: Clear broadcast pending bit when switching to oneshot

AMD systems which use the C1E workaround in the amd_e400_idle routine
trigger the WARN_ON_ONCE in the broadcast code when onlining a CPU.

The reason is that the idle routine of those AMD systems switches the
cpu into forced broadcast mode early on before the newly brought up
CPU can switch over to high resolution / NOHZ mode. The timer related
CPU1 bringup looks like this:

cpumask_set(cpu, broadcast_oneshot_mask);

Now the broadcast interrupt on CPU0 sets CPU1 in the
broadcast_pending_mask and wakes CPU1. So CPU1 continues:

cpumask_clr(cpu, broadcast_oneshot_mask);

WARN_ON(cpumask_test(cpu, broadcast_pending_mask);

So while we remove CPU1 from the broadcast_oneshot_mask when we switch
over to highres mode, we do not clear the pending bit, which then
triggers the warning when we go back to idle.

The reason why this is only visible on C1E affected AMD systems is
that the other machines enter the deep sleep states via
acpi_idle/intel_idle and exit the broadcast mode before executing the
remote triggered local_apic_timer_interrupt. So the pending bit is
already cleared when the switch over to highres mode is clearing the
oneshot mask.

The solution is simple: Clear the pending bit together with the mask
bit when we switch over to highres mode.

Stanislaw came up independently with the same patch by enforcing the
C1E workaround and debugging the fallout. I picked mine, because mine
has a changelog :)

Reported-by: poma <>
Debugged-by: Stanislaw Gruszka <>
Signed-off-by: Thomas Gleixner <>
Cc: Olaf Hering <>
Cc: Dave Jones <>
Cc: Justin M. Forbes <>
Cc: Josh Boyer <>
Cc: # 3.10+
Signed-off-by: Thomas Gleixner <>
kernel/time/tick-broadcast.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 43780ab..98977a5 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -756,6 +756,7 @@ out:
static void tick_broadcast_clear_oneshot(int cpu)
cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask);
+ cpumask_clear_cpu(cpu, tick_broadcast_pending_mask);

static void tick_broadcast_init_next_event(struct cpumask *mask,

 \ /
  Last update: 2014-02-13 22:41    [W:0.084 / U:1.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site