Эх сурвалжийг харах

HOTPLUG: Adapt thermal throttle to CPU_DYING

CPU_DYING is notified in atomic context, so no taking mutexes here.

Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity 18 жил өмнө
parent
commit
38ef6d195f

+ 4 - 2
arch/i386/kernel/cpu/mcheck/therm_throt.c

@@ -134,19 +134,21 @@ static __cpuinit int thermal_throttle_cpu_callback(struct notifier_block *nfb,
 	int err;
 	int err;
 
 
 	sys_dev = get_cpu_sysdev(cpu);
 	sys_dev = get_cpu_sysdev(cpu);
-	mutex_lock(&therm_cpu_lock);
 	switch (action) {
 	switch (action) {
 	case CPU_ONLINE:
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
 	case CPU_ONLINE_FROZEN:
+		mutex_lock(&therm_cpu_lock);
 		err = thermal_throttle_add_dev(sys_dev);
 		err = thermal_throttle_add_dev(sys_dev);
+		mutex_unlock(&therm_cpu_lock);
 		WARN_ON(err);
 		WARN_ON(err);
 		break;
 		break;
 	case CPU_DEAD:
 	case CPU_DEAD:
 	case CPU_DEAD_FROZEN:
 	case CPU_DEAD_FROZEN:
+		mutex_lock(&therm_cpu_lock);
 		thermal_throttle_remove_dev(sys_dev);
 		thermal_throttle_remove_dev(sys_dev);
+		mutex_unlock(&therm_cpu_lock);
 		break;
 		break;
 	}
 	}
-	mutex_unlock(&therm_cpu_lock);
 	return NOTIFY_OK;
 	return NOTIFY_OK;
 }
 }