@@ -1943,13 +1943,10 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
case CPU_ONLINE:
cpufreq_add_dev(dev, NULL);
break;
- case CPU_DOWN_PREPARE:
+ case CPU_POST_DEAD:
case CPU_UP_CANCELED_FROZEN:
__cpufreq_remove_dev(dev, NULL);
break;
- case CPU_DOWN_FAILED:
- cpufreq_add_dev(dev, NULL);
- break;
}
}
return NOTIFY_OK;
@@ -125,7 +125,11 @@ static inline void __gov_queue_work(int cpu, struct dbs_data *dbs_data,
unsigned int delay)
{
struct cpu_dbs_common_info *cdbs = dbs_data->cdata->get_cpu_cdbs(cpu);
-
+ /* cpu offline might block existing gov_queue_work() user,
+ * unblocking it after CPU_DEAD and before CPU_POST_DEAD.
+ * thus potentially we can hit offlined CPU */
+ if (unlikely(cpu_is_offline(cpu)))
+ return;
mod_delayed_work_on(cpu, system_wq, &cdbs->work, delay);
}
@@ -133,15 +137,14 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy,
unsigned int delay, bool all_cpus)
{
int i;
-
+ get_online_cpus();
if (!all_cpus) {
__gov_queue_work(smp_processor_id(), dbs_data, delay);
} else {
- get_online_cpus();
for_each_cpu(i, policy->cpus)
__gov_queue_work(i, dbs_data, delay);
- put_online_cpus();
}
+ put_online_cpus();
}
EXPORT_SYMBOL_GPL(gov_queue_work);
@@ -354,8 +357,10 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
/* Initiate timer time stamp */
cpu_cdbs->time_stamp = ktime_get();
- gov_queue_work(dbs_data, policy,
- delay_for_sampling_rate(sampling_rate), true);
+ /* hotplug lock already held */
+ for_each_cpu(j, policy->cpus)
+ __gov_queue_work(j, dbs_data,
+ delay_for_sampling_rate(sampling_rate));
break;
case CPUFREQ_GOV_STOP:
@@ -355,7 +355,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
case CPU_DOWN_PREPARE:
cpufreq_stats_free_sysfs(cpu);
break;
- case CPU_DEAD:
+ case CPU_POST_DEAD:
cpufreq_stats_free_table(cpu);
break;
case CPU_UP_CANCELED_FROZEN: