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

Configure Feed

Select the types of activity you want to include in your feed.

Merge back earlier cpufreq material for 7.1

+72 -73
+2 -1
drivers/acpi/cppc_acpi.c
··· 1944 1944 } 1945 1945 1946 1946 /* Look up the max frequency in DMI */ 1947 - static u64 cppc_get_dmi_max_khz(void) 1947 + u64 cppc_get_dmi_max_khz(void) 1948 1948 { 1949 1949 u16 mhz = 0; 1950 1950 ··· 1958 1958 1959 1959 return KHZ_PER_MHZ * mhz; 1960 1960 } 1961 + EXPORT_SYMBOL_GPL(cppc_get_dmi_max_khz); 1961 1962 1962 1963 /* 1963 1964 * If CPPC lowest_freq and nominal_freq registers are exposed then we can
+2 -3
drivers/cpufreq/Kconfig
··· 163 163 164 164 config CPU_FREQ_GOV_CONSERVATIVE 165 165 tristate "'conservative' cpufreq governor" 166 - depends on CPU_FREQ 167 166 select CPU_FREQ_GOV_COMMON 168 167 help 169 168 'conservative' - this driver is rather similar to the 'ondemand' ··· 187 188 188 189 config CPU_FREQ_GOV_SCHEDUTIL 189 190 bool "'schedutil' cpufreq policy governor" 190 - depends on CPU_FREQ && SMP 191 + depends on SMP 191 192 select CPU_FREQ_GOV_ATTR_SET 192 193 select IRQ_WORK 193 194 help ··· 364 365 365 366 If in doubt, say N. 366 367 367 - endif 368 + endif # CPU_FREQ 368 369 369 370 endmenu
+24 -7
drivers/cpufreq/acpi-cpufreq.c
··· 675 675 } 676 676 #endif 677 677 678 + static void acpi_cpufreq_resolve_max_freq(struct cpufreq_policy *policy, 679 + unsigned int pss_max_freq) 680 + { 681 + #ifdef CONFIG_ACPI_CPPC_LIB 682 + u64 max_speed = cppc_get_dmi_max_khz(); 683 + /* 684 + * Use DMI "Max Speed" if it looks plausible: must be 685 + * above _PSS P0 frequency and within 2x of it. 686 + */ 687 + if (max_speed > pss_max_freq && max_speed < pss_max_freq * 2) { 688 + policy->cpuinfo.max_freq = max_speed; 689 + return; 690 + } 691 + #endif 692 + /* 693 + * If the maximum "boost" frequency is unknown, ask the arch 694 + * scale-invariance code to use the "nominal" performance for 695 + * CPU utilization scaling so as to prevent the schedutil 696 + * governor from selecting inadequate CPU frequencies. 697 + */ 698 + arch_set_max_freq_ratio(true); 699 + } 700 + 678 701 static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) 679 702 { 680 703 struct cpufreq_frequency_table *freq_table; ··· 872 849 873 850 policy->cpuinfo.max_freq = freq * max_boost_ratio >> SCHED_CAPACITY_SHIFT; 874 851 } else { 875 - /* 876 - * If the maximum "boost" frequency is unknown, ask the arch 877 - * scale-invariance code to use the "nominal" performance for 878 - * CPU utilization scaling so as to prevent the schedutil 879 - * governor from selecting inadequate CPU frequencies. 880 - */ 881 - arch_set_max_freq_ratio(true); 852 + acpi_cpufreq_resolve_max_freq(policy, freq_table[0].frequency); 882 853 } 883 854 884 855 policy->freq_table = freq_table;
-2
drivers/cpufreq/amd-pstate.c
··· 769 769 else if (policy->cpuinfo.max_freq > nominal_freq) 770 770 policy->cpuinfo.max_freq = nominal_freq; 771 771 772 - policy->max = policy->cpuinfo.max_freq; 773 - 774 772 if (cppc_state == AMD_PSTATE_PASSIVE) { 775 773 ret = freq_qos_update_request(&cpudata->req[1], policy->cpuinfo.max_freq); 776 774 if (ret < 0)
+2 -8
drivers/cpufreq/cppc_cpufreq.c
··· 807 807 { 808 808 struct cppc_cpudata *cpu_data = policy->driver_data; 809 809 struct cppc_perf_caps *caps = &cpu_data->perf_caps; 810 - int ret; 811 810 812 811 if (state) 813 - policy->max = cppc_perf_to_khz(caps, caps->highest_perf); 812 + policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, caps->highest_perf); 814 813 else 815 - policy->max = cppc_perf_to_khz(caps, caps->nominal_perf); 816 - policy->cpuinfo.max_freq = policy->max; 817 - 818 - ret = freq_qos_update_request(policy->max_freq_req, policy->max); 819 - if (ret < 0) 820 - return ret; 814 + policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, caps->nominal_perf); 821 815 822 816 return 0; 823 817 }
+33 -46
drivers/cpufreq/cpufreq.c
··· 609 609 policy->boost_enabled = enable; 610 610 611 611 ret = cpufreq_driver->set_boost(policy, enable); 612 - if (ret) 612 + if (ret) { 613 613 policy->boost_enabled = !policy->boost_enabled; 614 + return ret; 615 + } 614 616 615 - return ret; 617 + ret = freq_qos_update_request(&policy->boost_freq_req, policy->cpuinfo.max_freq); 618 + if (ret < 0) { 619 + policy->boost_enabled = !policy->boost_enabled; 620 + cpufreq_driver->set_boost(policy, policy->boost_enabled); 621 + return ret; 622 + } 623 + 624 + return 0; 616 625 } 617 626 618 627 static ssize_t store_local_boost(struct cpufreq_policy *policy, ··· 769 760 if (ret) \ 770 761 return ret; \ 771 762 \ 772 - ret = freq_qos_update_request(policy->object##_freq_req, val);\ 763 + ret = freq_qos_update_request(&policy->object##_freq_req, val); \ 773 764 return ret >= 0 ? count : ret; \ 774 765 } 775 766 ··· 1374 1365 /* Cancel any pending policy->update work before freeing the policy. */ 1375 1366 cancel_work_sync(&policy->update); 1376 1367 1377 - if (policy->max_freq_req) { 1368 + if (freq_qos_request_active(&policy->max_freq_req)) { 1378 1369 /* 1379 1370 * Remove max_freq_req after sending CPUFREQ_REMOVE_POLICY 1380 1371 * notification, since CPUFREQ_CREATE_POLICY notification was ··· 1382 1373 */ 1383 1374 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 1384 1375 CPUFREQ_REMOVE_POLICY, policy); 1385 - freq_qos_remove_request(policy->max_freq_req); 1376 + freq_qos_remove_request(&policy->max_freq_req); 1386 1377 } 1387 1378 1388 - freq_qos_remove_request(policy->min_freq_req); 1389 - kfree(policy->min_freq_req); 1379 + if (freq_qos_request_active(&policy->min_freq_req)) 1380 + freq_qos_remove_request(&policy->min_freq_req); 1381 + if (freq_qos_request_active(&policy->boost_freq_req)) 1382 + freq_qos_remove_request(&policy->boost_freq_req); 1390 1383 1391 1384 cpufreq_policy_put_kobj(policy); 1392 1385 free_cpumask_var(policy->real_cpus); ··· 1458 1447 add_cpu_dev_symlink(policy, j, get_cpu_device(j)); 1459 1448 } 1460 1449 1461 - policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req), 1462 - GFP_KERNEL); 1463 - if (!policy->min_freq_req) { 1464 - ret = -ENOMEM; 1465 - goto out_destroy_policy; 1450 + if (policy->boost_supported) { 1451 + ret = freq_qos_add_request(&policy->constraints, 1452 + &policy->boost_freq_req, 1453 + FREQ_QOS_MAX, 1454 + policy->cpuinfo.max_freq); 1455 + if (ret < 0) 1456 + goto out_destroy_policy; 1466 1457 } 1467 1458 1468 1459 ret = freq_qos_add_request(&policy->constraints, 1469 - policy->min_freq_req, FREQ_QOS_MIN, 1460 + &policy->min_freq_req, FREQ_QOS_MIN, 1470 1461 FREQ_QOS_MIN_DEFAULT_VALUE); 1471 - if (ret < 0) { 1472 - /* 1473 - * So we don't call freq_qos_remove_request() for an 1474 - * uninitialized request. 1475 - */ 1476 - kfree(policy->min_freq_req); 1477 - policy->min_freq_req = NULL; 1462 + if (ret < 0) 1478 1463 goto out_destroy_policy; 1479 - } 1480 - 1481 - /* 1482 - * This must be initialized right here to avoid calling 1483 - * freq_qos_remove_request() on uninitialized request in case 1484 - * of errors. 1485 - */ 1486 - policy->max_freq_req = policy->min_freq_req + 1; 1487 1464 1488 1465 ret = freq_qos_add_request(&policy->constraints, 1489 - policy->max_freq_req, FREQ_QOS_MAX, 1466 + &policy->max_freq_req, FREQ_QOS_MAX, 1490 1467 FREQ_QOS_MAX_DEFAULT_VALUE); 1491 - if (ret < 0) { 1492 - policy->max_freq_req = NULL; 1468 + if (ret < 0) 1493 1469 goto out_destroy_policy; 1494 - } 1495 1470 1496 1471 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 1497 1472 CPUFREQ_CREATE_POLICY, policy); 1498 - } else { 1499 - ret = freq_qos_update_request(policy->max_freq_req, policy->max); 1500 - if (ret < 0) 1501 - goto out_destroy_policy; 1502 1473 } 1503 1474 1504 1475 if (cpufreq_driver->get && has_target()) { ··· 2357 2364 target_freq = __resolve_freq(policy, target_freq, policy->min, 2358 2365 policy->max, relation); 2359 2366 2360 - pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", 2361 - policy->cpu, target_freq, relation, old_target_freq); 2367 + pr_debug("CPU %u: cur %u kHz -> target %u kHz (req %u kHz, rel %u)\n", 2368 + policy->cpu, policy->cur, target_freq, old_target_freq, relation); 2362 2369 2363 2370 /* 2364 2371 * This might look like a redundant call as we are checking it again ··· 2782 2789 return -ENXIO; 2783 2790 2784 2791 ret = cpufreq_frequency_table_cpuinfo(policy); 2785 - if (ret) { 2792 + if (ret) 2786 2793 pr_err("%s: Policy frequency update failed\n", __func__); 2787 - return ret; 2788 - } 2789 2794 2790 - ret = freq_qos_update_request(policy->max_freq_req, policy->max); 2791 - if (ret < 0) 2792 - return ret; 2793 - 2794 - return 0; 2795 + return ret; 2795 2796 } 2796 2797 EXPORT_SYMBOL_GPL(cpufreq_boost_set_sw); 2797 2798
+3 -2
drivers/cpufreq/cpufreq_governor.h
··· 21 21 #include <linux/kernel_stat.h> 22 22 #include <linux/module.h> 23 23 #include <linux/mutex.h> 24 + #include <linux/sysfs.h> 24 25 25 26 /* Ondemand Sampling types */ 26 27 enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE}; ··· 58 57 { \ 59 58 struct dbs_data *dbs_data = to_dbs_data(attr_set); \ 60 59 struct _gov##_dbs_tuners *tuners = dbs_data->tuners; \ 61 - return sprintf(buf, "%u\n", tuners->file_name); \ 60 + return sysfs_emit(buf, "%u\n", tuners->file_name); \ 62 61 } 63 62 64 63 #define gov_show_one_common(file_name) \ ··· 66 65 (struct gov_attr_set *attr_set, char *buf) \ 67 66 { \ 68 67 struct dbs_data *dbs_data = to_dbs_data(attr_set); \ 69 - return sprintf(buf, "%u\n", dbs_data->file_name); \ 68 + return sysfs_emit(buf, "%u\n", dbs_data->file_name); \ 70 69 } 71 70 72 71 #define gov_attr_ro(_name) \
+1 -1
drivers/cpufreq/intel_pstate.c
··· 3472 3472 { 3473 3473 if (size == 3 && !strncmp(buf, "off", size)) { 3474 3474 if (!intel_pstate_driver) 3475 - return -EINVAL; 3475 + return 0; 3476 3476 3477 3477 if (hwp_active) 3478 3478 return -EBUSY;
+1
include/acpi/cppc_acpi.h
··· 156 156 extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps); 157 157 extern bool cppc_perf_ctrs_in_pcc_cpu(unsigned int cpu); 158 158 extern bool cppc_perf_ctrs_in_pcc(void); 159 + extern u64 cppc_get_dmi_max_khz(void); 159 160 extern unsigned int cppc_perf_to_khz(struct cppc_perf_caps *caps, unsigned int perf); 160 161 extern unsigned int cppc_khz_to_perf(struct cppc_perf_caps *caps, unsigned int freq); 161 162 extern bool acpi_cpc_valid(void);
+4 -3
include/linux/cpufreq.h
··· 79 79 * called, but you're in IRQ context */ 80 80 81 81 struct freq_constraints constraints; 82 - struct freq_qos_request *min_freq_req; 83 - struct freq_qos_request *max_freq_req; 82 + struct freq_qos_request min_freq_req; 83 + struct freq_qos_request max_freq_req; 84 + struct freq_qos_request boost_freq_req; 84 85 85 86 struct cpufreq_frequency_table *freq_table; 86 87 enum cpufreq_table_sorting freq_table_sorted; ··· 233 232 234 233 static inline bool policy_is_shared(struct cpufreq_policy *policy) 235 234 { 236 - return cpumask_weight(policy->cpus) > 1; 235 + return cpumask_nth(1, policy->cpus) < nr_cpumask_bits; 237 236 } 238 237 239 238 #ifdef CONFIG_CPU_FREQ