summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-01 14:35:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-01 14:35:12 -0400
commitf390b7bffdfef1ff552632cad41134e67b2b5684 (patch)
tree9a9e4494e5c4bc853eb5d98c7cc104df77a45486
parentcdbb65c4c7ead680ebe54f4f0d486e2847a500ea (diff)
parent9b7c19e96cededec6b0435933adefbd56cad37ab (diff)
Merge tag 'pm-urgent-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix the scope of a recent intel_pstate driver optimization used incorrectly on some systems due to processor identification ambiguity and fix a few issues in the turbostat utility, including three recent regressions. Specifics: - Use ACPI FADT preferred PM Profile to distinguish Skylake desktop processors from some server ones with the same model number in order to limit the scope of the recent IO-wait boost optimization to servers, as intended (Srinivas Pandruvada). - Fix several issues in the turbostat utility: * Fix the -S option on 1-CPU systems (Len Brown). * Fix computations using incorrect processor core counts (Artem Bityutskiy). * Fix the x2apic debug message (Len Brown). * Fix logical node enumeration to allow for non-sequential physical nodes (Prarit Bhargava). * Fix reported family on modern AMD processors (Calvin Walton). * Clarify the RAPL column information in the man page (Len Brown)" * tag 'pm-urgent-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: intel_pstate: Limit the scope of HWP dynamic boost platforms tools/power turbostat: version 18.07.27 tools/power turbostat: Read extended processor family from CPUID tools/power turbostat: Fix logical node enumeration to allow for non-sequential physical nodes tools/power turbostat: fix x2apic debug message output file tools/power turbostat: fix bogus summary values tools/power turbostat: fix -S on UP systems tools/power turbostat: Update turbostat(8) RAPL throttling column description
-rw-r--r--drivers/cpufreq/intel_pstate.c17
-rw-r--r--tools/power/x86/turbostat/turbostat.84
-rw-r--r--tools/power/x86/turbostat/turbostat.c120
3 files changed, 74 insertions, 67 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 3c3971256130..d4ed0022b0dd 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -311,12 +311,20 @@ static DEFINE_MUTEX(intel_pstate_limits_lock);
311 311
312#ifdef CONFIG_ACPI 312#ifdef CONFIG_ACPI
313 313
314static bool intel_pstate_get_ppc_enable_status(void) 314static bool intel_pstate_acpi_pm_profile_server(void)
315{ 315{
316 if (acpi_gbl_FADT.preferred_profile == PM_ENTERPRISE_SERVER || 316 if (acpi_gbl_FADT.preferred_profile == PM_ENTERPRISE_SERVER ||
317 acpi_gbl_FADT.preferred_profile == PM_PERFORMANCE_SERVER) 317 acpi_gbl_FADT.preferred_profile == PM_PERFORMANCE_SERVER)
318 return true; 318 return true;
319 319
320 return false;
321}
322
323static bool intel_pstate_get_ppc_enable_status(void)
324{
325 if (intel_pstate_acpi_pm_profile_server())
326 return true;
327
320 return acpi_ppc; 328 return acpi_ppc;
321} 329}
322 330
@@ -459,6 +467,11 @@ static inline void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *pol
459static inline void intel_pstate_exit_perf_limits(struct cpufreq_policy *policy) 467static inline void intel_pstate_exit_perf_limits(struct cpufreq_policy *policy)
460{ 468{
461} 469}
470
471static inline bool intel_pstate_acpi_pm_profile_server(void)
472{
473 return false;
474}
462#endif 475#endif
463 476
464static inline void update_turbo_state(void) 477static inline void update_turbo_state(void)
@@ -1841,7 +1854,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
1841 intel_pstate_hwp_enable(cpu); 1854 intel_pstate_hwp_enable(cpu);
1842 1855
1843 id = x86_match_cpu(intel_pstate_hwp_boost_ids); 1856 id = x86_match_cpu(intel_pstate_hwp_boost_ids);
1844 if (id) 1857 if (id && intel_pstate_acpi_pm_profile_server())
1845 hwp_boost = true; 1858 hwp_boost = true;
1846 } 1859 }
1847 1860
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index d39e4ff7d0bf..a6db83a88e85 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -106,7 +106,7 @@ The system configuration dump (if --quiet is not used) is followed by statistics
106\fBC1%, C2%, C3%\fP The residency percentage that Linux requested C1, C2, C3.... The system summary is the average of all CPUs in the system. Note that these are software, reflecting what was requested. The hardware counters reflect what was actually achieved. 106\fBC1%, C2%, C3%\fP The residency percentage that Linux requested C1, C2, C3.... The system summary is the average of all CPUs in the system. Note that these are software, reflecting what was requested. The hardware counters reflect what was actually achieved.
107\fBCPU%c1, CPU%c3, CPU%c6, CPU%c7\fP show the percentage residency in hardware core idle states. These numbers are from hardware residency counters. 107\fBCPU%c1, CPU%c3, CPU%c6, CPU%c7\fP show the percentage residency in hardware core idle states. These numbers are from hardware residency counters.
108\fBCoreTmp\fP Degrees Celsius reported by the per-core Digital Thermal Sensor. 108\fBCoreTmp\fP Degrees Celsius reported by the per-core Digital Thermal Sensor.
109\fBPkgTtmp\fP Degrees Celsius reported by the per-package Package Thermal Monitor. 109\fBPkgTmp\fP Degrees Celsius reported by the per-package Package Thermal Monitor.
110\fBGFX%rc6\fP The percentage of time the GPU is in the "render C6" state, rc6, during the measurement interval. From /sys/class/drm/card0/power/rc6_residency_ms. 110\fBGFX%rc6\fP The percentage of time the GPU is in the "render C6" state, rc6, during the measurement interval. From /sys/class/drm/card0/power/rc6_residency_ms.
111\fBGFXMHz\fP Instantaneous snapshot of what sysfs presents at the end of the measurement interval. From /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz. 111\fBGFXMHz\fP Instantaneous snapshot of what sysfs presents at the end of the measurement interval. From /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz.
112\fBPkg%pc2, Pkg%pc3, Pkg%pc6, Pkg%pc7\fP percentage residency in hardware package idle states. These numbers are from hardware residency counters. 112\fBPkg%pc2, Pkg%pc3, Pkg%pc6, Pkg%pc7\fP percentage residency in hardware package idle states. These numbers are from hardware residency counters.
@@ -114,7 +114,7 @@ The system configuration dump (if --quiet is not used) is followed by statistics
114\fBCorWatt\fP Watts consumed by the core part of the package. 114\fBCorWatt\fP Watts consumed by the core part of the package.
115\fBGFXWatt\fP Watts consumed by the Graphics part of the package -- available only on client processors. 115\fBGFXWatt\fP Watts consumed by the Graphics part of the package -- available only on client processors.
116\fBRAMWatt\fP Watts consumed by the DRAM DIMMS -- available only on server processors. 116\fBRAMWatt\fP Watts consumed by the DRAM DIMMS -- available only on server processors.
117\fBPKG_%\fP percent of the interval that RAPL throttling was active on the Package. 117\fBPKG_%\fP percent of the interval that RAPL throttling was active on the Package. Note that the system summary is the sum of the package throttling time, and thus may be higher than 100% on a multi-package system. Note that the meaning of this field is model specific. For example, some hardware increments this counter when RAPL responds to thermal limits, but does not increment this counter when RAPL responds to power limits. Comparing PkgWatt and PkgTmp to system limits is necessary.
118\fBRAM_%\fP percent of the interval that RAPL throttling was active on DRAM. 118\fBRAM_%\fP percent of the interval that RAPL throttling was active on DRAM.
119.fi 119.fi
120.SH TOO MUCH INFORMATION EXAMPLE 120.SH TOO MUCH INFORMATION EXAMPLE
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 4d14bbbf9b63..980bd9d20646 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -1163,9 +1163,7 @@ void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_
1163 if (!printed || !summary_only) 1163 if (!printed || !summary_only)
1164 print_header("\t"); 1164 print_header("\t");
1165 1165
1166 if (topo.num_cpus > 1) 1166 format_counters(&average.threads, &average.cores, &average.packages);
1167 format_counters(&average.threads, &average.cores,
1168 &average.packages);
1169 1167
1170 printed = 1; 1168 printed = 1;
1171 1169
@@ -1692,7 +1690,7 @@ void get_apic_id(struct thread_data *t)
1692 t->x2apic_id = edx; 1690 t->x2apic_id = edx;
1693 1691
1694 if (debug && (t->apic_id != t->x2apic_id)) 1692 if (debug && (t->apic_id != t->x2apic_id))
1695 fprintf(stderr, "cpu%d: apic 0x%x x2apic 0x%x\n", t->cpu_id, t->apic_id, t->x2apic_id); 1693 fprintf(outf, "cpu%d: apic 0x%x x2apic 0x%x\n", t->cpu_id, t->apic_id, t->x2apic_id);
1696} 1694}
1697 1695
1698/* 1696/*
@@ -2473,55 +2471,43 @@ int get_core_id(int cpu)
2473 2471
2474void set_node_data(void) 2472void set_node_data(void)
2475{ 2473{
2476 char path[80]; 2474 int pkg, node, lnode, cpu, cpux;
2477 FILE *filep; 2475 int cpu_count;
2478 int pkg, node, cpu; 2476
2479 2477 /* initialize logical_node_id */
2480 struct pkg_node_info { 2478 for (cpu = 0; cpu <= topo.max_cpu_num; ++cpu)
2481 int count; 2479 cpus[cpu].logical_node_id = -1;
2482 int min; 2480
2483 } *pni; 2481 cpu_count = 0;
2484 2482 for (pkg = 0; pkg < topo.num_packages; pkg++) {
2485 pni = calloc(topo.num_packages, sizeof(struct pkg_node_info)); 2483 lnode = 0;
2486 if (!pni) 2484 for (cpu = 0; cpu <= topo.max_cpu_num; ++cpu) {
2487 err(1, "calloc pkg_node_count"); 2485 if (cpus[cpu].physical_package_id != pkg)
2488 2486 continue;
2489 for (pkg = 0; pkg < topo.num_packages; pkg++) 2487 /* find a cpu with an unset logical_node_id */
2490 pni[pkg].min = topo.num_cpus; 2488 if (cpus[cpu].logical_node_id != -1)
2491 2489 continue;
2492 for (node = 0; node <= topo.max_node_num; node++) { 2490 cpus[cpu].logical_node_id = lnode;
2493 /* find the "first" cpu in the node */ 2491 node = cpus[cpu].physical_node_id;
2494 sprintf(path, "/sys/bus/node/devices/node%d/cpulist", node); 2492 cpu_count++;
2495 filep = fopen(path, "r"); 2493 /*
2496 if (!filep) 2494 * find all matching cpus on this pkg and set
2497 continue; 2495 * the logical_node_id
2498 fscanf(filep, "%d", &cpu); 2496 */
2499 fclose(filep); 2497 for (cpux = cpu; cpux <= topo.max_cpu_num; cpux++) {
2500 2498 if ((cpus[cpux].physical_package_id == pkg) &&
2501 pkg = cpus[cpu].physical_package_id; 2499 (cpus[cpux].physical_node_id == node)) {
2502 pni[pkg].count++; 2500 cpus[cpux].logical_node_id = lnode;
2503 2501 cpu_count++;
2504 if (node < pni[pkg].min) 2502 }
2505 pni[pkg].min = node; 2503 }
2506 } 2504 lnode++;
2507 2505 if (lnode > topo.nodes_per_pkg)
2508 for (pkg = 0; pkg < topo.num_packages; pkg++) 2506 topo.nodes_per_pkg = lnode;
2509 if (pni[pkg].count > topo.nodes_per_pkg) 2507 }
2510 topo.nodes_per_pkg = pni[0].count; 2508 if (cpu_count >= topo.max_cpu_num)
2511 2509 break;
2512 /* Fake 1 node per pkg for machines that don't
2513 * expose nodes and thus avoid -nan results
2514 */
2515 if (topo.nodes_per_pkg == 0)
2516 topo.nodes_per_pkg = 1;
2517
2518 for (cpu = 0; cpu < topo.num_cpus; cpu++) {
2519 pkg = cpus[cpu].physical_package_id;
2520 node = cpus[cpu].physical_node_id;
2521 cpus[cpu].logical_node_id = node - pni[pkg].min;
2522 } 2510 }
2523 free(pni);
2524
2525} 2511}
2526 2512
2527int get_physical_node_id(struct cpu_topology *thiscpu) 2513int get_physical_node_id(struct cpu_topology *thiscpu)
@@ -4471,7 +4457,9 @@ void process_cpuid()
4471 family = (fms >> 8) & 0xf; 4457 family = (fms >> 8) & 0xf;
4472 model = (fms >> 4) & 0xf; 4458 model = (fms >> 4) & 0xf;
4473 stepping = fms & 0xf; 4459 stepping = fms & 0xf;
4474 if (family == 6 || family == 0xf) 4460 if (family == 0xf)
4461 family += (fms >> 20) & 0xff;
4462 if (family >= 6)
4475 model += ((fms >> 16) & 0xf) << 4; 4463 model += ((fms >> 16) & 0xf) << 4;
4476 4464
4477 if (!quiet) { 4465 if (!quiet) {
@@ -4840,16 +4828,8 @@ void topology_probe()
4840 siblings = get_thread_siblings(&cpus[i]); 4828 siblings = get_thread_siblings(&cpus[i]);
4841 if (siblings > max_siblings) 4829 if (siblings > max_siblings)
4842 max_siblings = siblings; 4830 max_siblings = siblings;
4843 if (cpus[i].thread_id != -1) 4831 if (cpus[i].thread_id == 0)
4844 topo.num_cores++; 4832 topo.num_cores++;
4845
4846 if (debug > 1)
4847 fprintf(outf,
4848 "cpu %d pkg %d node %d core %d thread %d\n",
4849 i, cpus[i].physical_package_id,
4850 cpus[i].physical_node_id,
4851 cpus[i].physical_core_id,
4852 cpus[i].thread_id);
4853 } 4833 }
4854 4834
4855 topo.cores_per_node = max_core_id + 1; 4835 topo.cores_per_node = max_core_id + 1;
@@ -4875,6 +4855,20 @@ void topology_probe()
4875 topo.threads_per_core = max_siblings; 4855 topo.threads_per_core = max_siblings;
4876 if (debug > 1) 4856 if (debug > 1)
4877 fprintf(outf, "max_siblings %d\n", max_siblings); 4857 fprintf(outf, "max_siblings %d\n", max_siblings);
4858
4859 if (debug < 1)
4860 return;
4861
4862 for (i = 0; i <= topo.max_cpu_num; ++i) {
4863 fprintf(outf,
4864 "cpu %d pkg %d node %d lnode %d core %d thread %d\n",
4865 i, cpus[i].physical_package_id,
4866 cpus[i].physical_node_id,
4867 cpus[i].logical_node_id,
4868 cpus[i].physical_core_id,
4869 cpus[i].thread_id);
4870 }
4871
4878} 4872}
4879 4873
4880void 4874void
@@ -5102,7 +5096,7 @@ int get_and_dump_counters(void)
5102} 5096}
5103 5097
5104void print_version() { 5098void print_version() {
5105 fprintf(outf, "turbostat version 18.06.20" 5099 fprintf(outf, "turbostat version 18.07.27"
5106 " - Len Brown <lenb@kernel.org>\n"); 5100 " - Len Brown <lenb@kernel.org>\n");
5107} 5101}
5108 5102