linux-stable/kernel/time
Suresh Siddha 843447c62b clockevent: Prevent dead lock on clockevents_lock
This is a merge of two mainline commits, intended
for stable@kernel.org submission for 2.6.27 kernel.

commit f833bab87f
and

commit 918aae42aa
Changelog of both:

    Currently clockevents_notify() is called with interrupts enabled at
    some places and interrupts disabled at some other places.

    This results in a deadlock in this scenario.

    cpu A holds clockevents_lock in clockevents_notify() with irqs enabled
    cpu B waits for clockevents_lock in clockevents_notify() with irqs disabled
    cpu C doing set_mtrr() which will try to rendezvous of all the cpus.

    This will result in C and A come to the rendezvous point and waiting
    for B. B is stuck forever waiting for the spinlock and thus not
    reaching the rendezvous point.

    Fix the clockevents code so that clockevents_lock is taken with
    interrupts disabled and thus avoid the above deadlock.

    Also call lapic_timer_propagate_broadcast() on the destination cpu so
    that we avoid calling smp_call_function() in the clockevents notifier
    chain.

    This issue left us wondering if we need to change the MTRR rendezvous
    logic to use stop machine logic (instead of smp_call_function) or add
    a check in spinlock debug code to see if there are other spinlocks
    which gets taken under both interrupts enabled/disabled conditions.

    Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
    Cc: "Brown Len" <len.brown@intel.com>
    Cc: stable@kernel.org
    LKML-Reference: <1250544899.2709.210.camel@sbs-t61.sc.intel.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

    I got following warning on ia64 box:
      In function 'acpi_processor_power_verify':
      642: warning: passing argument 2 of 'smp_call_function_single' from
      incompatible pointer type

    This smp_call_function_single() was introduced by a commit
    f833bab87f:

    The problem is that the lapic_timer_propagate_broadcast() has 2 versions:
    One is real code that modified in the above commit, and the other is NOP
    code that used when !ARCH_APICTIMER_STOPS_ON_C3:

      static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }

    So I got warning because of !ARCH_APICTIMER_STOPS_ON_C3.

    We really want to do nothing here on !ARCH_APICTIMER_STOPS_ON_C3, so
    modify lapic_timer_propagate_broadcast() of real version to use
    smp_call_function_single() in it.

    Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
    Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-26 14:27:07 -07:00
..
clockevents.c clockevent: Prevent dead lock on clockevents_lock 2010-05-26 14:27:07 -07:00
clocksource.c Merge branch 'cpus4096-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-07-23 18:37:44 -07:00
jiffies.c [PATCH] fix jiffies clocksource inittime 2007-04-04 21:12:47 -07:00
Kconfig clockevents: Allow build w/o run-tine usage for migration purposes 2007-10-12 23:04:05 +02:00
Makefile clockevents: Allow build w/o run-tine usage for migration purposes 2007-10-12 23:04:05 +02:00
ntp.c ntp: fix calculation of the next jiffie to trigger RTC sync 2008-09-06 15:31:48 +02:00
tick-broadcast.c clockevent: Prevent dead lock on clockevents_lock 2010-05-26 14:27:07 -07:00
tick-common.c clockevents: prevent endless loop in tick_handle_periodic() 2009-05-08 14:54:36 -07:00
tick-internal.h timers: fix build error in !oneshot case 2008-09-23 12:57:00 +02:00
tick-oneshot.c clockevents: remove WARN_ON which was used to gather information 2008-09-09 22:20:01 +02:00
tick-sched.c printk: robustify printk 2009-11-09 16:52:43 -08:00
timekeeping.c time: catch xtime_nsec underflows and fix them 2009-10-12 11:33:23 -07:00
timer_list.c kernel: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00
timer_stats.c kernel: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00