Skip to contentSkip to conversation

cpufreq: avoid re-enabling of interrupts too early during resume

PATCH New Dominik Brodowski 1 participant 1 message Aug 9, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

arch/i386/kernel/timers/timer_tsc.c +5 -2
diff -ruN linux-original/arch/i386/kernel/timers/timer_tsc.c linux/arch/i386/kernel/timers/timer_tsc.c
@@ -265,7 +265,8 @@
 {
 	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 @@
 		}
 #endif
 	}
-	write_sequnlock_irq(&xtime_lock);
+
+	if (val != CPUFREQ_RESUMECHANGE)
+		write_sequnlock_irq(&xtime_lock);
 
 	return 0;
 }