When initialized, intel_pstate sets the maximum frequency of the CPU depending on the availability of the turbo, as indicated by MSR_IA32_MISC_ENABLE_TURBO_DISABLE. On some systems, the BIOS changes the value of MSR_IA32_MISC_ENABLE_TURBO_DISABLE at runtime (e.g., when the power source changes), but the maximum frequency of the CPU is not updated accordingly.
Created attachment 277747 [details] dmesg - intel_pstate=support_acpi_ppc dyndbg="file processor_perflib.c +p" dyndbg="file intel_pstate.c +p"
Here from the log, I see [ 14.890848] intel_pstate: cpu:0 max_perf_ratio:30 min_perf_ratio:8 # Unplug [ 25.775643] CPU 0: _PPC is 6 - frequency limited [ 25.775660] intel_pstate: set_policy cpuinfo.max 3000000 policy->max 1700000 [ 25.775666] intel_pstate: cpu:0 max_state 17 min_policy_perf:8 max_policy_perf:17 [ 25.775670] intel_pstate: cpu:0 global_min:8 global_max:30 [ 25.775674] intel_pstate: cpu:0 max_perf_ratio:17 min_perf_ratio:8 "REDUCED FREQUENCY ABOVE AFTER UNPLUG" # Re-plug [ 36.979264] CPU 0: _PPC is 6 - frequency limited [ 36.979276] intel_pstate: policy->max > max non turbo frequency [ 36.979280] intel_pstate: set_policy cpuinfo.max 3000000 policy->max 3000000 [ 36.979283] intel_pstate: cpu:0 max_state 30 min_policy_perf:8 max_policy_perf:30 [ 36.979286] intel_pstate: cpu:0 global_min:8 global_max:30 [ 36.979289] intel_pstate: cpu:0 max_perf_ratio:30 min_perf_ratio:8 "INCREASED FREQUENCY ABOVE AFTER REPLUG" So in this scenario it seems to work fine. Do you have dmesg when you booted unplugged and replugged?
Created attachment 277751 [details] dmesg - boot unplugged
Created attachment 277763 [details] Test Patch 001 to try Try this patch. Please use same kernel command line parameters as before with PPC and dyndbg.
Created attachment 277823 [details] dmesg - boot unplugged - patch 001
Created attachment 277825 [details] dmesg - boot plugged - patch 001 As the logs show, only cpu 0 is updated. This is the result: Boot=battery, current=AC $ grep "" /sys/devices/system/cpu/cpufreq/policy*/*_max_freq /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq:1700000 /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq:1700000 /sys/devices/system/cpu/cpufreq/policy1/cpuinfo_max_freq:3000000 /sys/devices/system/cpu/cpufreq/policy1/scaling_max_freq:3000000 /sys/devices/system/cpu/cpufreq/policy2/cpuinfo_max_freq:3000000 /sys/devices/system/cpu/cpufreq/policy2/scaling_max_freq:3000000 /sys/devices/system/cpu/cpufreq/policy3/cpuinfo_max_freq:3000000 /sys/devices/system/cpu/cpufreq/policy3/scaling_max_freq:3000000 Boot=AC, current=battery $ grep "" /sys/devices/system/cpu/cpufreq/policy*/*_max_freq /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq:3000000 /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq:3000000 /sys/devices/system/cpu/cpufreq/policy1/cpuinfo_max_freq:1700000 /sys/devices/system/cpu/cpufreq/policy1/scaling_max_freq:1700000 /sys/devices/system/cpu/cpufreq/policy2/cpuinfo_max_freq:1700000 /sys/devices/system/cpu/cpufreq/policy2/scaling_max_freq:1700000 /sys/devices/system/cpu/cpufreq/policy3/cpuinfo_max_freq:1700000 /sys/devices/system/cpu/cpufreq/policy3/scaling_max_freq:1700000
Need to discuss internally. The notification is arriving on one CPU only on this system.
(In reply to Srinivas Pandruvada from comment #7) > Need to discuss internally. The notification is arriving on one CPU only on > this system. How about sending ipi to all online CPUs to update their policies?
Then we need to update the policies within one package for them, I'll cook a patch based on Srinivas's.
Created attachment 280529 [details] update cpuinfo max frequency dynamically Could you please check this patch works for you?
cat /sys/devices/system/cpu/cpufreq/policy0/*_max_freq never terminates after changing power source (i.e., when the limit should change) using v4.20, while the other policy{1,2,3} values don't change. It seems that the cpufreq_update_policy(cpu) call your patch adds never ends. I haven't looked at what happens exactly yet.
(In reply to Gabriele Mazzotta from comment #11) > cat /sys/devices/system/cpu/cpufreq/policy0/*_max_freq never terminates > after changing power source (i.e., when the limit should change) using > v4.20, while the other policy{1,2,3} values don't change. > > It seems that the cpufreq_update_policy(cpu) call your patch adds never > ends. I haven't looked at what happens exactly yet. Thanks, how about using the following one, please boot with and without: "processor.broadcast_ppc=1" and check if it works.
Created attachment 280651 [details] update cpuinfo max frequency for all cpus Please apply this patch instead.
Created attachment 280787 [details] Merged patches The patch I attached works. It is simply a merge of your patch and Srinivas' patch. Both cpuinfo_max_freq and scaling_max_freq of all the CPUs are updated according to the current power source.
Patches from Rafael: https://patchwork.kernel.org/project/linux-pm/list/?series=87789