diff options
author | Andrea Righi <righi.andrea@gmail.com> | 2008-09-18 06:43:40 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2008-10-09 13:52:44 -0400 |
commit | 4f6e6b9f97b0ce98a8d1da65adbaf743bd0486a9 (patch) | |
tree | b50dcdfa6ee6249af1be8549acbe459a452deb55 /drivers | |
parent | c4d14bc0bb5d13e316890651ae4518b764c3344c (diff) |
[CPUFREQ] Fix BUG: using smp_processor_id() in preemptible code
Use get_cpu()/put_cpu() in cpufreq_ondemand init routine, instead of
smp_processor_id() to avoid the following BUG:
[ 35.313118] BUG: using smp_processor_id() in preemptible [00000000] code=: modprobe/4952
[ 35.313132] caller is cpufreq_gov_dbs_init+0xa/0x8f [cpufreq_ondemand]
[ 35.313140] Pid: 4952, comm: modprobe Not tainted 2.6.27-rc5-mm1 #23
[ 35.313145] Call Trace:
[ 35.313158] [<ffffffff80361ff7>] debug_smp_processor_id+0xd7/0xe0
[ 35.313167] [<ffffffffa010800a>] cpufreq_gov_dbs_init+0xa/0x8f [cpufreq_ondemand]
[ 35.313176] [<ffffffff8020903b>] _stext+0x3b/0x160
[ 35.313185] [<ffffffff804768c5>] __mutex_unlock_slowpath+0xe5/0x190
[ 35.313195] [<ffffffff8026236a>] trace_hardirqs_on_caller+0xca/0x140
[ 35.313205] [<ffffffff8026ef4c>] sys_init_module+0xdc/0x210
[ 35.313212] [<ffffffff8020b7cb>] system_call_fastpath+0x16/0x1b
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index bd069349bcae..2ab3c12b88af 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -640,8 +640,11 @@ static int __init cpufreq_gov_dbs_init(void) | |||
640 | { | 640 | { |
641 | int err; | 641 | int err; |
642 | cputime64_t wall; | 642 | cputime64_t wall; |
643 | u64 idle_time = get_cpu_idle_time_us(smp_processor_id(), &wall); | 643 | u64 idle_time; |
644 | int cpu = get_cpu(); | ||
644 | 645 | ||
646 | idle_time = get_cpu_idle_time_us(cpu, &wall); | ||
647 | put_cpu(); | ||
645 | if (idle_time != -1ULL) { | 648 | if (idle_time != -1ULL) { |
646 | /* Idle micro accounting is supported. Use finer thresholds */ | 649 | /* Idle micro accounting is supported. Use finer thresholds */ |
647 | dbs_tuners_ins.up_threshold = MICRO_FREQUENCY_UP_THRESHOLD; | 650 | dbs_tuners_ins.up_threshold = MICRO_FREQUENCY_UP_THRESHOLD; |