lkml.org 
[lkml]   [2010]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 3/4] kgdb,clocksource: Prevent kernel hang in kernel debugger
    On Mon, 25 Jan 2010, Jason Wessel wrote:
    > This is a regression fix against: 0f8e8ef7c204988246da5a42d576b7fa5277a8e4
    >
    > Spin locks were added to the clocksource_resume_watchdog() which cause
    > the kernel debugger to deadlock on an SMP system frequently.
    >
    > The kernel debugger can try for the lock, but if it fails it should
    > continue to touch the clocksource watchdog anyway, else it will trip
    > if the general kernel execution has been paused for too long.
    >
    > This introduces an possible race condition where the kernel debugger
    > might not process the list correctly if a clocksource is being added
    > or removed at the time of this call. This race is sufficiently rare vs
    > having the kernel debugger hang the kernel
    >
    > CC: Thomas Gleixner <tglx@linutronix.de>
    > CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
    > CC: John Stultz <johnstul@us.ibm.com>
    > CC: Andrew Morton <akpm@linux-foundation.org>
    > CC: Magnus Damm <damm@igel.co.jp>
    > Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
    > ---
    > kernel/time/clocksource.c | 7 ++++++-
    > 1 files changed, 6 insertions(+), 1 deletions(-)
    >
    > diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
    > index e85c234..74f9ba6 100644
    > --- a/kernel/time/clocksource.c
    > +++ b/kernel/time/clocksource.c
    > @@ -463,7 +463,12 @@ void clocksource_resume(void)
    > */
    > void clocksource_touch_watchdog(void)
    > {
    > - clocksource_resume_watchdog();
    > + unsigned long flags;
    > +
    > + int got_lock = spin_trylock_irqsave(&watchdog_lock, flags);
    > + clocksource_reset_watchdog();
    > + if (got_lock)
    > + spin_unlock_irqrestore(&watchdog_lock, flags);

    Just for the record. This patch would not compile on any platform
    which has CONFIG_CLOCKSOURCE_WATCHDOG=n

    Thanks,

    tglx


    \
     
     \ /
      Last update: 2010-01-26 11:47    [W:0.044 / U:88.240 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site