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

Merge tag 'pm+acpi-3.15-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI and power management fixes and updates from Rafael Wysocki:
"This is PM and ACPI material that has emerged over the last two weeks
and one fix for a CPU hotplug regression introduced by the recent CPU
hotplug notifiers registration series.

Included are intel_idle and turbostat updates from Len Brown (these
have been in linux-next for quite some time), a new cpufreq driver for
powernv (that might spend some more time in linux-next, but BenH was
asking me so nicely to push it for 3.15 that I couldn't resist), some
cpufreq fixes and cleanups (including fixes for some silly breakage in
a couple of cpufreq drivers introduced during the 3.14 cycle),
assorted ACPI cleanups, wakeup framework documentation fixes, a new
sysfs attribute for cpuidle and a new command line argument for power
domains diagnostics.

Specifics:

- Fix for a recently introduced CPU hotplug regression in ARM KVM
from Ming Lei.

- Fixes for breakage in the at32ap, loongson2_cpufreq, and unicore32
cpufreq drivers introduced during the 3.14 cycle (-stable material)
from Chen Gang and Viresh Kumar.

- New powernv cpufreq driver from Vaidyanathan Srinivasan, with bits
from Gautham R Shenoy and Srivatsa S Bhat.

- Exynos cpufreq driver fix preventing it from being included into
multiplatform builds that aren't supported by it from Sachin Kamat.

- cpufreq cleanups related to the usage of the driver_data field in
struct cpufreq_frequency_table from Viresh Kumar.

- cpufreq ppc driver cleanup from Sachin Kamat.

- Intel BayTrail support for intel_idle and ACPI idle from Len Brown.

- Intel CPU model 54 (Atom N2000 series) support for intel_idle from
Jan Kiszka.

- intel_idle fix for Intel Ivy Town residency targets from Len Brown.

- turbostat updates (Intel Broadwell support and output cleanups)
from Len Brown.

- New cpuidle sysfs attribute for exporting C-states' target
residency information to user space from Daniel Lezcano.

- New kernel command line argument to prevent power domains enabled
by the bootloader from being turned off even if they are not in use
(for diagnostics purposes) from Tushar Behera.

- Fixes for wakeup sysfs attributes documentation from Geert
Uytterhoeven.

- New ACPI video blacklist entry for ThinkPad Helix from Stephen
Chandler Paul.

- Assorted ACPI cleanups and a Kconfig help update from Jonghwan
Choi, Zhihui Zhang, Hanjun Guo"

* tag 'pm+acpi-3.15-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (28 commits)
ACPI: Update the ACPI spec information in Kconfig
arm, kvm: fix double lock on cpu_add_remove_lock
cpuidle: sysfs: Export target residency information
cpufreq: ppc: Remove duplicate inclusion of fsl_soc.h
cpufreq: create another field .flags in cpufreq_frequency_table
cpufreq: use kzalloc() to allocate memory for cpufreq_frequency_table
cpufreq: don't print value of .driver_data from core
cpufreq: ia64: don't set .driver_data to index
cpufreq: powernv: Select CPUFreq related Kconfig options for powernv
cpufreq: powernv: Use cpufreq_frequency_table.driver_data to store pstate ids
cpufreq: powernv: cpufreq driver for powernv platform
cpufreq: at32ap: don't declare local variable as static
cpufreq: loongson2_cpufreq: don't declare local variable as static
cpufreq: unicore32: fix typo issue for 'clk'
cpufreq: exynos: Disable on multiplatform build
PM / wakeup: Correct presence vs. emptiness of wakeup_* attributes
PM / domains: Add pd_ignore_unused to keep power domains enabled
ACPI / dock: Drop dock_device_ids[] table
ACPI / video: Favor native backlight interface for ThinkPad Helix
ACPI / thermal: Fix wrong variable usage in debug statement
...

+970 -422
+30 -16
Documentation/ABI/testing/sysfs-devices-power
··· 83 83 Description: 84 84 The /sys/devices/.../wakeup_count attribute contains the number 85 85 of signaled wakeup events associated with the device. This 86 - attribute is read-only. If the device is not enabled to wake up 86 + attribute is read-only. If the device is not capable to wake up 87 87 the system from sleep states, this attribute is not present. 88 + If the device is not enabled to wake up the system from sleep 89 + states, this attribute is empty. 88 90 89 91 What: /sys/devices/.../power/wakeup_active_count 90 92 Date: September 2010 ··· 95 93 The /sys/devices/.../wakeup_active_count attribute contains the 96 94 number of times the processing of wakeup events associated with 97 95 the device was completed (at the kernel level). This attribute 98 - is read-only. If the device is not enabled to wake up the 99 - system from sleep states, this attribute is not present. 96 + is read-only. If the device is not capable to wake up the 97 + system from sleep states, this attribute is not present. If 98 + the device is not enabled to wake up the system from sleep 99 + states, this attribute is empty. 100 100 101 101 What: /sys/devices/.../power/wakeup_abort_count 102 102 Date: February 2012 ··· 108 104 number of times the processing of a wakeup event associated with 109 105 the device might have aborted system transition into a sleep 110 106 state in progress. This attribute is read-only. If the device 111 - is not enabled to wake up the system from sleep states, this 112 - attribute is not present. 107 + is not capable to wake up the system from sleep states, this 108 + attribute is not present. If the device is not enabled to wake 109 + up the system from sleep states, this attribute is empty. 113 110 114 111 What: /sys/devices/.../power/wakeup_expire_count 115 112 Date: February 2012 ··· 119 114 The /sys/devices/.../wakeup_expire_count attribute contains the 120 115 number of times a wakeup event associated with the device has 121 116 been reported with a timeout that expired. This attribute is 122 - read-only. If the device is not enabled to wake up the system 123 - from sleep states, this attribute is not present. 117 + read-only. If the device is not capable to wake up the system 118 + from sleep states, this attribute is not present. If the 119 + device is not enabled to wake up the system from sleep states, 120 + this attribute is empty. 124 121 125 122 What: /sys/devices/.../power/wakeup_active 126 123 Date: September 2010 ··· 131 124 The /sys/devices/.../wakeup_active attribute contains either 1, 132 125 or 0, depending on whether or not a wakeup event associated with 133 126 the device is being processed (1). This attribute is read-only. 134 - If the device is not enabled to wake up the system from sleep 135 - states, this attribute is not present. 127 + If the device is not capable to wake up the system from sleep 128 + states, this attribute is not present. If the device is not 129 + enabled to wake up the system from sleep states, this attribute 130 + is empty. 136 131 137 132 What: /sys/devices/.../power/wakeup_total_time_ms 138 133 Date: September 2010 ··· 143 134 The /sys/devices/.../wakeup_total_time_ms attribute contains 144 135 the total time of processing wakeup events associated with the 145 136 device, in milliseconds. This attribute is read-only. If the 146 - device is not enabled to wake up the system from sleep states, 147 - this attribute is not present. 137 + device is not capable to wake up the system from sleep states, 138 + this attribute is not present. If the device is not enabled to 139 + wake up the system from sleep states, this attribute is empty. 148 140 149 141 What: /sys/devices/.../power/wakeup_max_time_ms 150 142 Date: September 2010 ··· 154 144 The /sys/devices/.../wakeup_max_time_ms attribute contains 155 145 the maximum time of processing a single wakeup event associated 156 146 with the device, in milliseconds. This attribute is read-only. 157 - If the device is not enabled to wake up the system from sleep 158 - states, this attribute is not present. 147 + If the device is not capable to wake up the system from sleep 148 + states, this attribute is not present. If the device is not 149 + enabled to wake up the system from sleep states, this attribute 150 + is empty. 159 151 160 152 What: /sys/devices/.../power/wakeup_last_time_ms 161 153 Date: September 2010 ··· 168 156 signaling the last wakeup event associated with the device, in 169 157 milliseconds. This attribute is read-only. If the device is 170 158 not enabled to wake up the system from sleep states, this 171 - attribute is not present. 159 + attribute is not present. If the device is not enabled to wake 160 + up the system from sleep states, this attribute is empty. 172 161 173 162 What: /sys/devices/.../power/wakeup_prevent_sleep_time_ms 174 163 Date: February 2012 ··· 178 165 The /sys/devices/.../wakeup_prevent_sleep_time_ms attribute 179 166 contains the total time the device has been preventing 180 167 opportunistic transitions to sleep states from occurring. 181 - This attribute is read-only. If the device is not enabled to 168 + This attribute is read-only. If the device is not capable to 182 169 wake up the system from sleep states, this attribute is not 183 - present. 170 + present. If the device is not enabled to wake up the system 171 + from sleep states, this attribute is empty. 184 172 185 173 What: /sys/devices/.../power/autosuspend_delay_ms 186 174 Date: September 2010
+7
Documentation/kernel-parameters.txt
··· 2563 2563 2564 2564 pcmv= [HW,PCMCIA] BadgePAD 4 2565 2565 2566 + pd_ignore_unused 2567 + [PM] 2568 + Keep all power-domains already enabled by bootloader on, 2569 + even if no driver has claimed them. This is useful 2570 + for debug and development, but should not be 2571 + needed on a platform with proper driver support. 2572 + 2566 2573 pd. [PARIDE] 2567 2574 See Documentation/blockdev/paride.txt. 2568 2575
+10 -10
arch/mips/loongson/lemote-2f/clock.c
··· 28 28 }; 29 29 30 30 struct cpufreq_frequency_table loongson2_clockmod_table[] = { 31 - {DC_RESV, CPUFREQ_ENTRY_INVALID}, 32 - {DC_ZERO, CPUFREQ_ENTRY_INVALID}, 33 - {DC_25PT, 0}, 34 - {DC_37PT, 0}, 35 - {DC_50PT, 0}, 36 - {DC_62PT, 0}, 37 - {DC_75PT, 0}, 38 - {DC_87PT, 0}, 39 - {DC_DISABLE, 0}, 40 - {DC_RESV, CPUFREQ_TABLE_END}, 31 + {0, DC_RESV, CPUFREQ_ENTRY_INVALID}, 32 + {0, DC_ZERO, CPUFREQ_ENTRY_INVALID}, 33 + {0, DC_25PT, 0}, 34 + {0, DC_37PT, 0}, 35 + {0, DC_50PT, 0}, 36 + {0, DC_62PT, 0}, 37 + {0, DC_75PT, 0}, 38 + {0, DC_87PT, 0}, 39 + {0, DC_DISABLE, 0}, 40 + {0, DC_RESV, CPUFREQ_TABLE_END}, 41 41 }; 42 42 EXPORT_SYMBOL_GPL(loongson2_clockmod_table); 43 43
+1
arch/powerpc/configs/pseries_defconfig
··· 306 306 CONFIG_KVM_BOOK3S_64_HV=y 307 307 CONFIG_TRANSPARENT_HUGEPAGE=y 308 308 CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y 309 + CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+1
arch/powerpc/configs/pseries_le_defconfig
··· 301 301 # CONFIG_CRYPTO_ANSI_CPRNG is not set 302 302 CONFIG_CRYPTO_DEV_NX=y 303 303 CONFIG_CRYPTO_DEV_NX_ENCRYPT=m 304 + CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+4
arch/powerpc/include/asm/reg.h
··· 272 272 #define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ 273 273 #define SPRN_IC 0x350 /* Virtual Instruction Count */ 274 274 #define SPRN_VTB 0x351 /* Virtual Time Base */ 275 + #define SPRN_PMICR 0x354 /* Power Management Idle Control Reg */ 276 + #define SPRN_PMSR 0x355 /* Power Management Status Reg */ 277 + #define SPRN_PMCR 0x374 /* Power Management Control Register */ 278 + 275 279 /* HFSCR and FSCR bit numbers are the same */ 276 280 #define FSCR_TAR_LG 8 /* Enable Target Address Register */ 277 281 #define FSCR_EBB_LG 7 /* Enable Event Based Branching */
+6
arch/powerpc/platforms/powernv/Kconfig
··· 11 11 select PPC_UDBG_16550 12 12 select PPC_SCOM 13 13 select ARCH_RANDOM 14 + select CPU_FREQ 15 + select CPU_FREQ_GOV_PERFORMANCE 16 + select CPU_FREQ_GOV_POWERSAVE 17 + select CPU_FREQ_GOV_USERSPACE 18 + select CPU_FREQ_GOV_ONDEMAND 19 + select CPU_FREQ_GOV_CONSERVATIVE 14 20 default y 15 21 16 22 config PPC_POWERNV_RTAS
+3 -1
arch/x86/kernel/acpi/cstate.c
··· 87 87 num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; 88 88 89 89 retval = 0; 90 - if (num_cstate_subtype < (cx->address & MWAIT_SUBSTATE_MASK)) { 90 + /* If the HW does not support any sub-states in this C-state */ 91 + if (num_cstate_subtype == 0) { 92 + pr_warn(FW_BUG "ACPI MWAIT C-state 0x%x not supported by HW (0x%x)\n", cx->address, edx_part); 91 93 retval = -1; 92 94 goto out; 93 95 }
+6 -2
drivers/acpi/Kconfig
··· 31 31 ACPI CA, see: 32 32 <http://acpica.org/> 33 33 34 - ACPI is an open industry specification co-developed by 35 - Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba. 34 + ACPI is an open industry specification originally co-developed by 35 + Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba. Currently, 36 + it is developed by the ACPI Specification Working Group (ASWG) under 37 + the UEFI Forum and any UEFI member can join the ASWG and contribute 38 + to the ACPI specification. 36 39 The specification is available at: 37 40 <http://www.acpi.info> 41 + <http://www.uefi.org/acpi/specs> 38 42 39 43 if ACPI 40 44
-6
drivers/acpi/dock.c
··· 51 51 " the driver to wait for userspace to write the undock sysfs file " 52 52 " before undocking"); 53 53 54 - static const struct acpi_device_id dock_device_ids[] = { 55 - {"LNXDOCK", 0}, 56 - {"", 0}, 57 - }; 58 - MODULE_DEVICE_TABLE(acpi, dock_device_ids); 59 - 60 54 struct dock_station { 61 55 acpi_handle handle; 62 56 unsigned long last_dock_time;
+1 -2
drivers/acpi/osl.c
··· 1219 1219 { 1220 1220 struct semaphore *sem = NULL; 1221 1221 1222 - sem = acpi_os_allocate(sizeof(struct semaphore)); 1222 + sem = acpi_os_allocate_zeroed(sizeof(struct semaphore)); 1223 1223 if (!sem) 1224 1224 return AE_NO_MEMORY; 1225 - memset(sem, 0, sizeof(struct semaphore)); 1226 1225 1227 1226 sema_init(sem, initial_units); 1228 1227
+1 -1
drivers/acpi/thermal.c
··· 344 344 tz->trips.hot.flags.valid = 1; 345 345 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 346 346 "Found hot threshold [%lu]\n", 347 - tz->trips.critical.temperature)); 347 + tz->trips.hot.temperature)); 348 348 } 349 349 } 350 350
+1 -2
drivers/acpi/utils.c
··· 164 164 * Validate output buffer. 165 165 */ 166 166 if (buffer->length == ACPI_ALLOCATE_BUFFER) { 167 - buffer->pointer = ACPI_ALLOCATE(size_required); 167 + buffer->pointer = ACPI_ALLOCATE_ZEROED(size_required); 168 168 if (!buffer->pointer) 169 169 return AE_NO_MEMORY; 170 170 buffer->length = size_required; 171 - memset(buffer->pointer, 0, size_required); 172 171 } else { 173 172 if (buffer->length < size_required) { 174 173 buffer->length = size_required;
+8
drivers/acpi/video.c
··· 488 488 }, 489 489 }, 490 490 { 491 + .callback = video_set_use_native_backlight, 492 + .ident = "Thinkpad Helix", 493 + .matches = { 494 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 495 + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"), 496 + }, 497 + }, 498 + { 491 499 .callback = video_set_use_native_backlight, 492 500 .ident = "Dell Inspiron 7520", 493 501 .matches = {
+13
drivers/base/power/domain.c
··· 705 705 return 0; 706 706 } 707 707 708 + static bool pd_ignore_unused; 709 + static int __init pd_ignore_unused_setup(char *__unused) 710 + { 711 + pd_ignore_unused = true; 712 + return 1; 713 + } 714 + __setup("pd_ignore_unused", pd_ignore_unused_setup); 715 + 708 716 /** 709 717 * pm_genpd_poweroff_unused - Power off all PM domains with no devices in use. 710 718 */ 711 719 void pm_genpd_poweroff_unused(void) 712 720 { 713 721 struct generic_pm_domain *genpd; 722 + 723 + if (pd_ignore_unused) { 724 + pr_warn("genpd: Not disabling unused power domains\n"); 725 + return; 726 + } 714 727 715 728 mutex_lock(&gpd_list_lock); 716 729
+3 -3
drivers/cpufreq/Kconfig.arm
··· 30 30 31 31 config ARM_EXYNOS4210_CPUFREQ 32 32 bool "SAMSUNG EXYNOS4210" 33 - depends on CPU_EXYNOS4210 33 + depends on CPU_EXYNOS4210 && !ARCH_MULTIPLATFORM 34 34 default y 35 35 select ARM_EXYNOS_CPUFREQ 36 36 help ··· 41 41 42 42 config ARM_EXYNOS4X12_CPUFREQ 43 43 bool "SAMSUNG EXYNOS4x12" 44 - depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412) 44 + depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412) && !ARCH_MULTIPLATFORM 45 45 default y 46 46 select ARM_EXYNOS_CPUFREQ 47 47 help ··· 52 52 53 53 config ARM_EXYNOS5250_CPUFREQ 54 54 bool "SAMSUNG EXYNOS5250" 55 - depends on SOC_EXYNOS5250 55 + depends on SOC_EXYNOS5250 && !ARCH_MULTIPLATFORM 56 56 default y 57 57 select ARM_EXYNOS_CPUFREQ 58 58 help
+8
drivers/cpufreq/Kconfig.powerpc
··· 54 54 help 55 55 This adds the support for frequency switching on PA Semi 56 56 PWRficient processors. 57 + 58 + config POWERNV_CPUFREQ 59 + tristate "CPU frequency scaling for IBM POWERNV platform" 60 + depends on PPC_POWERNV 61 + default y 62 + help 63 + This adds support for CPU frequency switching on IBM POWERNV 64 + platform
+1
drivers/cpufreq/Makefile
··· 86 86 obj-$(CONFIG_CPU_FREQ_PMAC) += pmac32-cpufreq.o 87 87 obj-$(CONFIG_CPU_FREQ_PMAC64) += pmac64-cpufreq.o 88 88 obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += pasemi-cpufreq.o 89 + obj-$(CONFIG_POWERNV_CPUFREQ) += powernv-cpufreq.o 89 90 90 91 ################################################################################## 91 92 # Other platform drivers
+1 -1
drivers/cpufreq/acpi-cpufreq.c
··· 754 754 goto err_unreg; 755 755 } 756 756 757 - data->freq_table = kmalloc(sizeof(*data->freq_table) * 757 + data->freq_table = kzalloc(sizeof(*data->freq_table) * 758 758 (perf->state_count+1), GFP_KERNEL); 759 759 if (!data->freq_table) { 760 760 result = -ENOMEM;
+1 -1
drivers/cpufreq/at32ap-cpufreq.c
··· 52 52 static int at32_cpufreq_driver_init(struct cpufreq_policy *policy) 53 53 { 54 54 unsigned int frequency, rate, min_freq; 55 - static struct clk *cpuclk; 55 + struct clk *cpuclk; 56 56 int retval, steps, i; 57 57 58 58 if (policy->cpu != 0)
+3 -3
drivers/cpufreq/cris-artpec3-cpufreq.c
··· 15 15 }; 16 16 17 17 static struct cpufreq_frequency_table cris_freq_table[] = { 18 - {0x01, 6000}, 19 - {0x02, 200000}, 20 - {0, CPUFREQ_TABLE_END}, 18 + {0, 0x01, 6000}, 19 + {0, 0x02, 200000}, 20 + {0, 0, CPUFREQ_TABLE_END}, 21 21 }; 22 22 23 23 static unsigned int cris_freq_get_cpu_frequency(unsigned int cpu)
+3 -3
drivers/cpufreq/cris-etraxfs-cpufreq.c
··· 15 15 }; 16 16 17 17 static struct cpufreq_frequency_table cris_freq_table[] = { 18 - {0x01, 6000}, 19 - {0x02, 200000}, 20 - {0, CPUFREQ_TABLE_END}, 18 + {0, 0x01, 6000}, 19 + {0, 0x02, 200000}, 20 + {0, 0, CPUFREQ_TABLE_END}, 21 21 }; 22 22 23 23 static unsigned int cris_freq_get_cpu_frequency(unsigned int cpu)
+9 -9
drivers/cpufreq/elanfreq.c
··· 56 56 }; 57 57 58 58 static struct cpufreq_frequency_table elanfreq_table[] = { 59 - {0, 1000}, 60 - {1, 2000}, 61 - {2, 4000}, 62 - {3, 8000}, 63 - {4, 16000}, 64 - {5, 33000}, 65 - {6, 66000}, 66 - {7, 99000}, 67 - {0, CPUFREQ_TABLE_END}, 59 + {0, 0, 1000}, 60 + {0, 1, 2000}, 61 + {0, 2, 4000}, 62 + {0, 3, 8000}, 63 + {0, 4, 16000}, 64 + {0, 5, 33000}, 65 + {0, 6, 66000}, 66 + {0, 7, 99000}, 67 + {0, 0, CPUFREQ_TABLE_END}, 68 68 }; 69 69 70 70
+6 -6
drivers/cpufreq/exynos4210-cpufreq.c
··· 29 29 }; 30 30 31 31 static struct cpufreq_frequency_table exynos4210_freq_table[] = { 32 - {L0, 1200 * 1000}, 33 - {L1, 1000 * 1000}, 34 - {L2, 800 * 1000}, 35 - {L3, 500 * 1000}, 36 - {L4, 200 * 1000}, 37 - {0, CPUFREQ_TABLE_END}, 32 + {0, L0, 1200 * 1000}, 33 + {0, L1, 1000 * 1000}, 34 + {0, L2, 800 * 1000}, 35 + {0, L3, 500 * 1000}, 36 + {0, L4, 200 * 1000}, 37 + {0, 0, CPUFREQ_TABLE_END}, 38 38 }; 39 39 40 40 static struct apll_freq apll_freq_4210[] = {
+15 -15
drivers/cpufreq/exynos4x12-cpufreq.c
··· 30 30 }; 31 31 32 32 static struct cpufreq_frequency_table exynos4x12_freq_table[] = { 33 - {CPUFREQ_BOOST_FREQ, 1500 * 1000}, 34 - {L1, 1400 * 1000}, 35 - {L2, 1300 * 1000}, 36 - {L3, 1200 * 1000}, 37 - {L4, 1100 * 1000}, 38 - {L5, 1000 * 1000}, 39 - {L6, 900 * 1000}, 40 - {L7, 800 * 1000}, 41 - {L8, 700 * 1000}, 42 - {L9, 600 * 1000}, 43 - {L10, 500 * 1000}, 44 - {L11, 400 * 1000}, 45 - {L12, 300 * 1000}, 46 - {L13, 200 * 1000}, 47 - {0, CPUFREQ_TABLE_END}, 33 + {CPUFREQ_BOOST_FREQ, L0, 1500 * 1000}, 34 + {0, L1, 1400 * 1000}, 35 + {0, L2, 1300 * 1000}, 36 + {0, L3, 1200 * 1000}, 37 + {0, L4, 1100 * 1000}, 38 + {0, L5, 1000 * 1000}, 39 + {0, L6, 900 * 1000}, 40 + {0, L7, 800 * 1000}, 41 + {0, L8, 700 * 1000}, 42 + {0, L9, 600 * 1000}, 43 + {0, L10, 500 * 1000}, 44 + {0, L11, 400 * 1000}, 45 + {0, L12, 300 * 1000}, 46 + {0, L13, 200 * 1000}, 47 + {0, 0, CPUFREQ_TABLE_END}, 48 48 }; 49 49 50 50 static struct apll_freq *apll_freq_4x12;
+17 -17
drivers/cpufreq/exynos5250-cpufreq.c
··· 34 34 }; 35 35 36 36 static struct cpufreq_frequency_table exynos5250_freq_table[] = { 37 - {L0, 1700 * 1000}, 38 - {L1, 1600 * 1000}, 39 - {L2, 1500 * 1000}, 40 - {L3, 1400 * 1000}, 41 - {L4, 1300 * 1000}, 42 - {L5, 1200 * 1000}, 43 - {L6, 1100 * 1000}, 44 - {L7, 1000 * 1000}, 45 - {L8, 900 * 1000}, 46 - {L9, 800 * 1000}, 47 - {L10, 700 * 1000}, 48 - {L11, 600 * 1000}, 49 - {L12, 500 * 1000}, 50 - {L13, 400 * 1000}, 51 - {L14, 300 * 1000}, 52 - {L15, 200 * 1000}, 53 - {0, CPUFREQ_TABLE_END}, 37 + {0, L0, 1700 * 1000}, 38 + {0, L1, 1600 * 1000}, 39 + {0, L2, 1500 * 1000}, 40 + {0, L3, 1400 * 1000}, 41 + {0, L4, 1300 * 1000}, 42 + {0, L5, 1200 * 1000}, 43 + {0, L6, 1100 * 1000}, 44 + {0, L7, 1000 * 1000}, 45 + {0, L8, 900 * 1000}, 46 + {0, L9, 800 * 1000}, 47 + {0, L10, 700 * 1000}, 48 + {0, L11, 600 * 1000}, 49 + {0, L12, 500 * 1000}, 50 + {0, L13, 400 * 1000}, 51 + {0, L14, 300 * 1000}, 52 + {0, L15, 200 * 1000}, 53 + {0, 0, CPUFREQ_TABLE_END}, 54 54 }; 55 55 56 56 static struct apll_freq apll_freq_5250[] = {
+5 -6
drivers/cpufreq/freq_table.c
··· 33 33 continue; 34 34 } 35 35 if (!cpufreq_boost_enabled() 36 - && table[i].driver_data == CPUFREQ_BOOST_FREQ) 36 + && (table[i].flags & CPUFREQ_BOOST_FREQ)) 37 37 continue; 38 38 39 - pr_debug("table entry %u: %u kHz, %u driver_data\n", 40 - i, freq, table[i].driver_data); 39 + pr_debug("table entry %u: %u kHz\n", i, freq); 41 40 if (freq < min_freq) 42 41 min_freq = freq; 43 42 if (freq > max_freq) ··· 174 175 } else 175 176 *index = optimal.driver_data; 176 177 177 - pr_debug("target is %u (%u kHz, %u)\n", *index, table[*index].frequency, 178 - table[*index].driver_data); 178 + pr_debug("target index is %u, freq is:%u kHz\n", *index, 179 + table[*index].frequency); 179 180 180 181 return 0; 181 182 } ··· 229 230 * show_boost = false and driver_data != BOOST freq 230 231 * display NON BOOST freqs 231 232 */ 232 - if (show_boost ^ (table[i].driver_data == CPUFREQ_BOOST_FREQ)) 233 + if (show_boost ^ (table[i].flags & CPUFREQ_BOOST_FREQ)) 233 234 continue; 234 235 235 236 count += sprintf(&buf[count], "%d ", table[i].frequency);
+1 -2
drivers/cpufreq/ia64-acpi-cpufreq.c
··· 254 254 } 255 255 256 256 /* alloc freq_table */ 257 - data->freq_table = kmalloc(sizeof(*data->freq_table) * 257 + data->freq_table = kzalloc(sizeof(*data->freq_table) * 258 258 (data->acpi_data.state_count + 1), 259 259 GFP_KERNEL); 260 260 if (!data->freq_table) { ··· 275 275 /* table init */ 276 276 for (i = 0; i <= data->acpi_data.state_count; i++) 277 277 { 278 - data->freq_table[i].driver_data = i; 279 278 if (i < data->acpi_data.state_count) { 280 279 data->freq_table[i].frequency = 281 280 data->acpi_data.states[i].core_frequency * 1000;
+3 -3
drivers/cpufreq/kirkwood-cpufreq.c
··· 43 43 * table. 44 44 */ 45 45 static struct cpufreq_frequency_table kirkwood_freq_table[] = { 46 - {STATE_CPU_FREQ, 0}, /* CPU uses cpuclk */ 47 - {STATE_DDR_FREQ, 0}, /* CPU uses ddrclk */ 48 - {0, CPUFREQ_TABLE_END}, 46 + {0, STATE_CPU_FREQ, 0}, /* CPU uses cpuclk */ 47 + {0, STATE_DDR_FREQ, 0}, /* CPU uses ddrclk */ 48 + {0, 0, CPUFREQ_TABLE_END}, 49 49 }; 50 50 51 51 static unsigned int kirkwood_cpufreq_get_cpu_frequency(unsigned int cpu)
+1 -1
drivers/cpufreq/longhaul.c
··· 475 475 return -EINVAL; 476 476 } 477 477 478 - longhaul_table = kmalloc((numscales + 1) * sizeof(*longhaul_table), 478 + longhaul_table = kzalloc((numscales + 1) * sizeof(*longhaul_table), 479 479 GFP_KERNEL); 480 480 if (!longhaul_table) 481 481 return -ENOMEM;
+1 -1
drivers/cpufreq/loongson2_cpufreq.c
··· 69 69 70 70 static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) 71 71 { 72 - static struct clk *cpuclk; 72 + struct clk *cpuclk; 73 73 int i; 74 74 unsigned long rate; 75 75 int ret;
+3 -3
drivers/cpufreq/maple-cpufreq.c
··· 59 59 #define CPUFREQ_LOW 1 60 60 61 61 static struct cpufreq_frequency_table maple_cpu_freqs[] = { 62 - {CPUFREQ_HIGH, 0}, 63 - {CPUFREQ_LOW, 0}, 64 - {0, CPUFREQ_TABLE_END}, 62 + {0, CPUFREQ_HIGH, 0}, 63 + {0, CPUFREQ_LOW, 0}, 64 + {0, 0, CPUFREQ_TABLE_END}, 65 65 }; 66 66 67 67 /* Power mode data is an array of the 32 bits PCR values to use for
+10 -10
drivers/cpufreq/p4-clockmod.c
··· 92 92 93 93 94 94 static struct cpufreq_frequency_table p4clockmod_table[] = { 95 - {DC_RESV, CPUFREQ_ENTRY_INVALID}, 96 - {DC_DFLT, 0}, 97 - {DC_25PT, 0}, 98 - {DC_38PT, 0}, 99 - {DC_50PT, 0}, 100 - {DC_64PT, 0}, 101 - {DC_75PT, 0}, 102 - {DC_88PT, 0}, 103 - {DC_DISABLE, 0}, 104 - {DC_RESV, CPUFREQ_TABLE_END}, 95 + {0, DC_RESV, CPUFREQ_ENTRY_INVALID}, 96 + {0, DC_DFLT, 0}, 97 + {0, DC_25PT, 0}, 98 + {0, DC_38PT, 0}, 99 + {0, DC_50PT, 0}, 100 + {0, DC_64PT, 0}, 101 + {0, DC_75PT, 0}, 102 + {0, DC_88PT, 0}, 103 + {0, DC_DISABLE, 0}, 104 + {0, DC_RESV, CPUFREQ_TABLE_END}, 105 105 }; 106 106 107 107
+6 -6
drivers/cpufreq/pasemi-cpufreq.c
··· 60 60 61 61 /* We support 5(A0-A4) power states excluding turbo(A5-A6) modes */ 62 62 static struct cpufreq_frequency_table pas_freqs[] = { 63 - {0, 0}, 64 - {1, 0}, 65 - {2, 0}, 66 - {3, 0}, 67 - {4, 0}, 68 - {0, CPUFREQ_TABLE_END}, 63 + {0, 0, 0}, 64 + {0, 1, 0}, 65 + {0, 2, 0}, 66 + {0, 3, 0}, 67 + {0, 4, 0}, 68 + {0, 0, CPUFREQ_TABLE_END}, 69 69 }; 70 70 71 71 /*
+3 -3
drivers/cpufreq/pmac32-cpufreq.c
··· 81 81 #define CPUFREQ_LOW 1 82 82 83 83 static struct cpufreq_frequency_table pmac_cpu_freqs[] = { 84 - {CPUFREQ_HIGH, 0}, 85 - {CPUFREQ_LOW, 0}, 86 - {0, CPUFREQ_TABLE_END}, 84 + {0, CPUFREQ_HIGH, 0}, 85 + {0, CPUFREQ_LOW, 0}, 86 + {0, 0, CPUFREQ_TABLE_END}, 87 87 }; 88 88 89 89 static inline void local_delay(unsigned long ms)
+3 -3
drivers/cpufreq/pmac64-cpufreq.c
··· 65 65 #define CPUFREQ_LOW 1 66 66 67 67 static struct cpufreq_frequency_table g5_cpu_freqs[] = { 68 - {CPUFREQ_HIGH, 0}, 69 - {CPUFREQ_LOW, 0}, 70 - {0, CPUFREQ_TABLE_END}, 68 + {0, CPUFREQ_HIGH, 0}, 69 + {0, CPUFREQ_LOW, 0}, 70 + {0, 0, CPUFREQ_TABLE_END}, 71 71 }; 72 72 73 73 /* Power mode data is an array of the 32 bits PCR values to use for
+9 -9
drivers/cpufreq/powernow-k6.c
··· 37 37 38 38 /* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */ 39 39 static struct cpufreq_frequency_table clock_ratio[] = { 40 - {60, /* 110 -> 6.0x */ 0}, 41 - {55, /* 011 -> 5.5x */ 0}, 42 - {50, /* 001 -> 5.0x */ 0}, 43 - {45, /* 000 -> 4.5x */ 0}, 44 - {40, /* 010 -> 4.0x */ 0}, 45 - {35, /* 111 -> 3.5x */ 0}, 46 - {30, /* 101 -> 3.0x */ 0}, 47 - {20, /* 100 -> 2.0x */ 0}, 48 - {0, CPUFREQ_TABLE_END} 40 + {0, 60, /* 110 -> 6.0x */ 0}, 41 + {0, 55, /* 011 -> 5.5x */ 0}, 42 + {0, 50, /* 001 -> 5.0x */ 0}, 43 + {0, 45, /* 000 -> 4.5x */ 0}, 44 + {0, 40, /* 010 -> 4.0x */ 0}, 45 + {0, 35, /* 111 -> 3.5x */ 0}, 46 + {0, 30, /* 101 -> 3.0x */ 0}, 47 + {0, 20, /* 100 -> 2.0x */ 0}, 48 + {0, 0, CPUFREQ_TABLE_END} 49 49 }; 50 50 51 51 static const u8 index_to_register[8] = { 6, 3, 1, 0, 2, 7, 5, 4 };
+2 -3
drivers/cpufreq/powernow-k8.c
··· 623 623 if (check_pst_table(data, pst, maxvid)) 624 624 return -EINVAL; 625 625 626 - powernow_table = kmalloc((sizeof(*powernow_table) 626 + powernow_table = kzalloc((sizeof(*powernow_table) 627 627 * (data->numps + 1)), GFP_KERNEL); 628 628 if (!powernow_table) { 629 629 printk(KERN_ERR PFX "powernow_table memory alloc failure\n"); ··· 793 793 } 794 794 795 795 /* fill in data->powernow_table */ 796 - powernow_table = kmalloc((sizeof(*powernow_table) 796 + powernow_table = kzalloc((sizeof(*powernow_table) 797 797 * (data->acpi_data.state_count + 1)), GFP_KERNEL); 798 798 if (!powernow_table) { 799 799 pr_debug("powernow_table memory alloc failure\n"); ··· 810 810 811 811 powernow_table[data->acpi_data.state_count].frequency = 812 812 CPUFREQ_TABLE_END; 813 - powernow_table[data->acpi_data.state_count].driver_data = 0; 814 813 data->powernow_table = powernow_table; 815 814 816 815 if (cpumask_first(cpu_core_mask(data->cpu)) == data->cpu)
+341
drivers/cpufreq/powernv-cpufreq.c
··· 1 + /* 2 + * POWERNV cpufreq driver for the IBM POWER processors 3 + * 4 + * (C) Copyright IBM 2014 5 + * 6 + * Author: Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License as published by 10 + * the Free Software Foundation; either version 2, or (at your option) 11 + * any later version. 12 + * 13 + * This program is distributed in the hope that it will be useful, 14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + * GNU General Public License for more details. 17 + * 18 + */ 19 + 20 + #define pr_fmt(fmt) "powernv-cpufreq: " fmt 21 + 22 + #include <linux/kernel.h> 23 + #include <linux/sysfs.h> 24 + #include <linux/cpumask.h> 25 + #include <linux/module.h> 26 + #include <linux/cpufreq.h> 27 + #include <linux/smp.h> 28 + #include <linux/of.h> 29 + 30 + #include <asm/cputhreads.h> 31 + #include <asm/reg.h> 32 + 33 + #define POWERNV_MAX_PSTATES 256 34 + 35 + static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1]; 36 + 37 + /* 38 + * Note: The set of pstates consists of contiguous integers, the 39 + * smallest of which is indicated by powernv_pstate_info.min, the 40 + * largest of which is indicated by powernv_pstate_info.max. 41 + * 42 + * The nominal pstate is the highest non-turbo pstate in this 43 + * platform. This is indicated by powernv_pstate_info.nominal. 44 + */ 45 + static struct powernv_pstate_info { 46 + int min; 47 + int max; 48 + int nominal; 49 + int nr_pstates; 50 + } powernv_pstate_info; 51 + 52 + /* 53 + * Initialize the freq table based on data obtained 54 + * from the firmware passed via device-tree 55 + */ 56 + static int init_powernv_pstates(void) 57 + { 58 + struct device_node *power_mgt; 59 + int i, pstate_min, pstate_max, pstate_nominal, nr_pstates = 0; 60 + const __be32 *pstate_ids, *pstate_freqs; 61 + u32 len_ids, len_freqs; 62 + 63 + power_mgt = of_find_node_by_path("/ibm,opal/power-mgt"); 64 + if (!power_mgt) { 65 + pr_warn("power-mgt node not found\n"); 66 + return -ENODEV; 67 + } 68 + 69 + if (of_property_read_u32(power_mgt, "ibm,pstate-min", &pstate_min)) { 70 + pr_warn("ibm,pstate-min node not found\n"); 71 + return -ENODEV; 72 + } 73 + 74 + if (of_property_read_u32(power_mgt, "ibm,pstate-max", &pstate_max)) { 75 + pr_warn("ibm,pstate-max node not found\n"); 76 + return -ENODEV; 77 + } 78 + 79 + if (of_property_read_u32(power_mgt, "ibm,pstate-nominal", 80 + &pstate_nominal)) { 81 + pr_warn("ibm,pstate-nominal not found\n"); 82 + return -ENODEV; 83 + } 84 + pr_info("cpufreq pstate min %d nominal %d max %d\n", pstate_min, 85 + pstate_nominal, pstate_max); 86 + 87 + pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids); 88 + if (!pstate_ids) { 89 + pr_warn("ibm,pstate-ids not found\n"); 90 + return -ENODEV; 91 + } 92 + 93 + pstate_freqs = of_get_property(power_mgt, "ibm,pstate-frequencies-mhz", 94 + &len_freqs); 95 + if (!pstate_freqs) { 96 + pr_warn("ibm,pstate-frequencies-mhz not found\n"); 97 + return -ENODEV; 98 + } 99 + 100 + WARN_ON(len_ids != len_freqs); 101 + nr_pstates = min(len_ids, len_freqs) / sizeof(u32); 102 + if (!nr_pstates) { 103 + pr_warn("No PStates found\n"); 104 + return -ENODEV; 105 + } 106 + 107 + pr_debug("NR PStates %d\n", nr_pstates); 108 + for (i = 0; i < nr_pstates; i++) { 109 + u32 id = be32_to_cpu(pstate_ids[i]); 110 + u32 freq = be32_to_cpu(pstate_freqs[i]); 111 + 112 + pr_debug("PState id %d freq %d MHz\n", id, freq); 113 + powernv_freqs[i].frequency = freq * 1000; /* kHz */ 114 + powernv_freqs[i].driver_data = id; 115 + } 116 + /* End of list marker entry */ 117 + powernv_freqs[i].frequency = CPUFREQ_TABLE_END; 118 + 119 + powernv_pstate_info.min = pstate_min; 120 + powernv_pstate_info.max = pstate_max; 121 + powernv_pstate_info.nominal = pstate_nominal; 122 + powernv_pstate_info.nr_pstates = nr_pstates; 123 + 124 + return 0; 125 + } 126 + 127 + /* Returns the CPU frequency corresponding to the pstate_id. */ 128 + static unsigned int pstate_id_to_freq(int pstate_id) 129 + { 130 + int i; 131 + 132 + i = powernv_pstate_info.max - pstate_id; 133 + BUG_ON(i >= powernv_pstate_info.nr_pstates || i < 0); 134 + 135 + return powernv_freqs[i].frequency; 136 + } 137 + 138 + /* 139 + * cpuinfo_nominal_freq_show - Show the nominal CPU frequency as indicated by 140 + * the firmware 141 + */ 142 + static ssize_t cpuinfo_nominal_freq_show(struct cpufreq_policy *policy, 143 + char *buf) 144 + { 145 + return sprintf(buf, "%u\n", 146 + pstate_id_to_freq(powernv_pstate_info.nominal)); 147 + } 148 + 149 + struct freq_attr cpufreq_freq_attr_cpuinfo_nominal_freq = 150 + __ATTR_RO(cpuinfo_nominal_freq); 151 + 152 + static struct freq_attr *powernv_cpu_freq_attr[] = { 153 + &cpufreq_freq_attr_scaling_available_freqs, 154 + &cpufreq_freq_attr_cpuinfo_nominal_freq, 155 + NULL, 156 + }; 157 + 158 + /* Helper routines */ 159 + 160 + /* Access helpers to power mgt SPR */ 161 + 162 + static inline unsigned long get_pmspr(unsigned long sprn) 163 + { 164 + switch (sprn) { 165 + case SPRN_PMCR: 166 + return mfspr(SPRN_PMCR); 167 + 168 + case SPRN_PMICR: 169 + return mfspr(SPRN_PMICR); 170 + 171 + case SPRN_PMSR: 172 + return mfspr(SPRN_PMSR); 173 + } 174 + BUG(); 175 + } 176 + 177 + static inline void set_pmspr(unsigned long sprn, unsigned long val) 178 + { 179 + switch (sprn) { 180 + case SPRN_PMCR: 181 + mtspr(SPRN_PMCR, val); 182 + return; 183 + 184 + case SPRN_PMICR: 185 + mtspr(SPRN_PMICR, val); 186 + return; 187 + } 188 + BUG(); 189 + } 190 + 191 + /* 192 + * Use objects of this type to query/update 193 + * pstates on a remote CPU via smp_call_function. 194 + */ 195 + struct powernv_smp_call_data { 196 + unsigned int freq; 197 + int pstate_id; 198 + }; 199 + 200 + /* 201 + * powernv_read_cpu_freq: Reads the current frequency on this CPU. 202 + * 203 + * Called via smp_call_function. 204 + * 205 + * Note: The caller of the smp_call_function should pass an argument of 206 + * the type 'struct powernv_smp_call_data *' along with this function. 207 + * 208 + * The current frequency on this CPU will be returned via 209 + * ((struct powernv_smp_call_data *)arg)->freq; 210 + */ 211 + static void powernv_read_cpu_freq(void *arg) 212 + { 213 + unsigned long pmspr_val; 214 + s8 local_pstate_id; 215 + struct powernv_smp_call_data *freq_data = arg; 216 + 217 + pmspr_val = get_pmspr(SPRN_PMSR); 218 + 219 + /* 220 + * The local pstate id corresponds bits 48..55 in the PMSR. 221 + * Note: Watch out for the sign! 222 + */ 223 + local_pstate_id = (pmspr_val >> 48) & 0xFF; 224 + freq_data->pstate_id = local_pstate_id; 225 + freq_data->freq = pstate_id_to_freq(freq_data->pstate_id); 226 + 227 + pr_debug("cpu %d pmsr %016lX pstate_id %d frequency %d kHz\n", 228 + raw_smp_processor_id(), pmspr_val, freq_data->pstate_id, 229 + freq_data->freq); 230 + } 231 + 232 + /* 233 + * powernv_cpufreq_get: Returns the CPU frequency as reported by the 234 + * firmware for CPU 'cpu'. This value is reported through the sysfs 235 + * file cpuinfo_cur_freq. 236 + */ 237 + unsigned int powernv_cpufreq_get(unsigned int cpu) 238 + { 239 + struct powernv_smp_call_data freq_data; 240 + 241 + smp_call_function_any(cpu_sibling_mask(cpu), powernv_read_cpu_freq, 242 + &freq_data, 1); 243 + 244 + return freq_data.freq; 245 + } 246 + 247 + /* 248 + * set_pstate: Sets the pstate on this CPU. 249 + * 250 + * This is called via an smp_call_function. 251 + * 252 + * The caller must ensure that freq_data is of the type 253 + * (struct powernv_smp_call_data *) and the pstate_id which needs to be set 254 + * on this CPU should be present in freq_data->pstate_id. 255 + */ 256 + static void set_pstate(void *freq_data) 257 + { 258 + unsigned long val; 259 + unsigned long pstate_ul = 260 + ((struct powernv_smp_call_data *) freq_data)->pstate_id; 261 + 262 + val = get_pmspr(SPRN_PMCR); 263 + val = val & 0x0000FFFFFFFFFFFFULL; 264 + 265 + pstate_ul = pstate_ul & 0xFF; 266 + 267 + /* Set both global(bits 56..63) and local(bits 48..55) PStates */ 268 + val = val | (pstate_ul << 56) | (pstate_ul << 48); 269 + 270 + pr_debug("Setting cpu %d pmcr to %016lX\n", 271 + raw_smp_processor_id(), val); 272 + set_pmspr(SPRN_PMCR, val); 273 + } 274 + 275 + /* 276 + * powernv_cpufreq_target_index: Sets the frequency corresponding to 277 + * the cpufreq table entry indexed by new_index on the cpus in the 278 + * mask policy->cpus 279 + */ 280 + static int powernv_cpufreq_target_index(struct cpufreq_policy *policy, 281 + unsigned int new_index) 282 + { 283 + struct powernv_smp_call_data freq_data; 284 + 285 + freq_data.pstate_id = powernv_freqs[new_index].driver_data; 286 + 287 + /* 288 + * Use smp_call_function to send IPI and execute the 289 + * mtspr on target CPU. We could do that without IPI 290 + * if current CPU is within policy->cpus (core) 291 + */ 292 + smp_call_function_any(policy->cpus, set_pstate, &freq_data, 1); 293 + 294 + return 0; 295 + } 296 + 297 + static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) 298 + { 299 + int base, i; 300 + 301 + base = cpu_first_thread_sibling(policy->cpu); 302 + 303 + for (i = 0; i < threads_per_core; i++) 304 + cpumask_set_cpu(base + i, policy->cpus); 305 + 306 + return cpufreq_table_validate_and_show(policy, powernv_freqs); 307 + } 308 + 309 + static struct cpufreq_driver powernv_cpufreq_driver = { 310 + .name = "powernv-cpufreq", 311 + .flags = CPUFREQ_CONST_LOOPS, 312 + .init = powernv_cpufreq_cpu_init, 313 + .verify = cpufreq_generic_frequency_table_verify, 314 + .target_index = powernv_cpufreq_target_index, 315 + .get = powernv_cpufreq_get, 316 + .attr = powernv_cpu_freq_attr, 317 + }; 318 + 319 + static int __init powernv_cpufreq_init(void) 320 + { 321 + int rc = 0; 322 + 323 + /* Discover pstates from device tree and init */ 324 + rc = init_powernv_pstates(); 325 + if (rc) { 326 + pr_info("powernv-cpufreq disabled. System does not support PState control\n"); 327 + return rc; 328 + } 329 + 330 + return cpufreq_register_driver(&powernv_cpufreq_driver); 331 + } 332 + module_init(powernv_cpufreq_init); 333 + 334 + static void __exit powernv_cpufreq_exit(void) 335 + { 336 + cpufreq_unregister_driver(&powernv_cpufreq_driver); 337 + } 338 + module_exit(powernv_cpufreq_exit); 339 + 340 + MODULE_LICENSE("GPL"); 341 + MODULE_AUTHOR("Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com>");
-1
drivers/cpufreq/ppc-corenet-cpufreq.c
··· 13 13 #include <linux/clk.h> 14 14 #include <linux/cpufreq.h> 15 15 #include <linux/errno.h> 16 - #include <sysdev/fsl_soc.h> 17 16 #include <linux/init.h> 18 17 #include <linux/kernel.h> 19 18 #include <linux/module.h>
+9 -9
drivers/cpufreq/ppc_cbe_cpufreq.c
··· 32 32 33 33 /* the CBE supports an 8 step frequency scaling */ 34 34 static struct cpufreq_frequency_table cbe_freqs[] = { 35 - {1, 0}, 36 - {2, 0}, 37 - {3, 0}, 38 - {4, 0}, 39 - {5, 0}, 40 - {6, 0}, 41 - {8, 0}, 42 - {10, 0}, 43 - {0, CPUFREQ_TABLE_END}, 35 + {0, 1, 0}, 36 + {0, 2, 0}, 37 + {0, 3, 0}, 38 + {0, 4, 0}, 39 + {0, 5, 0}, 40 + {0, 6, 0}, 41 + {0, 8, 0}, 42 + {0, 10, 0}, 43 + {0, 0, CPUFREQ_TABLE_END}, 44 44 }; 45 45 46 46 /*
+10 -10
drivers/cpufreq/s3c2416-cpufreq.c
··· 72 72 #endif 73 73 74 74 static struct cpufreq_frequency_table s3c2416_freq_table[] = { 75 - { SOURCE_HCLK, FREQ_DVS }, 76 - { SOURCE_ARMDIV, 133333 }, 77 - { SOURCE_ARMDIV, 266666 }, 78 - { SOURCE_ARMDIV, 400000 }, 79 - { 0, CPUFREQ_TABLE_END }, 75 + { 0, SOURCE_HCLK, FREQ_DVS }, 76 + { 0, SOURCE_ARMDIV, 133333 }, 77 + { 0, SOURCE_ARMDIV, 266666 }, 78 + { 0, SOURCE_ARMDIV, 400000 }, 79 + { 0, 0, CPUFREQ_TABLE_END }, 80 80 }; 81 81 82 82 static struct cpufreq_frequency_table s3c2450_freq_table[] = { 83 - { SOURCE_HCLK, FREQ_DVS }, 84 - { SOURCE_ARMDIV, 133500 }, 85 - { SOURCE_ARMDIV, 267000 }, 86 - { SOURCE_ARMDIV, 534000 }, 87 - { 0, CPUFREQ_TABLE_END }, 83 + { 0, SOURCE_HCLK, FREQ_DVS }, 84 + { 0, SOURCE_ARMDIV, 133500 }, 85 + { 0, SOURCE_ARMDIV, 267000 }, 86 + { 0, SOURCE_ARMDIV, 534000 }, 87 + { 0, 0, CPUFREQ_TABLE_END }, 88 88 }; 89 89 90 90 static unsigned int s3c2416_cpufreq_get_speed(unsigned int cpu)
+2 -2
drivers/cpufreq/s3c24xx-cpufreq.c
··· 586 586 size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0); 587 587 size++; 588 588 589 - ftab = kmalloc(sizeof(*ftab) * size, GFP_KERNEL); 589 + ftab = kzalloc(sizeof(*ftab) * size, GFP_KERNEL); 590 590 if (!ftab) { 591 591 printk(KERN_ERR "%s: no memory for tables\n", __func__); 592 592 return -ENOMEM; ··· 664 664 665 665 size = sizeof(*vals) * (plls_no + 1); 666 666 667 - vals = kmalloc(size, GFP_KERNEL); 667 + vals = kzalloc(size, GFP_KERNEL); 668 668 if (vals) { 669 669 memcpy(vals, plls, size); 670 670 pll_reg = vals;
+13 -13
drivers/cpufreq/s3c64xx-cpufreq.c
··· 37 37 }; 38 38 39 39 static struct cpufreq_frequency_table s3c64xx_freq_table[] = { 40 - { 0, 66000 }, 41 - { 0, 100000 }, 42 - { 0, 133000 }, 43 - { 1, 200000 }, 44 - { 1, 222000 }, 45 - { 1, 266000 }, 46 - { 2, 333000 }, 47 - { 2, 400000 }, 48 - { 2, 532000 }, 49 - { 2, 533000 }, 50 - { 3, 667000 }, 51 - { 4, 800000 }, 52 - { 0, CPUFREQ_TABLE_END }, 40 + { 0, 0, 66000 }, 41 + { 0, 0, 100000 }, 42 + { 0, 0, 133000 }, 43 + { 0, 1, 200000 }, 44 + { 0, 1, 222000 }, 45 + { 0, 1, 266000 }, 46 + { 0, 2, 333000 }, 47 + { 0, 2, 400000 }, 48 + { 0, 2, 532000 }, 49 + { 0, 2, 533000 }, 50 + { 0, 3, 667000 }, 51 + { 0, 4, 800000 }, 52 + { 0, 0, CPUFREQ_TABLE_END }, 53 53 }; 54 54 #endif 55 55
+6 -6
drivers/cpufreq/s5pv210-cpufreq.c
··· 64 64 }; 65 65 66 66 static struct cpufreq_frequency_table s5pv210_freq_table[] = { 67 - {L0, 1000*1000}, 68 - {L1, 800*1000}, 69 - {L2, 400*1000}, 70 - {L3, 200*1000}, 71 - {L4, 100*1000}, 72 - {0, CPUFREQ_TABLE_END}, 67 + {0, L0, 1000*1000}, 68 + {0, L1, 800*1000}, 69 + {0, L2, 400*1000}, 70 + {0, L3, 200*1000}, 71 + {0, L4, 100*1000}, 72 + {0, 0, CPUFREQ_TABLE_END}, 73 73 }; 74 74 75 75 static struct regulator *arm_regulator;
+3 -3
drivers/cpufreq/sc520_freq.c
··· 33 33 #define PFX "sc520_freq: " 34 34 35 35 static struct cpufreq_frequency_table sc520_freq_table[] = { 36 - {0x01, 100000}, 37 - {0x02, 133000}, 38 - {0, CPUFREQ_TABLE_END}, 36 + {0, 0x01, 100000}, 37 + {0, 0x02, 133000}, 38 + {0, 0, CPUFREQ_TABLE_END}, 39 39 }; 40 40 41 41 static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu)
+2 -5
drivers/cpufreq/spear-cpufreq.c
··· 195 195 cnt = prop->length / sizeof(u32); 196 196 val = prop->value; 197 197 198 - freq_tbl = kmalloc(sizeof(*freq_tbl) * (cnt + 1), GFP_KERNEL); 198 + freq_tbl = kzalloc(sizeof(*freq_tbl) * (cnt + 1), GFP_KERNEL); 199 199 if (!freq_tbl) { 200 200 ret = -ENOMEM; 201 201 goto out_put_node; 202 202 } 203 203 204 - for (i = 0; i < cnt; i++) { 205 - freq_tbl[i].driver_data = i; 204 + for (i = 0; i < cnt; i++) 206 205 freq_tbl[i].frequency = be32_to_cpup(val++); 207 - } 208 206 209 - freq_tbl[i].driver_data = i; 210 207 freq_tbl[i].frequency = CPUFREQ_TABLE_END; 211 208 212 209 spear_cpufreq.freq_tbl = freq_tbl;
+3 -3
drivers/cpufreq/speedstep-ich.c
··· 49 49 * are in kHz for the time being. 50 50 */ 51 51 static struct cpufreq_frequency_table speedstep_freqs[] = { 52 - {SPEEDSTEP_HIGH, 0}, 53 - {SPEEDSTEP_LOW, 0}, 54 - {0, CPUFREQ_TABLE_END}, 52 + {0, SPEEDSTEP_HIGH, 0}, 53 + {0, SPEEDSTEP_LOW, 0}, 54 + {0, 0, CPUFREQ_TABLE_END}, 55 55 }; 56 56 57 57
+3 -3
drivers/cpufreq/speedstep-smi.c
··· 42 42 * are in kHz for the time being. 43 43 */ 44 44 static struct cpufreq_frequency_table speedstep_freqs[] = { 45 - {SPEEDSTEP_HIGH, 0}, 46 - {SPEEDSTEP_LOW, 0}, 47 - {0, CPUFREQ_TABLE_END}, 45 + {0, SPEEDSTEP_HIGH, 0}, 46 + {0, SPEEDSTEP_LOW, 0}, 47 + {0, 0, CPUFREQ_TABLE_END}, 48 48 }; 49 49 50 50 #define GET_SPEEDSTEP_OWNER 0
+1 -1
drivers/cpufreq/unicore2-cpufreq.c
··· 45 45 freqs.new = target_freq; 46 46 47 47 cpufreq_freq_transition_begin(policy, &freqs); 48 - ret = clk_set_rate(policy->mclk, target_freq * 1000); 48 + ret = clk_set_rate(policy->clk, target_freq * 1000); 49 49 cpufreq_freq_transition_end(policy, &freqs, ret); 50 50 51 51 return ret;
+3
drivers/cpuidle/sysfs.c
··· 293 293 } 294 294 295 295 define_show_state_function(exit_latency) 296 + define_show_state_function(target_residency) 296 297 define_show_state_function(power_usage) 297 298 define_show_state_ull_function(usage) 298 299 define_show_state_ull_function(time) ··· 305 304 define_one_state_ro(name, show_state_name); 306 305 define_one_state_ro(desc, show_state_desc); 307 306 define_one_state_ro(latency, show_state_exit_latency); 307 + define_one_state_ro(residency, show_state_target_residency); 308 308 define_one_state_ro(power, show_state_power_usage); 309 309 define_one_state_ro(usage, show_state_usage); 310 310 define_one_state_ro(time, show_state_time); ··· 315 313 &attr_name.attr, 316 314 &attr_desc.attr, 317 315 &attr_latency.attr, 316 + &attr_residency.attr, 318 317 &attr_power.attr, 319 318 &attr_usage.attr, 320 319 &attr_time.attr,
+198 -6
drivers/idle/intel_idle.c
··· 196 196 .enter = NULL } 197 197 }; 198 198 199 + static struct cpuidle_state byt_cstates[] = { 200 + { 201 + .name = "C1-BYT", 202 + .desc = "MWAIT 0x00", 203 + .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 204 + .exit_latency = 1, 205 + .target_residency = 1, 206 + .enter = &intel_idle }, 207 + { 208 + .name = "C1E-BYT", 209 + .desc = "MWAIT 0x01", 210 + .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 211 + .exit_latency = 15, 212 + .target_residency = 30, 213 + .enter = &intel_idle }, 214 + { 215 + .name = "C6N-BYT", 216 + .desc = "MWAIT 0x58", 217 + .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 218 + .exit_latency = 40, 219 + .target_residency = 275, 220 + .enter = &intel_idle }, 221 + { 222 + .name = "C6S-BYT", 223 + .desc = "MWAIT 0x52", 224 + .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 225 + .exit_latency = 140, 226 + .target_residency = 560, 227 + .enter = &intel_idle }, 228 + { 229 + .name = "C7-BYT", 230 + .desc = "MWAIT 0x60", 231 + .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 232 + .exit_latency = 1200, 233 + .target_residency = 1500, 234 + .enter = &intel_idle }, 235 + { 236 + .name = "C7S-BYT", 237 + .desc = "MWAIT 0x64", 238 + .flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 239 + .exit_latency = 10000, 240 + .target_residency = 20000, 241 + .enter = &intel_idle }, 242 + { 243 + .enter = NULL } 244 + }; 245 + 199 246 static struct cpuidle_state ivb_cstates[] = { 200 247 { 201 248 .name = "C1-IVB", ··· 278 231 .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 279 232 .exit_latency = 87, 280 233 .target_residency = 300, 234 + .enter = &intel_idle }, 235 + { 236 + .enter = NULL } 237 + }; 238 + 239 + static struct cpuidle_state ivt_cstates[] = { 240 + { 241 + .name = "C1-IVT", 242 + .desc = "MWAIT 0x00", 243 + .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 244 + .exit_latency = 1, 245 + .target_residency = 1, 246 + .enter = &intel_idle }, 247 + { 248 + .name = "C1E-IVT", 249 + .desc = "MWAIT 0x01", 250 + .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 251 + .exit_latency = 10, 252 + .target_residency = 80, 253 + .enter = &intel_idle }, 254 + { 255 + .name = "C3-IVT", 256 + .desc = "MWAIT 0x10", 257 + .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 258 + .exit_latency = 59, 259 + .target_residency = 156, 260 + .enter = &intel_idle }, 261 + { 262 + .name = "C6-IVT", 263 + .desc = "MWAIT 0x20", 264 + .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 265 + .exit_latency = 82, 266 + .target_residency = 300, 267 + .enter = &intel_idle }, 268 + { 269 + .enter = NULL } 270 + }; 271 + 272 + static struct cpuidle_state ivt_cstates_4s[] = { 273 + { 274 + .name = "C1-IVT-4S", 275 + .desc = "MWAIT 0x00", 276 + .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 277 + .exit_latency = 1, 278 + .target_residency = 1, 279 + .enter = &intel_idle }, 280 + { 281 + .name = "C1E-IVT-4S", 282 + .desc = "MWAIT 0x01", 283 + .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 284 + .exit_latency = 10, 285 + .target_residency = 250, 286 + .enter = &intel_idle }, 287 + { 288 + .name = "C3-IVT-4S", 289 + .desc = "MWAIT 0x10", 290 + .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 291 + .exit_latency = 59, 292 + .target_residency = 300, 293 + .enter = &intel_idle }, 294 + { 295 + .name = "C6-IVT-4S", 296 + .desc = "MWAIT 0x20", 297 + .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 298 + .exit_latency = 84, 299 + .target_residency = 400, 300 + .enter = &intel_idle }, 301 + { 302 + .enter = NULL } 303 + }; 304 + 305 + static struct cpuidle_state ivt_cstates_8s[] = { 306 + { 307 + .name = "C1-IVT-8S", 308 + .desc = "MWAIT 0x00", 309 + .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID, 310 + .exit_latency = 1, 311 + .target_residency = 1, 312 + .enter = &intel_idle }, 313 + { 314 + .name = "C1E-IVT-8S", 315 + .desc = "MWAIT 0x01", 316 + .flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_TIME_VALID, 317 + .exit_latency = 10, 318 + .target_residency = 500, 319 + .enter = &intel_idle }, 320 + { 321 + .name = "C3-IVT-8S", 322 + .desc = "MWAIT 0x10", 323 + .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 324 + .exit_latency = 59, 325 + .target_residency = 600, 326 + .enter = &intel_idle }, 327 + { 328 + .name = "C6-IVT-8S", 329 + .desc = "MWAIT 0x20", 330 + .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, 331 + .exit_latency = 88, 332 + .target_residency = 700, 281 333 .enter = &intel_idle }, 282 334 { 283 335 .enter = NULL } ··· 610 464 .disable_promotion_to_c1e = true, 611 465 }; 612 466 467 + static const struct idle_cpu idle_cpu_byt = { 468 + .state_table = byt_cstates, 469 + .disable_promotion_to_c1e = true, 470 + }; 471 + 613 472 static const struct idle_cpu idle_cpu_ivb = { 614 473 .state_table = ivb_cstates, 474 + .disable_promotion_to_c1e = true, 475 + }; 476 + 477 + static const struct idle_cpu idle_cpu_ivt = { 478 + .state_table = ivt_cstates, 615 479 .disable_promotion_to_c1e = true, 616 480 }; 617 481 ··· 650 494 ICPU(0x2f, idle_cpu_nehalem), 651 495 ICPU(0x2a, idle_cpu_snb), 652 496 ICPU(0x2d, idle_cpu_snb), 497 + ICPU(0x36, idle_cpu_atom), 498 + ICPU(0x37, idle_cpu_byt), 653 499 ICPU(0x3a, idle_cpu_ivb), 654 - ICPU(0x3e, idle_cpu_ivb), 500 + ICPU(0x3e, idle_cpu_ivt), 655 501 ICPU(0x3c, idle_cpu_hsw), 656 502 ICPU(0x3f, idle_cpu_hsw), 657 503 ICPU(0x45, idle_cpu_hsw), ··· 730 572 free_percpu(intel_idle_cpuidle_devices); 731 573 return; 732 574 } 575 + 576 + /* 577 + * intel_idle_state_table_update() 578 + * 579 + * Update the default state_table for this CPU-id 580 + * 581 + * Currently used to access tuned IVT multi-socket targets 582 + * Assumption: num_sockets == (max_package_num + 1) 583 + */ 584 + void intel_idle_state_table_update(void) 585 + { 586 + /* IVT uses a different table for 1-2, 3-4, and > 4 sockets */ 587 + if (boot_cpu_data.x86_model == 0x3e) { /* IVT */ 588 + int cpu, package_num, num_sockets = 1; 589 + 590 + for_each_online_cpu(cpu) { 591 + package_num = topology_physical_package_id(cpu); 592 + if (package_num + 1 > num_sockets) { 593 + num_sockets = package_num + 1; 594 + 595 + if (num_sockets > 4) 596 + cpuidle_state_table = ivt_cstates_8s; 597 + return; 598 + } 599 + } 600 + 601 + if (num_sockets > 2) 602 + cpuidle_state_table = ivt_cstates_4s; 603 + /* else, 1 and 2 socket systems use default ivt_cstates */ 604 + } 605 + return; 606 + } 607 + 733 608 /* 734 609 * intel_idle_cpuidle_driver_init() 735 610 * allocate, initialize cpuidle_states ··· 772 581 int cstate; 773 582 struct cpuidle_driver *drv = &intel_idle_driver; 774 583 584 + intel_idle_state_table_update(); 585 + 775 586 drv->state_count = 1; 776 587 777 588 for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) { 778 - int num_substates, mwait_hint, mwait_cstate, mwait_substate; 589 + int num_substates, mwait_hint, mwait_cstate; 779 590 780 591 if (cpuidle_state_table[cstate].enter == NULL) 781 592 break; ··· 790 597 791 598 mwait_hint = flg2MWAIT(cpuidle_state_table[cstate].flags); 792 599 mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint); 793 - mwait_substate = MWAIT_HINT2SUBSTATE(mwait_hint); 794 600 795 - /* does the state exist in CPUID.MWAIT? */ 601 + /* number of sub-states for this state in CPUID.MWAIT */ 796 602 num_substates = (mwait_substates >> ((mwait_cstate + 1) * 4)) 797 603 & MWAIT_SUBSTATE_MASK; 798 604 799 - /* if sub-state in table is not enumerated by CPUID */ 800 - if ((mwait_substate + 1) > num_substates) 605 + /* if NO sub-states for this state in CPUID, skip it */ 606 + if (num_substates == 0) 801 607 continue; 802 608 803 609 if (((mwait_cstate + 1) > 2) &&
+6 -3
include/linux/cpufreq.h
··· 455 455 * FREQUENCY TABLE HELPERS * 456 456 *********************************************************************/ 457 457 458 - #define CPUFREQ_ENTRY_INVALID ~0 459 - #define CPUFREQ_TABLE_END ~1 460 - #define CPUFREQ_BOOST_FREQ ~2 458 + /* Special Values of .frequency field */ 459 + #define CPUFREQ_ENTRY_INVALID ~0 460 + #define CPUFREQ_TABLE_END ~1 461 + /* Special Values of .flags field */ 462 + #define CPUFREQ_BOOST_FREQ (1 << 0) 461 463 462 464 struct cpufreq_frequency_table { 465 + unsigned int flags; 463 466 unsigned int driver_data; /* driver specific data, not used by core */ 464 467 unsigned int frequency; /* kHz - doesn't need to be in ascending 465 468 * order */
+48 -79
tools/power/x86/turbostat/turbostat.8
··· 47 47 .PP 48 48 .SH FIELD DESCRIPTIONS 49 49 .nf 50 - \fBpk\fP processor package number. 51 - \fBcor\fP processor core number. 50 + \fBPackage\fP processor package number. 51 + \fBCore\fP processor core number. 52 52 \fBCPU\fP Linux CPU (logical processor) number. 53 53 Note that multiple CPUs per core indicate support for Intel(R) Hyper-Threading Technology. 54 - \fB%c0\fP percent of the interval that the CPU retired instructions. 55 - \fBGHz\fP average clock rate while the CPU was in c0 state. 56 - \fBTSC\fP average GHz that the TSC ran during the entire interval. 57 - \fB%c1, %c3, %c6, %c7\fP show the percentage residency in hardware core idle states. 58 - \fBCTMP\fP Degrees Celsius reported by the per-core Digital Thermal Sensor. 59 - \fBPTMP\fP Degrees Celsius reported by the per-package Package Thermal Monitor. 60 - \fB%pc2, %pc3, %pc6, %pc7\fP percentage residency in hardware package idle states. 61 - \fBPkg_W\fP Watts consumed by the whole package. 62 - \fBCor_W\fP Watts consumed by the core part of the package. 63 - \fBGFX_W\fP Watts consumed by the Graphics part of the package -- available only on client processors. 64 - \fBRAM_W\fP Watts consumed by the DRAM DIMMS -- available only on server processors. 54 + \fBAVG_MHz\fP number of cycles executed divided by time elapsed. 55 + \fB%Buzy\fP percent of the interval that the CPU retired instructions, aka. % of time in "C0" state. 56 + \fBBzy_MHz\fP average clock rate while the CPU was busy (in "c0" state). 57 + \fBTSC_MHz\fP average MHz that the TSC ran during the entire interval. 58 + \fBCPU%c1, CPU%c3, CPU%c6, CPU%c7\fP show the percentage residency in hardware core idle states. 59 + \fBCoreTmp\fP Degrees Celsius reported by the per-core Digital Thermal Sensor. 60 + \fBPkgTtmp\fP Degrees Celsius reported by the per-package Package Thermal Monitor. 61 + \fBPkg%pc2, Pkg%pc3, Pkg%pc6, Pkg%pc7\fP percentage residency in hardware package idle states. 62 + \fBPkgWatt\fP Watts consumed by the whole package. 63 + \fBCorWatt\fP Watts consumed by the core part of the package. 64 + \fBGFXWatt\fP Watts consumed by the Graphics part of the package -- available only on client processors. 65 + \fBRAMWatt\fP Watts consumed by the DRAM DIMMS -- available only on server processors. 65 66 \fBPKG_%\fP percent of the interval that RAPL throttling was active on the Package. 66 67 \fBRAM_%\fP percent of the interval that RAPL throttling was active on DRAM. 67 68 .fi ··· 79 78 Subsequent rows show per-CPU statistics. 80 79 81 80 .nf 82 - [root@sandy]# ./turbostat 83 - cor CPU %c0 GHz TSC %c1 %c3 %c6 %c7 CTMP PTMP %pc2 %pc3 %pc6 %pc7 Pkg_W Cor_W GFX_W 84 - 0.06 0.80 2.29 0.11 0.00 0.00 99.83 47 40 0.26 0.01 0.44 98.78 3.49 0.12 0.14 85 - 0 0 0.07 0.80 2.29 0.07 0.00 0.00 99.86 40 40 0.26 0.01 0.44 98.78 3.49 0.12 0.14 86 - 0 4 0.03 0.80 2.29 0.12 87 - 1 1 0.04 0.80 2.29 0.25 0.01 0.00 99.71 40 88 - 1 5 0.16 0.80 2.29 0.13 89 - 2 2 0.05 0.80 2.29 0.06 0.01 0.00 99.88 40 90 - 2 6 0.03 0.80 2.29 0.08 91 - 3 3 0.05 0.80 2.29 0.08 0.00 0.00 99.87 47 92 - 3 7 0.04 0.84 2.29 0.09 93 - .fi 94 - .SH SUMMARY EXAMPLE 95 - The "-s" option prints the column headers just once, 96 - and then the one line system summary for each sample interval. 97 - 98 - .nf 99 - [root@wsm]# turbostat -S 100 - %c0 GHz TSC %c1 %c3 %c6 CTMP %pc3 %pc6 101 - 1.40 2.81 3.38 10.78 43.47 44.35 42 13.67 2.09 102 - 1.34 2.90 3.38 11.48 58.96 28.23 41 19.89 0.15 103 - 1.55 2.72 3.38 26.73 37.66 34.07 42 2.53 2.80 104 - 1.37 2.83 3.38 16.95 60.05 21.63 42 5.76 0.20 81 + [root@ivy]# ./turbostat 82 + Core CPU Avg_MHz %Busy Bzy_MHz TSC_MHz SMI CPU%c1 CPU%c3 CPU%c6 CPU%c7 CoreTmp PkgTmp Pkg%pc2 Pkg%pc3 Pkg%pc6 Pkg%pc7 PkgWatt CorWatt GFXWatt 83 + - - 6 0.36 1596 3492 0 0.59 0.01 99.04 0.00 23 24 23.82 0.01 72.47 0.00 6.40 1.01 0.00 84 + 0 0 9 0.58 1596 3492 0 0.28 0.01 99.13 0.00 23 24 23.82 0.01 72.47 0.00 6.40 1.01 0.00 85 + 0 4 1 0.07 1596 3492 0 0.79 86 + 1 1 10 0.65 1596 3492 0 0.59 0.00 98.76 0.00 23 87 + 1 5 5 0.28 1596 3492 0 0.95 88 + 2 2 10 0.66 1596 3492 0 0.41 0.01 98.92 0.00 23 89 + 2 6 2 0.10 1597 3492 0 0.97 90 + 3 3 3 0.20 1596 3492 0 0.44 0.00 99.37 0.00 23 91 + 3 7 5 0.31 1596 3492 0 0.33 105 92 .fi 106 93 .SH VERBOSE EXAMPLE 107 94 The "-v" option adds verbosity to the output: ··· 143 154 until ^C while the other CPUs are mostly idle: 144 155 145 156 .nf 146 - [root@x980 lenb]# ./turbostat cat /dev/zero > /dev/null 157 + root@ivy: turbostat cat /dev/zero > /dev/null 147 158 ^C 148 - cor CPU %c0 GHz TSC %c1 %c3 %c6 %pc3 %pc6 149 - 8.86 3.61 3.38 15.06 31.19 44.89 0.00 0.00 150 - 0 0 1.46 3.22 3.38 16.84 29.48 52.22 0.00 0.00 151 - 0 6 0.21 3.06 3.38 18.09 152 - 1 2 0.53 3.33 3.38 2.80 46.40 50.27 153 - 1 8 0.89 3.47 3.38 2.44 154 - 2 4 1.36 3.43 3.38 9.04 23.71 65.89 155 - 2 10 0.18 2.86 3.38 10.22 156 - 8 1 0.04 2.87 3.38 99.96 0.01 0.00 157 - 8 7 99.72 3.63 3.38 0.27 158 - 9 3 0.31 3.21 3.38 7.64 56.55 35.50 159 - 9 9 0.08 2.95 3.38 7.88 160 - 10 5 1.42 3.43 3.38 2.14 30.99 65.44 161 - 10 11 0.16 2.88 3.38 3.40 159 + Core CPU Avg_MHz %Busy Bzy_MHz TSC_MHz SMI CPU%c1 CPU%c3 CPU%c6 CPU%c7 CoreTmp PkgTmp Pkg%pc2 Pkg%pc3 Pkg%pc6 Pkg%pc7 PkgWatt CorWatt GFXWatt 160 + - - 496 12.75 3886 3492 0 13.16 0.04 74.04 0.00 36 36 0.00 0.00 0.00 0.00 23.15 17.65 0.00 161 + 0 0 22 0.57 3830 3492 0 0.83 0.02 98.59 0.00 27 36 0.00 0.00 0.00 0.00 23.15 17.65 0.00 162 + 0 4 9 0.24 3829 3492 0 1.15 163 + 1 1 4 0.09 3783 3492 0 99.91 0.00 0.00 0.00 36 164 + 1 5 3880 99.82 3888 3492 0 0.18 165 + 2 2 17 0.44 3813 3492 0 0.77 0.04 98.75 0.00 28 166 + 2 6 12 0.32 3823 3492 0 0.89 167 + 3 3 16 0.43 3844 3492 0 0.63 0.11 98.84 0.00 30 168 + 3 7 4 0.11 3827 3492 0 0.94 169 + 30.372243 sec 170 + 162 171 .fi 163 - Above the cycle soaker drives cpu7 up its 3.6 GHz turbo limit 172 + Above the cycle soaker drives cpu5 up its 3.8 GHz turbo limit 164 173 while the other processors are generally in various states of idle. 165 174 166 - Note that cpu1 and cpu7 are HT siblings within core8. 167 - As cpu7 is very busy, it prevents its sibling, cpu1, 175 + Note that cpu1 and cpu5 are HT siblings within core1. 176 + As cpu5 is very busy, it prevents its sibling, cpu1, 168 177 from entering a c-state deeper than c1. 169 178 170 - Note that turbostat reports average GHz of 3.63, while 171 - the arithmetic average of the GHz column above is lower. 172 - This is a weighted average, where the weight is %c0. ie. it is the total number of 173 - un-halted cycles elapsed per time divided by the number of CPUs. 174 - .SH SMI COUNTING EXAMPLE 175 - On Intel Nehalem and newer processors, MSR 0x34 is a System Management Mode Interrupt (SMI) counter. 176 - This counter is shown by default under the "SMI" column. 177 - .nf 178 - [root@x980 ~]# turbostat 179 - cor CPU %c0 GHz TSC SMI %c1 %c3 %c6 CTMP %pc3 %pc6 180 - 0.11 1.91 3.38 0 1.84 0.26 97.79 29 0.82 83.87 181 - 0 0 0.40 1.63 3.38 0 10.27 0.12 89.20 20 0.82 83.88 182 - 0 6 0.06 1.63 3.38 0 10.61 183 - 1 2 0.37 2.63 3.38 0 0.02 0.10 99.51 22 184 - 1 8 0.01 1.62 3.38 0 0.39 185 - 2 4 0.07 1.62 3.38 0 0.04 0.07 99.82 23 186 - 2 10 0.02 1.62 3.38 0 0.09 187 - 8 1 0.23 1.64 3.38 0 0.10 1.07 98.60 24 188 - 8 7 0.02 1.64 3.38 0 0.31 189 - 9 3 0.03 1.62 3.38 0 0.03 0.05 99.89 29 190 - 9 9 0.02 1.62 3.38 0 0.05 191 - 10 5 0.07 1.62 3.38 0 0.08 0.12 99.73 27 192 - 10 11 0.03 1.62 3.38 0 0.13 193 - ^C 194 - .fi 179 + Note that the Avg_MHz column reflects the total number of cycles executed 180 + divided by the measurement interval. If the %Busy column is 100%, 181 + then the processor was running at that speed the entire interval. 182 + The Avg_MHz multiplied by the %Busy results in the Bzy_MHz -- 183 + which is the average frequency while the processor was executing -- 184 + not including any non-busy idle time. 185 + 195 186 .SH NOTES 196 187 197 188 .B "turbostat "
+114 -128
tools/power/x86/turbostat/turbostat.c
··· 56 56 unsigned int use_c1_residency_msr; 57 57 unsigned int has_aperf; 58 58 unsigned int has_epb; 59 - unsigned int units = 1000000000; /* Ghz etc */ 59 + unsigned int units = 1000000; /* MHz etc */ 60 60 unsigned int genuine_intel; 61 61 unsigned int has_invariant_tsc; 62 62 unsigned int do_nehalem_platform_info; ··· 264 264 return 0; 265 265 } 266 266 267 + /* 268 + * Example Format w/ field column widths: 269 + * 270 + * Package Core CPU Avg_MHz Bzy_MHz TSC_MHz SMI %Busy CPU_%c1 CPU_%c3 CPU_%c6 CPU_%c7 CoreTmp PkgTmp Pkg%pc2 Pkg%pc3 Pkg%pc6 Pkg%pc7 PkgWatt CorWatt GFXWatt 271 + * 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 1234567 272 + */ 273 + 267 274 void print_header(void) 268 275 { 269 276 if (show_pkg) 270 - outp += sprintf(outp, "pk"); 271 - if (show_pkg) 272 - outp += sprintf(outp, " "); 277 + outp += sprintf(outp, "Package "); 273 278 if (show_core) 274 - outp += sprintf(outp, "cor"); 279 + outp += sprintf(outp, " Core "); 275 280 if (show_cpu) 276 - outp += sprintf(outp, " CPU"); 277 - if (show_pkg || show_core || show_cpu) 278 - outp += sprintf(outp, " "); 279 - if (do_nhm_cstates) 280 - outp += sprintf(outp, " %%c0"); 281 + outp += sprintf(outp, " CPU "); 281 282 if (has_aperf) 282 - outp += sprintf(outp, " GHz"); 283 - outp += sprintf(outp, " TSC"); 283 + outp += sprintf(outp, "Avg_MHz "); 284 + if (do_nhm_cstates) 285 + outp += sprintf(outp, " %%Busy "); 286 + if (has_aperf) 287 + outp += sprintf(outp, "Bzy_MHz "); 288 + outp += sprintf(outp, "TSC_MHz "); 284 289 if (do_smi) 285 - outp += sprintf(outp, " SMI"); 290 + outp += sprintf(outp, " SMI "); 286 291 if (extra_delta_offset32) 287 - outp += sprintf(outp, " count 0x%03X", extra_delta_offset32); 292 + outp += sprintf(outp, " count 0x%03X ", extra_delta_offset32); 288 293 if (extra_delta_offset64) 289 - outp += sprintf(outp, " COUNT 0x%03X", extra_delta_offset64); 294 + outp += sprintf(outp, " COUNT 0x%03X ", extra_delta_offset64); 290 295 if (extra_msr_offset32) 291 - outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset32); 296 + outp += sprintf(outp, " MSR 0x%03X ", extra_msr_offset32); 292 297 if (extra_msr_offset64) 293 - outp += sprintf(outp, " MSR 0x%03X", extra_msr_offset64); 298 + outp += sprintf(outp, " MSR 0x%03X ", extra_msr_offset64); 294 299 if (do_nhm_cstates) 295 - outp += sprintf(outp, " %%c1"); 300 + outp += sprintf(outp, " CPU%%c1 "); 296 301 if (do_nhm_cstates && !do_slm_cstates) 297 - outp += sprintf(outp, " %%c3"); 302 + outp += sprintf(outp, " CPU%%c3 "); 298 303 if (do_nhm_cstates) 299 - outp += sprintf(outp, " %%c6"); 304 + outp += sprintf(outp, " CPU%%c6 "); 300 305 if (do_snb_cstates) 301 - outp += sprintf(outp, " %%c7"); 306 + outp += sprintf(outp, " CPU%%c7 "); 302 307 303 308 if (do_dts) 304 - outp += sprintf(outp, " CTMP"); 309 + outp += sprintf(outp, "CoreTmp "); 305 310 if (do_ptm) 306 - outp += sprintf(outp, " PTMP"); 311 + outp += sprintf(outp, " PkgTmp "); 307 312 308 313 if (do_snb_cstates) 309 - outp += sprintf(outp, " %%pc2"); 314 + outp += sprintf(outp, "Pkg%%pc2 "); 310 315 if (do_nhm_cstates && !do_slm_cstates) 311 - outp += sprintf(outp, " %%pc3"); 316 + outp += sprintf(outp, "Pkg%%pc3 "); 312 317 if (do_nhm_cstates && !do_slm_cstates) 313 - outp += sprintf(outp, " %%pc6"); 318 + outp += sprintf(outp, "Pkg%%pc6 "); 314 319 if (do_snb_cstates) 315 - outp += sprintf(outp, " %%pc7"); 320 + outp += sprintf(outp, "Pkg%%pc7 "); 316 321 if (do_c8_c9_c10) { 317 - outp += sprintf(outp, " %%pc8"); 318 - outp += sprintf(outp, " %%pc9"); 319 - outp += sprintf(outp, " %%pc10"); 322 + outp += sprintf(outp, "Pkg%%pc8 "); 323 + outp += sprintf(outp, "Pkg%%pc9 "); 324 + outp += sprintf(outp, "Pk%%pc10 "); 320 325 } 321 326 322 327 if (do_rapl && !rapl_joules) { 323 328 if (do_rapl & RAPL_PKG) 324 - outp += sprintf(outp, " Pkg_W"); 329 + outp += sprintf(outp, "PkgWatt "); 325 330 if (do_rapl & RAPL_CORES) 326 - outp += sprintf(outp, " Cor_W"); 331 + outp += sprintf(outp, "CorWatt "); 327 332 if (do_rapl & RAPL_GFX) 328 - outp += sprintf(outp, " GFX_W"); 333 + outp += sprintf(outp, "GFXWatt "); 329 334 if (do_rapl & RAPL_DRAM) 330 - outp += sprintf(outp, " RAM_W"); 335 + outp += sprintf(outp, "RAMWatt "); 331 336 if (do_rapl & RAPL_PKG_PERF_STATUS) 332 - outp += sprintf(outp, " PKG_%%"); 337 + outp += sprintf(outp, " PKG_%% "); 333 338 if (do_rapl & RAPL_DRAM_PERF_STATUS) 334 - outp += sprintf(outp, " RAM_%%"); 339 + outp += sprintf(outp, " RAM_%% "); 335 340 } else { 336 341 if (do_rapl & RAPL_PKG) 337 - outp += sprintf(outp, " Pkg_J"); 342 + outp += sprintf(outp, " Pkg_J "); 338 343 if (do_rapl & RAPL_CORES) 339 - outp += sprintf(outp, " Cor_J"); 344 + outp += sprintf(outp, " Cor_J "); 340 345 if (do_rapl & RAPL_GFX) 341 - outp += sprintf(outp, " GFX_J"); 346 + outp += sprintf(outp, " GFX_J "); 342 347 if (do_rapl & RAPL_DRAM) 343 - outp += sprintf(outp, " RAM_W"); 348 + outp += sprintf(outp, " RAM_W "); 344 349 if (do_rapl & RAPL_PKG_PERF_STATUS) 345 - outp += sprintf(outp, " PKG_%%"); 350 + outp += sprintf(outp, " PKG_%% "); 346 351 if (do_rapl & RAPL_DRAM_PERF_STATUS) 347 - outp += sprintf(outp, " RAM_%%"); 348 - outp += sprintf(outp, " time"); 352 + outp += sprintf(outp, " RAM_%% "); 353 + outp += sprintf(outp, " time "); 349 354 350 355 } 351 356 outp += sprintf(outp, "\n"); ··· 415 410 416 411 /* 417 412 * column formatting convention & formats 418 - * package: "pk" 2 columns %2d 419 - * core: "cor" 3 columns %3d 420 - * CPU: "CPU" 3 columns %3d 421 - * Pkg_W: %6.2 422 - * Cor_W: %6.2 423 - * GFX_W: %5.2 424 - * RAM_W: %5.2 425 - * GHz: "GHz" 3 columns %3.2 426 - * TSC: "TSC" 3 columns %3.2 427 - * SMI: "SMI" 4 columns %4d 428 - * percentage " %pc3" %6.2 429 - * Perf Status percentage: %5.2 430 - * "CTMP" 4 columns %4d 431 413 */ 432 414 int format_counters(struct thread_data *t, struct core_data *c, 433 415 struct pkg_data *p) 434 416 { 435 417 double interval_float; 436 - char *fmt5, *fmt6; 418 + char *fmt8; 437 419 438 420 /* if showing only 1st thread in core and this isn't one, bail out */ 439 421 if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) ··· 435 443 /* topo columns, print blanks on 1st (average) line */ 436 444 if (t == &average.threads) { 437 445 if (show_pkg) 438 - outp += sprintf(outp, " "); 439 - if (show_pkg && show_core) 440 - outp += sprintf(outp, " "); 446 + outp += sprintf(outp, " -"); 441 447 if (show_core) 442 - outp += sprintf(outp, " "); 448 + outp += sprintf(outp, " -"); 443 449 if (show_cpu) 444 - outp += sprintf(outp, " " " "); 450 + outp += sprintf(outp, " -"); 445 451 } else { 446 452 if (show_pkg) { 447 453 if (p) 448 - outp += sprintf(outp, "%2d", p->package_id); 454 + outp += sprintf(outp, "%8d", p->package_id); 449 455 else 450 - outp += sprintf(outp, " "); 456 + outp += sprintf(outp, " -"); 451 457 } 452 - if (show_pkg && show_core) 453 - outp += sprintf(outp, " "); 454 458 if (show_core) { 455 459 if (c) 456 - outp += sprintf(outp, "%3d", c->core_id); 460 + outp += sprintf(outp, "%8d", c->core_id); 457 461 else 458 - outp += sprintf(outp, " "); 462 + outp += sprintf(outp, " -"); 459 463 } 460 464 if (show_cpu) 461 - outp += sprintf(outp, " %3d", t->cpu_id); 465 + outp += sprintf(outp, "%8d", t->cpu_id); 462 466 } 467 + 468 + /* AvgMHz */ 469 + if (has_aperf) 470 + outp += sprintf(outp, "%8.0f", 471 + 1.0 / units * t->aperf / interval_float); 472 + 463 473 /* %c0 */ 464 474 if (do_nhm_cstates) { 465 - if (show_pkg || show_core || show_cpu) 466 - outp += sprintf(outp, " "); 467 475 if (!skip_c0) 468 - outp += sprintf(outp, "%6.2f", 100.0 * t->mperf/t->tsc); 476 + outp += sprintf(outp, "%8.2f", 100.0 * t->mperf/t->tsc); 469 477 else 470 - outp += sprintf(outp, " ****"); 478 + outp += sprintf(outp, "********"); 471 479 } 472 480 473 - /* GHz */ 474 - if (has_aperf) { 475 - if (!aperf_mperf_unstable) { 476 - outp += sprintf(outp, " %3.2f", 477 - 1.0 * t->tsc / units * t->aperf / 478 - t->mperf / interval_float); 479 - } else { 480 - if (t->aperf > t->tsc || t->mperf > t->tsc) { 481 - outp += sprintf(outp, " ***"); 482 - } else { 483 - outp += sprintf(outp, "%3.1f*", 484 - 1.0 * t->tsc / 485 - units * t->aperf / 486 - t->mperf / interval_float); 487 - } 488 - } 489 - } 481 + /* BzyMHz */ 482 + if (has_aperf) 483 + outp += sprintf(outp, "%8.0f", 484 + 1.0 * t->tsc / units * t->aperf / t->mperf / interval_float); 490 485 491 486 /* TSC */ 492 - outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float); 487 + outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float); 493 488 494 489 /* SMI */ 495 490 if (do_smi) 496 - outp += sprintf(outp, "%4d", t->smi_count); 491 + outp += sprintf(outp, "%8d", t->smi_count); 497 492 498 493 /* delta */ 499 494 if (extra_delta_offset32) ··· 499 520 500 521 if (do_nhm_cstates) { 501 522 if (!skip_c1) 502 - outp += sprintf(outp, " %6.2f", 100.0 * t->c1/t->tsc); 523 + outp += sprintf(outp, "%8.2f", 100.0 * t->c1/t->tsc); 503 524 else 504 - outp += sprintf(outp, " ****"); 525 + outp += sprintf(outp, "********"); 505 526 } 506 527 507 528 /* print per-core data only for 1st thread in core */ ··· 509 530 goto done; 510 531 511 532 if (do_nhm_cstates && !do_slm_cstates) 512 - outp += sprintf(outp, " %6.2f", 100.0 * c->c3/t->tsc); 533 + outp += sprintf(outp, "%8.2f", 100.0 * c->c3/t->tsc); 513 534 if (do_nhm_cstates) 514 - outp += sprintf(outp, " %6.2f", 100.0 * c->c6/t->tsc); 535 + outp += sprintf(outp, "%8.2f", 100.0 * c->c6/t->tsc); 515 536 if (do_snb_cstates) 516 - outp += sprintf(outp, " %6.2f", 100.0 * c->c7/t->tsc); 537 + outp += sprintf(outp, "%8.2f", 100.0 * c->c7/t->tsc); 517 538 518 539 if (do_dts) 519 - outp += sprintf(outp, " %4d", c->core_temp_c); 540 + outp += sprintf(outp, "%8d", c->core_temp_c); 520 541 521 542 /* print per-package data only for 1st core in package */ 522 543 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) 523 544 goto done; 524 545 525 546 if (do_ptm) 526 - outp += sprintf(outp, " %4d", p->pkg_temp_c); 547 + outp += sprintf(outp, "%8d", p->pkg_temp_c); 527 548 528 549 if (do_snb_cstates) 529 - outp += sprintf(outp, " %6.2f", 100.0 * p->pc2/t->tsc); 550 + outp += sprintf(outp, "%8.2f", 100.0 * p->pc2/t->tsc); 530 551 if (do_nhm_cstates && !do_slm_cstates) 531 - outp += sprintf(outp, " %6.2f", 100.0 * p->pc3/t->tsc); 552 + outp += sprintf(outp, "%8.2f", 100.0 * p->pc3/t->tsc); 532 553 if (do_nhm_cstates && !do_slm_cstates) 533 - outp += sprintf(outp, " %6.2f", 100.0 * p->pc6/t->tsc); 554 + outp += sprintf(outp, "%8.2f", 100.0 * p->pc6/t->tsc); 534 555 if (do_snb_cstates) 535 - outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc); 556 + outp += sprintf(outp, "%8.2f", 100.0 * p->pc7/t->tsc); 536 557 if (do_c8_c9_c10) { 537 - outp += sprintf(outp, " %6.2f", 100.0 * p->pc8/t->tsc); 538 - outp += sprintf(outp, " %6.2f", 100.0 * p->pc9/t->tsc); 539 - outp += sprintf(outp, " %6.2f", 100.0 * p->pc10/t->tsc); 558 + outp += sprintf(outp, "%8.2f", 100.0 * p->pc8/t->tsc); 559 + outp += sprintf(outp, "%8.2f", 100.0 * p->pc9/t->tsc); 560 + outp += sprintf(outp, "%8.2f", 100.0 * p->pc10/t->tsc); 540 561 } 541 562 542 563 /* 543 564 * If measurement interval exceeds minimum RAPL Joule Counter range, 544 565 * indicate that results are suspect by printing "**" in fraction place. 545 566 */ 546 - if (interval_float < rapl_joule_counter_range) { 547 - fmt5 = " %5.2f"; 548 - fmt6 = " %6.2f"; 549 - } else { 550 - fmt5 = " %3.0f**"; 551 - fmt6 = " %4.0f**"; 552 - } 567 + if (interval_float < rapl_joule_counter_range) 568 + fmt8 = "%8.2f"; 569 + else 570 + fmt8 = " %6.0f**"; 553 571 554 572 if (do_rapl && !rapl_joules) { 555 573 if (do_rapl & RAPL_PKG) 556 - outp += sprintf(outp, fmt6, p->energy_pkg * rapl_energy_units / interval_float); 574 + outp += sprintf(outp, fmt8, p->energy_pkg * rapl_energy_units / interval_float); 557 575 if (do_rapl & RAPL_CORES) 558 - outp += sprintf(outp, fmt6, p->energy_cores * rapl_energy_units / interval_float); 576 + outp += sprintf(outp, fmt8, p->energy_cores * rapl_energy_units / interval_float); 559 577 if (do_rapl & RAPL_GFX) 560 - outp += sprintf(outp, fmt5, p->energy_gfx * rapl_energy_units / interval_float); 578 + outp += sprintf(outp, fmt8, p->energy_gfx * rapl_energy_units / interval_float); 561 579 if (do_rapl & RAPL_DRAM) 562 - outp += sprintf(outp, fmt5, p->energy_dram * rapl_energy_units / interval_float); 580 + outp += sprintf(outp, fmt8, p->energy_dram * rapl_energy_units / interval_float); 563 581 if (do_rapl & RAPL_PKG_PERF_STATUS) 564 - outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); 582 + outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); 565 583 if (do_rapl & RAPL_DRAM_PERF_STATUS) 566 - outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); 584 + outp += sprintf(outp, fmt8, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); 567 585 } else { 568 586 if (do_rapl & RAPL_PKG) 569 - outp += sprintf(outp, fmt6, 587 + outp += sprintf(outp, fmt8, 570 588 p->energy_pkg * rapl_energy_units); 571 589 if (do_rapl & RAPL_CORES) 572 - outp += sprintf(outp, fmt6, 590 + outp += sprintf(outp, fmt8, 573 591 p->energy_cores * rapl_energy_units); 574 592 if (do_rapl & RAPL_GFX) 575 - outp += sprintf(outp, fmt5, 593 + outp += sprintf(outp, fmt8, 576 594 p->energy_gfx * rapl_energy_units); 577 595 if (do_rapl & RAPL_DRAM) 578 - outp += sprintf(outp, fmt5, 596 + outp += sprintf(outp, fmt8, 579 597 p->energy_dram * rapl_energy_units); 580 598 if (do_rapl & RAPL_PKG_PERF_STATUS) 581 - outp += sprintf(outp, fmt5, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); 599 + outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float); 582 600 if (do_rapl & RAPL_DRAM_PERF_STATUS) 583 - outp += sprintf(outp, fmt5, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); 584 - outp += sprintf(outp, fmt5, interval_float); 601 + outp += sprintf(outp, fmt8, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float); 602 + outp += sprintf(outp, fmt8, interval_float); 585 603 586 604 } 587 605 done: ··· 1492 1516 case 0x46: /* HSW */ 1493 1517 case 0x37: /* BYT */ 1494 1518 case 0x4D: /* AVN */ 1519 + case 0x3D: /* BDW */ 1520 + case 0x4F: /* BDX */ 1521 + case 0x56: /* BDX-DE */ 1495 1522 return 1; 1496 1523 case 0x2E: /* Nehalem-EX Xeon - Beckton */ 1497 1524 case 0x2F: /* Westmere-EX Xeon - Eagleton */ ··· 1608 1629 case 0x3C: /* HSW */ 1609 1630 case 0x45: /* HSW */ 1610 1631 case 0x46: /* HSW */ 1632 + case 0x3D: /* BDW */ 1611 1633 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO; 1612 1634 break; 1613 1635 case 0x3F: /* HSX */ 1636 + case 0x4F: /* BDX */ 1637 + case 0x56: /* BDX-DE */ 1614 1638 do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO; 1615 1639 break; 1616 1640 case 0x2D: ··· 1857 1875 case 0x3F: /* HSW */ 1858 1876 case 0x45: /* HSW */ 1859 1877 case 0x46: /* HSW */ 1878 + case 0x3D: /* BDW */ 1879 + case 0x4F: /* BDX */ 1880 + case 0x56: /* BDX-DE */ 1860 1881 return 1; 1861 1882 } 1862 1883 return 0; ··· 1871 1886 return 0; 1872 1887 1873 1888 switch (model) { 1874 - case 0x45: 1889 + case 0x45: /* HSW */ 1890 + case 0x3D: /* BDW */ 1875 1891 return 1; 1876 1892 } 1877 1893 return 0; ··· 2441 2455 cmdline(argc, argv); 2442 2456 2443 2457 if (verbose) 2444 - fprintf(stderr, "turbostat v3.6 Dec 2, 2013" 2458 + fprintf(stderr, "turbostat v3.7 Feb 6, 2014" 2445 2459 " - Len Brown <lenb@kernel.org>\n"); 2446 2460 2447 2461 turbostat_init();
+1 -1
virt/kvm/arm/arch_timer.c
··· 277 277 278 278 host_vtimer_irq = ppi; 279 279 280 - err = register_cpu_notifier(&kvm_timer_cpu_nb); 280 + err = __register_cpu_notifier(&kvm_timer_cpu_nb); 281 281 if (err) { 282 282 kvm_err("Cannot register timer CPU notifier\n"); 283 283 goto out_free;
+1 -1
virt/kvm/arm/vgic.c
··· 1496 1496 goto out; 1497 1497 } 1498 1498 1499 - ret = register_cpu_notifier(&vgic_cpu_nb); 1499 + ret = __register_cpu_notifier(&vgic_cpu_nb); 1500 1500 if (ret) { 1501 1501 kvm_err("Cannot register vgic CPU notifier\n"); 1502 1502 goto out_free_irq;