diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-20 16:25:04 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-20 16:25:04 -0500 |
| commit | 82023bb7f75b0052f40d3e74169d191c3e4e6286 (patch) | |
| tree | 06ad7f507852adf41a2ca33d5cb7100faeaf8499 /tools | |
| parent | e6d69a60b77a6ea8d5f9d41765c7571bb8d45531 (diff) | |
| parent | ed6a82546d2e8f6b5902269541733814d4adacc2 (diff) | |
Merge tag 'pm+acpi-2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more ACPI and power management updates from Rafael Wysocki:
- ACPI-based device hotplug fixes for issues introduced recently and a
fix for an older error code path bug in the ACPI PCI host bridge
driver
- Fix for recently broken OMAP cpufreq build from Viresh Kumar
- Fix for a recent hibernation regression related to s2disk
- Fix for a locking-related regression in the ACPI EC driver from
Puneet Kumar
- System suspend error code path fix related to runtime PM and runtime
PM documentation update from Ulf Hansson
- cpufreq's conservative governor fix from Xiaoguang Chen
- New processor IDs for intel_idle and turbostat and removal of an
obsolete Kconfig option from Len Brown
- New device IDs for the ACPI LPSS (Low-Power Subsystem) driver and
ACPI-based PCI hotplug (ACPIPHP) cleanup from Mika Westerberg
- Removal of several ACPI video DMI blacklist entries that are not
necessary any more from Aaron Lu
- Rework of the ACPI companion representation in struct device and code
cleanup related to that change from Rafael J Wysocki, Lan Tianyu and
Jarkko Nikula
- Fixes for assigning names to ACPI-enumerated I2C and SPI devices from
Jarkko Nikula
* tag 'pm+acpi-2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (24 commits)
PCI / hotplug / ACPI: Drop unused acpiphp_debug declaration
ACPI / scan: Set flags.match_driver in acpi_bus_scan_fixed()
ACPI / PCI root: Clear driver_data before failing enumeration
ACPI / hotplug: Fix PCI host bridge hot removal
ACPI / hotplug: Fix acpi_bus_get_device() return value check
cpufreq: governor: Remove fossil comment in the cpufreq_governor_dbs()
ACPI / video: clean up DMI table for initial black screen problem
ACPI / EC: Ensure lock is acquired before accessing ec struct members
PM / Hibernate: Do not crash kernel in free_basic_memory_bitmaps()
ACPI / AC: Remove struct acpi_device pointer from struct acpi_ac
spi: Use stable dev_name for ACPI enumerated SPI slaves
i2c: Use stable dev_name for ACPI enumerated I2C slaves
ACPI: Provide acpi_dev_name accessor for struct acpi_device device name
ACPI / bind: Use (put|get)_device() on ACPI device objects too
ACPI: Eliminate the DEVICE_ACPI_HANDLE() macro
ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node
cpufreq: OMAP: Fix compilation error 'r & ret undeclared'
PM / Runtime: Fix error path for prepare
PM / Runtime: Update documentation around probe|remove|suspend
cpufreq: conservative: set requested_freq to policy max when it is over policy max
...
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 197 |
1 files changed, 141 insertions, 56 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index fe702076ca46..9d77f13c2d25 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * turbostat -- show CPU frequency and C-state residency | 2 | * turbostat -- show CPU frequency and C-state residency |
| 3 | * on modern Intel turbo-capable processors. | 3 | * on modern Intel turbo-capable processors. |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2012 Intel Corporation. | 5 | * Copyright (c) 2013 Intel Corporation. |
| 6 | * Len Brown <len.brown@intel.com> | 6 | * Len Brown <len.brown@intel.com> |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
| @@ -47,6 +47,8 @@ unsigned int skip_c1; | |||
| 47 | unsigned int do_nhm_cstates; | 47 | unsigned int do_nhm_cstates; |
| 48 | unsigned int do_snb_cstates; | 48 | unsigned int do_snb_cstates; |
| 49 | unsigned int do_c8_c9_c10; | 49 | unsigned int do_c8_c9_c10; |
| 50 | unsigned int do_slm_cstates; | ||
| 51 | unsigned int use_c1_residency_msr; | ||
| 50 | unsigned int has_aperf; | 52 | unsigned int has_aperf; |
| 51 | unsigned int has_epb; | 53 | unsigned int has_epb; |
| 52 | unsigned int units = 1000000000; /* Ghz etc */ | 54 | unsigned int units = 1000000000; /* Ghz etc */ |
| @@ -81,6 +83,8 @@ double rapl_joule_counter_range; | |||
| 81 | #define RAPL_DRAM (1 << 3) | 83 | #define RAPL_DRAM (1 << 3) |
| 82 | #define RAPL_PKG_PERF_STATUS (1 << 4) | 84 | #define RAPL_PKG_PERF_STATUS (1 << 4) |
| 83 | #define RAPL_DRAM_PERF_STATUS (1 << 5) | 85 | #define RAPL_DRAM_PERF_STATUS (1 << 5) |
| 86 | #define RAPL_PKG_POWER_INFO (1 << 6) | ||
| 87 | #define RAPL_CORE_POLICY (1 << 7) | ||
| 84 | #define TJMAX_DEFAULT 100 | 88 | #define TJMAX_DEFAULT 100 |
| 85 | 89 | ||
| 86 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | 90 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
| @@ -96,7 +100,7 @@ struct thread_data { | |||
| 96 | unsigned long long tsc; | 100 | unsigned long long tsc; |
| 97 | unsigned long long aperf; | 101 | unsigned long long aperf; |
| 98 | unsigned long long mperf; | 102 | unsigned long long mperf; |
| 99 | unsigned long long c1; /* derived */ | 103 | unsigned long long c1; |
| 100 | unsigned long long extra_msr64; | 104 | unsigned long long extra_msr64; |
| 101 | unsigned long long extra_delta64; | 105 | unsigned long long extra_delta64; |
| 102 | unsigned long long extra_msr32; | 106 | unsigned long long extra_msr32; |
| @@ -266,7 +270,7 @@ void print_header(void) | |||
| 266 | outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset64); | 270 | outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset64); |
| 267 | if (do_nhm_cstates) | 271 | if (do_nhm_cstates) |
| 268 | outp += sprintf(outp, " %%c1"); | 272 | outp += sprintf(outp, " %%c1"); |
| 269 | if (do_nhm_cstates) | 273 | if (do_nhm_cstates && !do_slm_cstates) |
| 270 | outp += sprintf(outp, " %%c3"); | 274 | outp += sprintf(outp, " %%c3"); |
| 271 | if (do_nhm_cstates) | 275 | if (do_nhm_cstates) |
| 272 | outp += sprintf(outp, " %%c6"); | 276 | outp += sprintf(outp, " %%c6"); |
| @@ -280,9 +284,9 @@ void print_header(void) | |||
| 280 | 284 | ||
| 281 | if (do_snb_cstates) | 285 | if (do_snb_cstates) |
| 282 | outp += sprintf(outp, " %%pc2"); | 286 | outp += sprintf(outp, " %%pc2"); |
| 283 | if (do_nhm_cstates) | 287 | if (do_nhm_cstates && !do_slm_cstates) |
| 284 | outp += sprintf(outp, " %%pc3"); | 288 | outp += sprintf(outp, " %%pc3"); |
| 285 | if (do_nhm_cstates) | 289 | if (do_nhm_cstates && !do_slm_cstates) |
| 286 | outp += sprintf(outp, " %%pc6"); | 290 | outp += sprintf(outp, " %%pc6"); |
| 287 | if (do_snb_cstates) | 291 | if (do_snb_cstates) |
| 288 | outp += sprintf(outp, " %%pc7"); | 292 | outp += sprintf(outp, " %%pc7"); |
| @@ -480,7 +484,7 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
| 480 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 484 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
| 481 | goto done; | 485 | goto done; |
| 482 | 486 | ||
| 483 | if (do_nhm_cstates) | 487 | if (do_nhm_cstates && !do_slm_cstates) |
| 484 | outp += sprintf(outp, " %6.2f", 100.0 * c->c3/t->tsc); | 488 | outp += sprintf(outp, " %6.2f", 100.0 * c->c3/t->tsc); |
| 485 | if (do_nhm_cstates) | 489 | if (do_nhm_cstates) |
| 486 | outp += sprintf(outp, " %6.2f", 100.0 * c->c6/t->tsc); | 490 | outp += sprintf(outp, " %6.2f", 100.0 * c->c6/t->tsc); |
| @@ -499,9 +503,9 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
| 499 | 503 | ||
| 500 | if (do_snb_cstates) | 504 | if (do_snb_cstates) |
| 501 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc2/t->tsc); | 505 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc2/t->tsc); |
| 502 | if (do_nhm_cstates) | 506 | if (do_nhm_cstates && !do_slm_cstates) |
| 503 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc3/t->tsc); | 507 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc3/t->tsc); |
| 504 | if (do_nhm_cstates) | 508 | if (do_nhm_cstates && !do_slm_cstates) |
| 505 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc6/t->tsc); | 509 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc6/t->tsc); |
| 506 | if (do_snb_cstates) | 510 | if (do_snb_cstates) |
| 507 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc); | 511 | outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc); |
| @@ -648,17 +652,24 @@ delta_thread(struct thread_data *new, struct thread_data *old, | |||
| 648 | } | 652 | } |
| 649 | 653 | ||
| 650 | 654 | ||
| 651 | /* | 655 | if (use_c1_residency_msr) { |
| 652 | * As counter collection is not atomic, | 656 | /* |
| 653 | * it is possible for mperf's non-halted cycles + idle states | 657 | * Some models have a dedicated C1 residency MSR, |
| 654 | * to exceed TSC's all cycles: show c1 = 0% in that case. | 658 | * which should be more accurate than the derivation below. |
| 655 | */ | 659 | */ |
| 656 | if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > old->tsc) | 660 | } else { |
| 657 | old->c1 = 0; | 661 | /* |
| 658 | else { | 662 | * As counter collection is not atomic, |
| 659 | /* normal case, derive c1 */ | 663 | * it is possible for mperf's non-halted cycles + idle states |
| 660 | old->c1 = old->tsc - old->mperf - core_delta->c3 | 664 | * to exceed TSC's all cycles: show c1 = 0% in that case. |
| 665 | */ | ||
| 666 | if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > old->tsc) | ||
| 667 | old->c1 = 0; | ||
| 668 | else { | ||
| 669 | /* normal case, derive c1 */ | ||
| 670 | old->c1 = old->tsc - old->mperf - core_delta->c3 | ||
| 661 | - core_delta->c6 - core_delta->c7; | 671 | - core_delta->c6 - core_delta->c7; |
| 672 | } | ||
| 662 | } | 673 | } |
| 663 | 674 | ||
| 664 | if (old->mperf == 0) { | 675 | if (old->mperf == 0) { |
| @@ -872,13 +883,21 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 872 | if (get_msr(cpu, extra_msr_offset64, &t->extra_msr64)) | 883 | if (get_msr(cpu, extra_msr_offset64, &t->extra_msr64)) |
| 873 | return -5; | 884 | return -5; |
| 874 | 885 | ||
| 886 | if (use_c1_residency_msr) { | ||
| 887 | if (get_msr(cpu, MSR_CORE_C1_RES, &t->c1)) | ||
| 888 | return -6; | ||
| 889 | } | ||
| 890 | |||
| 875 | /* collect core counters only for 1st thread in core */ | 891 | /* collect core counters only for 1st thread in core */ |
| 876 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 892 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
| 877 | return 0; | 893 | return 0; |
| 878 | 894 | ||
| 879 | if (do_nhm_cstates) { | 895 | if (do_nhm_cstates && !do_slm_cstates) { |
| 880 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) | 896 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) |
| 881 | return -6; | 897 | return -6; |
| 898 | } | ||
| 899 | |||
| 900 | if (do_nhm_cstates) { | ||
| 882 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) | 901 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) |
| 883 | return -7; | 902 | return -7; |
| 884 | } | 903 | } |
| @@ -898,7 +917,7 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
| 898 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) | 917 | if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) |
| 899 | return 0; | 918 | return 0; |
| 900 | 919 | ||
| 901 | if (do_nhm_cstates) { | 920 | if (do_nhm_cstates && !do_slm_cstates) { |
| 902 | if (get_msr(cpu, MSR_PKG_C3_RESIDENCY, &p->pc3)) | 921 | if (get_msr(cpu, MSR_PKG_C3_RESIDENCY, &p->pc3)) |
