* [PATCH][BUGFIX] Bug in timer_tsc cpufreq callback
@ 2003-10-11 19:22 Pallipadi, Venkatesh
0 siblings, 0 replies; 2+ messages in thread
From: Pallipadi, Venkatesh @ 2003-10-11 19:22 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
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;
}
[-- Attachment #2: tsc-deadlock.patch --]
[-- Type: application/octet-stream, Size: 628 bytes --]
--- 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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH][BUGFIX] Bug in timer_tsc cpufreq callback
@ 2003-10-11 19:48 Nakajima, Jun
0 siblings, 0 replies; 2+ messages in thread
From: Nakajima, Jun @ 2003-10-11 19:48 UTC (permalink / raw)
To: Pallipadi, Venkatesh, torvalds, akpm; +Cc: linux-kernel
This is not a theory, but we were really caught by this bug.
Jun
> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-
> owner@vger.kernel.org] On Behalf Of Pallipadi, Venkatesh
> Sent: Saturday, October 11, 2003 12:22 PM
> To: torvalds@osdl.org; akpm@osdl.org
> Cc: linux-kernel@vger.kernel.org
> 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;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-11 19:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-11 19:22 [PATCH][BUGFIX] Bug in timer_tsc cpufreq callback Pallipadi, Venkatesh
2003-10-11 19:48 Nakajima, Jun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.