Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pm-6.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fix from Rafael Wysocki:
"Fix a locking issue in the asymmetric CPU capacity setup code in the
intel_pstate driver that may lead to a deadlock if CPU online/offline
runs in parallel with the code in question, which is unlikely but not
impossible (Rafael Wysocki)"

* tag 'pm-6.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpufreq: intel_pstate: Rearrange locking in hybrid_init_cpu_capacity_scaling()

+17 -20
+17 -20
drivers/cpufreq/intel_pstate.c
··· 1028 1028 } 1029 1029 } 1030 1030 1031 - static void __hybrid_init_cpu_capacity_scaling(void) 1031 + static void __hybrid_refresh_cpu_capacity_scaling(void) 1032 1032 { 1033 1033 hybrid_max_perf_cpu = NULL; 1034 1034 hybrid_update_cpu_capacity_scaling(); 1035 1035 } 1036 1036 1037 + static void hybrid_refresh_cpu_capacity_scaling(void) 1038 + { 1039 + guard(mutex)(&hybrid_capacity_lock); 1040 + 1041 + __hybrid_refresh_cpu_capacity_scaling(); 1042 + } 1043 + 1037 1044 static void hybrid_init_cpu_capacity_scaling(bool refresh) 1038 1045 { 1039 - bool disable_itmt = false; 1040 - 1041 - mutex_lock(&hybrid_capacity_lock); 1042 - 1043 1046 /* 1044 1047 * If hybrid_max_perf_cpu is set at this point, the hybrid CPU capacity 1045 1048 * scaling has been enabled already and the driver is just changing the 1046 1049 * operation mode. 1047 1050 */ 1048 1051 if (refresh) { 1049 - __hybrid_init_cpu_capacity_scaling(); 1050 - goto unlock; 1052 + hybrid_refresh_cpu_capacity_scaling(); 1053 + return; 1051 1054 } 1052 1055 1053 1056 /* ··· 1059 1056 * do not do that when SMT is in use. 1060 1057 */ 1061 1058 if (hwp_is_hybrid && !sched_smt_active() && arch_enable_hybrid_capacity_scale()) { 1062 - __hybrid_init_cpu_capacity_scaling(); 1063 - disable_itmt = true; 1064 - } 1065 - 1066 - unlock: 1067 - mutex_unlock(&hybrid_capacity_lock); 1068 - 1069 - /* 1070 - * Disabling ITMT causes sched domains to be rebuilt to disable asym 1071 - * packing and enable asym capacity. 1072 - */ 1073 - if (disable_itmt) 1059 + hybrid_refresh_cpu_capacity_scaling(); 1060 + /* 1061 + * Disabling ITMT causes sched domains to be rebuilt to disable asym 1062 + * packing and enable asym capacity. 1063 + */ 1074 1064 sched_clear_itmt_support(); 1065 + } 1075 1066 } 1076 1067 1077 1068 static bool hybrid_clear_max_perf_cpu(void) ··· 1401 1404 mutex_lock(&hybrid_capacity_lock); 1402 1405 1403 1406 if (hybrid_max_perf_cpu) 1404 - __hybrid_init_cpu_capacity_scaling(); 1407 + __hybrid_refresh_cpu_capacity_scaling(); 1405 1408 1406 1409 mutex_unlock(&hybrid_capacity_lock); 1407 1410 }