From e6c343874d2bc351d6de9eb40f704d7eef007999 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Wed, 11 Aug 2004 13:31:55 +0100 Subject: [PATCH] [CPUFREQ] avoid re-enabling of interrupts too early during resume Avoid re-enabling the interrupts in "write_sequnlock_irq" in cpufreq_timer_notifier() when it gets called in "CPUFREQ_RESUMECHANGE" state -- that happens if the CPU frequency is detected to be different now from what it was during suspension, and that's a resume call of a sys device, so with interrupts off. Without this patch, it can cause nasty oopses. IIRC resume is done on one CPU only, so we don't need no lock anyways. Right? Many thanks to Brian J. Murrell for debugging this issue. Signed-off-by: Dominik Brodowski Signed-off-by: Dave Jones --- arch/i386/kernel/timers/timer_tsc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c index a1e3f6f966987..34e9b8eba1d2d 100644 --- a/arch/i386/kernel/timers/timer_tsc.c +++ b/arch/i386/kernel/timers/timer_tsc.c @@ -265,7 +265,8 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, { struct cpufreq_freqs *freq = data; - write_seqlock_irq(&xtime_lock); + if (val != CPUFREQ_RESUMECHANGE) + write_seqlock_irq(&xtime_lock); if (!ref_freq) { ref_freq = freq->old; loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy; @@ -291,7 +292,9 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, } #endif } - write_sequnlock_irq(&xtime_lock); + + if (val != CPUFREQ_RESUMECHANGE) + write_sequnlock_irq(&xtime_lock); return 0; } -- 2.53.0