• Thomas Gleixner's avatar
    tick: Cure broadcast false positive pending bit warning · 2938d275
    Thomas Gleixner authored
    commit 26517f3e (tick: Avoid programming the local cpu timer if
    broadcast pending) added a warning if the cpu enters broadcast mode
    again while the pending bit is still set. Meelis reported that the
    warning triggers. There are two corner cases which have been not
    considered:
    
    1) cpuidle calls clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER)
       twice. That can result in the following scenario
    
       CPU0                    CPU1
                               cpuidle_idle_call()
                                 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER)
                                   set cpu in tick_broadcast_oneshot_mask
    
       broadcast interrupt
         event expired for cpu1
         set pending bit
    
                                 acpi_idle_enter_simple()
                                   clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER)
                                     WARN_ON(pending bit)
    
      Move the WARN_ON into the section where we enter broadcast mode so
      it wont provide false positives on the second call.
    
    2) safe_halt() enables interrupts, so a broadcast interrupt can be
       delivered befor the broadcast mode is disabled. That sets the
       pending bit for the CPU which receives the broadcast
       interrupt. Though the interrupt is delivered right away from the
       broadcast handler and leaves the pending bit stale.
    
       Clear the pending bit for the current cpu in the broadcast handler.
    Reported-and-tested-by: default avatarMeelis Roos <mroos@linux.ee>
    Cc: Len Brown <lenb@kernel.org>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Rafael J. Wysocki <rjw@sisk.pl>
    Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1305271841130.4220@ionosSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    2938d275
tick-broadcast.c 20.7 KB