Skip to contentSkip to conversation

cpufreq: fix HT oops on speedstep-ich system

PATCH New Dominik Brodowski 1 participant 1 message Jul 19, 2004 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: fix HT oops on speedstep-ich system

Bugfix for #3012 @ http://bugme.osdl.org/show_bug.cgi?id=3012

The speedstep-ich driver only registers for CPU0 (which is a sane thing to do). However, cpufreq_notify_transition() currently assumes the CPU specified in the freqs.cpu parameter has actually been registered with the CPUfreq core. This is obviously not the case for HT speedstep-ich CPUs, causing an OOPS. The long-term solution will be to merge the "cpufreq CPU group awareness patches" already RFC'ed to this list; but they still need a bit of polishing and testing.

Thanks to Boris Fersing for reporting the bug and testing this fix.

drivers/cpufreq/cpufreq.c +4 -2
diff -ruN linux-original/drivers/cpufreq/cpufreq.c linux/drivers/cpufreq/cpufreq.c
@@ -1059,7 +1059,8 @@
 		 * is not equal to what the cpufreq core thinks is "old frequency".
 		 */
 		if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
-			if ((likely(cpufreq_cpu_data[freqs->cpu]->cur)) &&
+			if ((likely(cpufreq_cpu_data[freqs->cpu])) &&
+			    (likely(cpufreq_cpu_data[freqs->cpu]->cur)) &&
 			    (unlikely(freqs->old != cpufreq_cpu_data[freqs->cpu]->cur)))
 			{
 				if (cpufreq_driver->flags & CPUFREQ_PANIC_OUTOFSYNC)
@@ -1077,7 +1078,8 @@
 	case CPUFREQ_POSTCHANGE:
 		adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
 		notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs);
-		cpufreq_cpu_data[freqs->cpu]->cur = freqs->new;
+		if (likely(cpufreq_cpu_data[freqs->cpu]))
+			cpufreq_cpu_data[freqs->cpu]->cur = freqs->new;
 		break;
 	}
 	up_read(&cpufreq_notifier_rwsem);