浏览代码

Fix preemption warnings in speedstep-centrino.c

BUG: using smp_processor_id() in preemptible [00000001] code:
kondemand/0/2473
caller is centrino_target+0xfb/0x600
[<401e3646>] debug_smp_processor_id+0x9e/0xb0
[<40112afb>] centrino_target+0xfb/0x600
[<40112a00>] centrino_target+0x0/0x600
[<40305bd9>] __cpufreq_driver_target+0x5c/0x6b
[<f897a537>] do_dbs_timer+0x1bc/0x208 [cpufreq_ondemand]
[<40134a46>] run_workqueue+0x85/0x125
[<40374f7f>] _spin_lock_irqsave+0x18/0x66
[<f897a37b>] do_dbs_timer+0x0/0x208 [cpufreq_ondemand]
[<401353fb>] worker_thread+0xf9/0x124
[<401213b9>] default_wake_function+0x0/0xc
[<40135302>] worker_thread+0x0/0x124
[<40137b37>] kthread+0xb0/0xd9
[<40137a87>] kthread+0x0/0xd9
[<40104b2f>] kernel_thread_helper+0x7/0x10

Signed-off-by: Dave Jones <davej@redhat.com>
Dave Jones 18 年之前
父节点
当前提交
e8e49190f6
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c

+ 9 - 1
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c

@@ -720,6 +720,7 @@ static int centrino_target (struct cpufreq_policy *policy,
 			cpu_set(j, set_mask);
 			cpu_set(j, set_mask);
 
 
 		set_cpus_allowed(current, set_mask);
 		set_cpus_allowed(current, set_mask);
+		preempt_disable();
 		if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
 		if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
 			dprintk("couldn't limit to CPUs in this domain\n");
 			dprintk("couldn't limit to CPUs in this domain\n");
 			retval = -EAGAIN;
 			retval = -EAGAIN;
@@ -727,6 +728,7 @@ static int centrino_target (struct cpufreq_policy *policy,
 				/* We haven't started the transition yet. */
 				/* We haven't started the transition yet. */
 				goto migrate_end;
 				goto migrate_end;
 			}
 			}
+			preempt_enable();
 			break;
 			break;
 		}
 		}
 
 
@@ -761,10 +763,13 @@ static int centrino_target (struct cpufreq_policy *policy,
 		}
 		}
 
 
 		wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
 		wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
-		if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
+		if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
+			preempt_enable();
 			break;
 			break;
+		}
 
 
 		cpu_set(j, covered_cpus);
 		cpu_set(j, covered_cpus);
+		preempt_enable();
 	}
 	}
 
 
 	for_each_cpu_mask(k, online_policy_cpus) {
 	for_each_cpu_mask(k, online_policy_cpus) {
@@ -796,8 +801,11 @@ static int centrino_target (struct cpufreq_policy *policy,
 			cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 			cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 		}
 		}
 	}
 	}
+	set_cpus_allowed(current, saved_mask);
+	return 0;
 
 
 migrate_end:
 migrate_end:
+	preempt_enable();
 	set_cpus_allowed(current, saved_mask);
 	set_cpus_allowed(current, saved_mask);
 	return 0;
 	return 0;
 }
 }