RE: [PATCH][BUGFIX] Bug in timer_tsc cpufreq callback

From: Nakajima, Jun
Date: Sat Oct 11 2003 - 14:49:48 EST


This is not a theory, but we were really caught by this bug.

Jun
> -----Original Message-----
> From: linux-kernel-owner@xxxxxxxxxxxxxxx [mailto:linux-kernel-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Pallipadi, Venkatesh
> Sent: Saturday, October 11, 2003 12:22 PM
> To: torvalds@xxxxxxxx; akpm@xxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Subject: [PATCH][BUGFIX] Bug in timer_tsc cpufreq callback
>
>
> Hi,
>
> There is a bug in cpufreq call back funtion in timer_tsc routines,
> that can result in system deadlock. The issue is: grabbing the
> write_lock on xtime_lock without disabling the interrupts. So,
> if we happen to get a timer interrupt while we are in this code,
> system will go into a deadlock.
>
> This bug only effects the kernels that have CONFIG_CPU_FREQ enabled.
> Attached patch fixes it. Please apply.
>
>
> Thanks,
> -Venkatesh
>
>
> --- linux-2.6.0-test6/arch/i386/kernel/timers/timer_tsc.c.org
> 2003-10-10 14:01:02.000000000 -0700
> +++ linux-2.6.0-test6/arch/i386/kernel/timers/timer_tsc.c
> 2003-10-10 14:01:24.000000000 -0700
> @@ -321,7 +321,7 @@ time_cpufreq_notifier(struct notifier_bl
> {
> struct cpufreq_freqs *freq = data;
>
> - write_seqlock(&xtime_lock);
> + write_seqlock_irq(&xtime_lock);
> if (!ref_freq) {
> ref_freq = freq->old;
> loops_per_jiffy_ref =
> cpu_data[freq->cpu].loops_per_jiffy;
> @@ -342,7 +342,7 @@ time_cpufreq_notifier(struct notifier_bl
> }
> #endif
> }
> - write_sequnlock(&xtime_lock);
> + write_sequnlock_irq(&xtime_lock);
>
> return 0;
> }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/