[PATCH] cpufreq: call nr_iowait_cpu with disabled preemption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fix complain from preemptive debug

BUG: using smp_processor_id() in preemptible [00000000] code: S06cpuspeed/655
caller is nr_iowait_cpu+0x1a/0x30
Pid: 655, comm: S06cpuspeed Not tainted 2.6.34-quota-cleanups #46
Call Trace:
 [<ffffffff812de2ae>] debug_smp_processor_id+0xc2/0xdc
 [<ffffffff8102baea>] nr_iowait_cpu+0x1a/0x30
 [<ffffffff810671b3>] update_ts_time_stats+0x3c/0x77
 [<ffffffff81062894>] ? ktime_get+0x5e/0x98
 [<ffffffff8106737c>] get_cpu_idle_time_us+0x49/0x68
 [<ffffffffa004d4d1>] get_cpu_idle_time+0x21/0xa9 [cpufreq_ondemand]
 [<ffffffffa004dc7f>] cpufreq_governor_dbs+0xcd/0x316 [cpufreq_ondemand]
 [<ffffffff813d6b46>] __cpufreq_governor+0x89/0xc7
 [<ffffffff813d7936>] __cpufreq_set_policy+0x1ad/0x227
 [<ffffffff813d7dee>] store_scaling_governor+0x1a0/0x1e8
 [<ffffffff813d8058>] ? handle_update+0x0/0x38

Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
---
 drivers/cpufreq/cpufreq_ondemand.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index e131421..c1b1a96 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -363,6 +363,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
 	dbs_tuners_ins.ignore_nice = input;
 
 	/* we need to re-evaluate prev_cpu_idle */
+	get_cpu();
 	for_each_online_cpu(j) {
 		struct cpu_dbs_info_s *dbs_info;
 		dbs_info = &per_cpu(od_cpu_dbs_info, j);
@@ -372,6 +373,7 @@ static ssize_t store_ignore_nice_load(struct kobject *a, struct attribute *b,
 			dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
 
 	}
+	put_cpu();
 	mutex_unlock(&dbs_mutex);
 
 	return count;
@@ -493,9 +495,10 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
 		j_dbs_info = &per_cpu(od_cpu_dbs_info, j);
 
+		get_cpu();
 		cur_idle_time = get_cpu_idle_time(j, &cur_wall_time);
 		cur_iowait_time = get_cpu_iowait_time(j, &cur_wall_time);
-
+		put_cpu();
 		wall_time = (unsigned int) cputime64_sub(cur_wall_time,
 				j_dbs_info->prev_cpu_wall);
 		j_dbs_info->prev_cpu_wall = cur_wall_time;
@@ -695,6 +698,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
 		}
 
 		dbs_enable++;
+		get_cpu();
 		for_each_cpu(j, policy->cpus) {
 			struct cpu_dbs_info_s *j_dbs_info;
 			j_dbs_info = &per_cpu(od_cpu_dbs_info, j);
@@ -708,6 +712,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
 			}
 		}
 		this_dbs_info->cpu = cpu;
+		put_cpu();
 		ondemand_powersave_bias_init_cpu(cpu);
 		/*
 		 * Start the timerschedule work, when this governor
-- 
1.6.6.1

--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux