Skip to contentSkip to conversation

kernel crash in powernow-k8 after lost ticks detected

PATCH In review Jan Beulich 3 participants 3 messages Mar 20, 2006 – Mar 26, 2006 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel crash in powernow-k8 after lost ticks detected

Since powernowk8_cpu_init() gets called only for one of the two cores (the other one is in the same policy set and hence cpufreq_add_dev() prevents the call), calling other functions, namely powernowk8_get(), one CPUs that haven't been initialized will yield a NULL from the respective powernow_data[] slot. In the specific case, the problem occured after the system detected some lost ticks and called cpufreq_get() for all CPUs.
While I can imagine more sophisticated fixes for this (it namely seems questionable whether calling the init routines not on all CPUs, or, if that's necessary, whether not properly setting up the data pointers for all affected CPUs in powernow-k8 is okay), below simple change seems to address the problem (the other hunk is to make a message more meaningful).

drivers/cpufreq/cpufreq.c 2006-03-15 08:59:42.000000000 +0100 renamed from drivers/cpufreq/cpufreq.c 2006-03-13 10:21:56.000000000 +0100 +2 -2
Index: head-2006-03-13/drivers/cpufreq/cpufreq.c
===================================================================
@@ -689,7 +689,7 @@ static int cpufreq_add_dev (struct sys_d
               if (!cpu_online(j))
                       continue;
 
-               dprintk("CPU already managed, adding link\n");
+               dprintk("CPU %u already managed, adding link\n", j);
               cpufreq_cpu_get(cpu);
               cpu_sys_dev = get_cpu_sysdev(j);
               sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
@@ -921,7 +921,7 @@ unsigned int cpufreq_get(unsigned int cp
 
       mutex_lock(&policy->lock);
 
-       ret = cpufreq_driver->get(cpu);
+       ret = cpufreq_driver->get(policy->cpu);
 
       if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
               /* verify no discrepancy between actual and saved value exists */
#1 lore raw
Quoted 11 lines · Jan Beulich

Since powernowk8_cpu_init() gets called only for one of the two cores (the other one is in the same policy set and hence cpufreq_add_dev() prevents the call), calling other functions, namely powernowk8_get(), one CPUs that haven't been initialized will yield a NULL from the respective powernow_data[] slot. In the specific case, the problem occured after the system detected some lost ticks and called cpufreq_get() for all CPUs.
While I can imagine more sophisticated fixes for this (it namely seems questionable whether calling the init routines not on all CPUs, or, if that's necessary, whether not properly setting up the data pointers for all affected CPUs in powernow-k8 is okay), below simple change seems to address the problem (the other hunk is to make a message more meaningful).

I already have a patch queued for this - also ran into it. But I did it slightly differently by making sure powernow_data[] is valid for all cores.

-Andi

#2 lore raw
In reply to Jan Beulich

Hi,

Quoted 11 lines · Jan Beulich

Since powernowk8_cpu_init() gets called only for one of the two cores (the other one is in the same policy set and hence cpufreq_add_dev() prevents the call), calling other functions, namely powernowk8_get(), one CPUs that haven't been initialized will yield a NULL from the respective powernow_data[] slot. In the specific case, the problem occured after the system detected some lost ticks and called cpufreq_get() for all CPUs.
While I can imagine more sophisticated fixes for this (it namely seems questionable whether calling the init routines not on all CPUs, or, if that's necessary, whether not properly setting up the data pointers for all affected CPUs in powernow-k8 is okay), below simple change seems to address the problem (the other hunk is to make a message more meaningful).

cpufreq_driver->get() can get called for _any_ CPU -- that's the semantics of that funciton, which I would not want to be changed. Therefore I prefer the patch by Andi which fixes powernow-k8.c and which is in Linus' git tree by now.

Thanks,
Dominik