diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-11 18:22:56 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-11 18:22:56 -0500 |
commit | f57ab32a843690fe7431ebb3a2f461e689a2e3c7 (patch) | |
tree | b1316569e599668d1dd028297b569fe2ef75f651 /tools/power | |
parent | f6f18a261c1748973e9aac529ed81bb4abd9f120 (diff) | |
parent | 89ba7d8c22acb43e318ca1c82e25c8b75ef7a7b2 (diff) |
Merge branch 'pm-tools'
* pm-tools:
Creating a common structure initialization pattern for struct option
cpupower: Enable disabled Cstates if they are below max latency
cpupower: Remove debug message when using cpupower idle-set -D switch
cpupower: cpupower monitor reports uninitialized values for offline cpus
tools/power turbostat: bugfix: print MAX_NON_TURBO_RATIO
tools/power turbostat: simplify Bzy_MHz calculation
Diffstat (limited to 'tools/power')
-rw-r--r-- | tools/power/cpupower/debug/i386/dump_psb.c | 2 | ||||
-rw-r--r-- | tools/power/cpupower/man/cpupower-idle-set.1 | 4 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpufreq-info.c | 30 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpufreq-set.c | 10 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpuidle-info.c | 4 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpuidle-set.c | 33 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpupower-info.c | 4 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpupower-set.c | 2 | ||||
-rw-r--r-- | tools/power/cpupower/utils/helpers/topology.c | 23 | ||||
-rw-r--r-- | tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 9 | ||||
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 30 |
11 files changed, 88 insertions, 63 deletions
diff --git a/tools/power/cpupower/debug/i386/dump_psb.c b/tools/power/cpupower/debug/i386/dump_psb.c index 8d6a47514253..2c768cf70128 100644 --- a/tools/power/cpupower/debug/i386/dump_psb.c +++ b/tools/power/cpupower/debug/i386/dump_psb.c | |||
@@ -134,7 +134,7 @@ next_one: | |||
134 | } | 134 | } |
135 | 135 | ||
136 | static struct option info_opts[] = { | 136 | static struct option info_opts[] = { |
137 | {.name = "numpst", .has_arg=no_argument, .flag=NULL, .val='n'}, | 137 | {"numpst", no_argument, NULL, 'n'}, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | void print_help(void) | 140 | void print_help(void) |
diff --git a/tools/power/cpupower/man/cpupower-idle-set.1 b/tools/power/cpupower/man/cpupower-idle-set.1 index 3e6799d7a79f..580c4e3ea92a 100644 --- a/tools/power/cpupower/man/cpupower-idle-set.1 +++ b/tools/power/cpupower/man/cpupower-idle-set.1 | |||
@@ -20,7 +20,9 @@ Disable a specific processor sleep state. | |||
20 | Enable a specific processor sleep state. | 20 | Enable a specific processor sleep state. |
21 | .TP | 21 | .TP |
22 | \fB\-D\fR \fB\-\-disable-by-latency\fR <LATENCY> | 22 | \fB\-D\fR \fB\-\-disable-by-latency\fR <LATENCY> |
23 | Disable all idle states with a equal or higher latency than <LATENCY> | 23 | Disable all idle states with a equal or higher latency than <LATENCY>. |
24 | |||
25 | Enable all idle states with a latency lower than <LATENCY>. | ||
24 | .TP | 26 | .TP |
25 | \fB\-E\fR \fB\-\-enable-all\fR | 27 | \fB\-E\fR \fB\-\-enable-all\fR |
26 | Enable all idle states if not enabled already. | 28 | Enable all idle states if not enabled already. |
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index b4b90a97662c..0e6764330241 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c | |||
@@ -536,21 +536,21 @@ static int get_latency(unsigned int cpu, unsigned int human) | |||
536 | } | 536 | } |
537 | 537 | ||
538 | static struct option info_opts[] = { | 538 | static struct option info_opts[] = { |
539 | { .name = "debug", .has_arg = no_argument, .flag = NULL, .val = 'e'}, | 539 | {"debug", no_argument, NULL, 'e'}, |
540 | { .name = "boost", .has_arg = no_argument, .flag = NULL, .val = 'b'}, | 540 | {"boost", no_argument, NULL, 'b'}, |
541 | { .name = "freq", .has_arg = no_argument, .flag = NULL, .val = 'f'}, | 541 | {"freq", no_argument, NULL, 'f'}, |
542 | { .name = "hwfreq", .has_arg = no_argument, .flag = NULL, .val = 'w'}, | 542 | {"hwfreq", no_argument, NULL, 'w'}, |
543 | { .name = "hwlimits", .has_arg = no_argument, .flag = NULL, .val = 'l'}, | 543 | {"hwlimits", no_argument, NULL, 'l'}, |
544 | { .name = "driver", .has_arg = no_argument, .flag = NULL, .val = 'd'}, | 544 | {"driver", no_argument, NULL, 'd'}, |
545 | { .name = "policy", .has_arg = no_argument, .flag = NULL, .val = 'p'}, | 545 | {"policy", no_argument, NULL, 'p'}, |
546 | { .name = "governors", .has_arg = no_argument, .flag = NULL, .val = 'g'}, | 546 | {"governors", no_argument, NULL, 'g'}, |
547 | { .name = "related-cpus", .has_arg = no_argument, .flag = NULL, .val = 'r'}, | 547 | {"related-cpus", no_argument, NULL, 'r'}, |
548 | { .name = "affected-cpus",.has_arg = no_argument, .flag = NULL, .val = 'a'}, | 548 | {"affected-cpus", no_argument, NULL, 'a'}, |
549 | { .name = "stats", .has_arg = no_argument, .flag = NULL, .val = 's'}, | 549 | {"stats", no_argument, NULL, 's'}, |
550 | { .name = "latency", .has_arg = no_argument, .flag = NULL, .val = 'y'}, | 550 | {"latency", no_argument, NULL, 'y'}, |
551 | { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, | 551 | {"proc", no_argument, NULL, 'o'}, |
552 | { .name = "human", .has_arg = no_argument, .flag = NULL, .val = 'm'}, | 552 | {"human", no_argument, NULL, 'm'}, |
553 | { .name = "no-rounding", .has_arg = no_argument, .flag = NULL, .val = 'n'}, | 553 | {"no-rounding", no_argument, NULL, 'n'}, |
554 | { }, | 554 | { }, |
555 | }; | 555 | }; |
556 | 556 | ||
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c index 4e213576381e..0fbd1a22c0a9 100644 --- a/tools/power/cpupower/utils/cpufreq-set.c +++ b/tools/power/cpupower/utils/cpufreq-set.c | |||
@@ -22,11 +22,11 @@ | |||
22 | #define NORM_FREQ_LEN 32 | 22 | #define NORM_FREQ_LEN 32 |
23 | 23 | ||
24 | static struct option set_opts[] = { | 24 | static struct option set_opts[] = { |
25 | { .name = "min", .has_arg = required_argument, .flag = NULL, .val = 'd'}, | 25 | {"min", required_argument, NULL, 'd'}, |
26 | { .name = "max", .has_arg = required_argument, .flag = NULL, .val = 'u'}, | 26 | {"max", required_argument, NULL, 'u'}, |
27 | { .name = "governor", .has_arg = required_argument, .flag = NULL, .val = 'g'}, | 27 | {"governor", required_argument, NULL, 'g'}, |
28 | { .name = "freq", .has_arg = required_argument, .flag = NULL, .val = 'f'}, | 28 | {"freq", required_argument, NULL, 'f'}, |
29 | { .name = "related", .has_arg = no_argument, .flag = NULL, .val='r'}, | 29 | {"related", no_argument, NULL, 'r'}, |
30 | { }, | 30 | { }, |
31 | }; | 31 | }; |
32 | 32 | ||
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c index 75e66de7e7a7..750c1d82c3f7 100644 --- a/tools/power/cpupower/utils/cpuidle-info.c +++ b/tools/power/cpupower/utils/cpuidle-info.c | |||
@@ -126,8 +126,8 @@ static void proc_cpuidle_cpu_output(unsigned int cpu) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | static struct option info_opts[] = { | 128 | static struct option info_opts[] = { |
129 | { .name = "silent", .has_arg = no_argument, .flag = NULL, .val = 's'}, | 129 | {"silent", no_argument, NULL, 's'}, |
130 | { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, | 130 | {"proc", no_argument, NULL, 'o'}, |
131 | { }, | 131 | { }, |
132 | }; | 132 | }; |
133 | 133 | ||
diff --git a/tools/power/cpupower/utils/cpuidle-set.c b/tools/power/cpupower/utils/cpuidle-set.c index d45d8d775c02..d6b6ae44b8c2 100644 --- a/tools/power/cpupower/utils/cpuidle-set.c +++ b/tools/power/cpupower/utils/cpuidle-set.c | |||
@@ -13,15 +13,11 @@ | |||
13 | #include "helpers/sysfs.h" | 13 | #include "helpers/sysfs.h" |
14 | 14 | ||
15 | static struct option info_opts[] = { | 15 | static struct option info_opts[] = { |
16 | { .name = "disable", | 16 | {"disable", required_argument, NULL, 'd'}, |
17 | .has_arg = required_argument, .flag = NULL, .val = 'd'}, | 17 | {"enable", required_argument, NULL, 'e'}, |
18 | { .name = "enable", | 18 | {"disable-by-latency", required_argument, NULL, 'D'}, |
19 | .has_arg = required_argument, .flag = NULL, .val = 'e'}, | 19 | {"enable-all", no_argument, NULL, 'E'}, |
20 | { .name = "disable-by-latency", | 20 | { }, |
21 | .has_arg = required_argument, .flag = NULL, .val = 'D'}, | ||
22 | { .name = "enable-all", | ||
23 | .has_arg = no_argument, .flag = NULL, .val = 'E'}, | ||
24 | { }, | ||
25 | }; | 21 | }; |
26 | 22 | ||
27 | 23 | ||
@@ -148,14 +144,21 @@ int cmd_idle_set(int argc, char **argv) | |||
148 | (cpu, idlestate); | 144 | (cpu, idlestate); |
149 | state_latency = sysfs_get_idlestate_latency | 145 | state_latency = sysfs_get_idlestate_latency |
150 | (cpu, idlestate); | 146 | (cpu, idlestate); |
151 | printf("CPU: %u - idlestate %u - state_latency: %llu - latency: %llu\n", | 147 | if (disabled == 1) { |
152 | cpu, idlestate, state_latency, latency); | 148 | if (latency > state_latency){ |
153 | if (disabled == 1 || latency > state_latency) | 149 | ret = sysfs_idlestate_disable |
150 | (cpu, idlestate, 0); | ||
151 | if (ret == 0) | ||
152 | printf(_("Idlestate %u enabled on CPU %u\n"), idlestate, cpu); | ||
153 | } | ||
154 | continue; | 154 | continue; |
155 | ret = sysfs_idlestate_disable | 155 | } |
156 | (cpu, idlestate, 1); | 156 | if (latency <= state_latency){ |
157 | if (ret == 0) | 157 | ret = sysfs_idlestate_disable |
158 | (cpu, idlestate, 1); | ||
159 | if (ret == 0) | ||
158 | printf(_("Idlestate %u disabled on CPU %u\n"), idlestate, cpu); | 160 | printf(_("Idlestate %u disabled on CPU %u\n"), idlestate, cpu); |
161 | } | ||
159 | } | 162 | } |
160 | break; | 163 | break; |
161 | case 'E': | 164 | case 'E': |
diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c index 136d979e9586..10299f2e9d2a 100644 --- a/tools/power/cpupower/utils/cpupower-info.c +++ b/tools/power/cpupower/utils/cpupower-info.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include "helpers/sysfs.h" | 17 | #include "helpers/sysfs.h" |
18 | 18 | ||
19 | static struct option set_opts[] = { | 19 | static struct option set_opts[] = { |
20 | { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'}, | 20 | {"perf-bias", optional_argument, NULL, 'b'}, |
21 | { }, | 21 | { }, |
22 | }; | 22 | }; |
23 | 23 | ||
24 | static void print_wrong_arg_exit(void) | 24 | static void print_wrong_arg_exit(void) |
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index 573c75f8e3f5..3e6f374f8dd7 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include "helpers/bitmask.h" | 18 | #include "helpers/bitmask.h" |
19 | 19 | ||
20 | static struct option set_opts[] = { | 20 | static struct option set_opts[] = { |
21 | { .name = "perf-bias", .has_arg = required_argument, .flag = NULL, .val = 'b'}, | 21 | {"perf-bias", required_argument, NULL, 'b'}, |
22 | { }, | 22 | { }, |
23 | }; | 23 | }; |
24 | 24 | ||
diff --git a/tools/power/cpupower/utils/helpers/topology.c b/tools/power/cpupower/utils/helpers/topology.c index cea398c176e7..9cbb7fd75171 100644 --- a/tools/power/cpupower/utils/helpers/topology.c +++ b/tools/power/cpupower/utils/helpers/topology.c | |||
@@ -73,18 +73,22 @@ int get_cpu_topology(struct cpupower_topology *cpu_top) | |||
73 | for (cpu = 0; cpu < cpus; cpu++) { | 73 | for (cpu = 0; cpu < cpus; cpu++) { |
74 | cpu_top->core_info[cpu].cpu = cpu; | 74 | cpu_top->core_info[cpu].cpu = cpu; |
75 | cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu); | 75 | cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu); |
76 | if (!cpu_top->core_info[cpu].is_online) | ||
77 | continue; | ||
78 | if(sysfs_topology_read_file( | 76 | if(sysfs_topology_read_file( |
79 | cpu, | 77 | cpu, |
80 | "physical_package_id", | 78 | "physical_package_id", |
81 | &(cpu_top->core_info[cpu].pkg)) < 0) | 79 | &(cpu_top->core_info[cpu].pkg)) < 0) { |
82 | return -1; | 80 | cpu_top->core_info[cpu].pkg = -1; |
81 | cpu_top->core_info[cpu].core = -1; | ||
82 | continue; | ||
83 | } | ||
83 | if(sysfs_topology_read_file( | 84 | if(sysfs_topology_read_file( |
84 | cpu, | 85 | cpu, |
85 | "core_id", | 86 | "core_id", |
86 | &(cpu_top->core_info[cpu].core)) < 0) | 87 | &(cpu_top->core_info[cpu].core)) < 0) { |
87 | return -1; | 88 | cpu_top->core_info[cpu].pkg = -1; |
89 | cpu_top->core_info[cpu].core = -1; | ||
90 | continue; | ||
91 | } | ||
88 | } | 92 | } |
89 | 93 | ||
90 | qsort(cpu_top->core_info, cpus, sizeof(struct cpuid_core_info), | 94 | qsort(cpu_top->core_info, cpus, sizeof(struct cpuid_core_info), |
@@ -95,12 +99,15 @@ int get_cpu_topology(struct cpupower_topology *cpu_top) | |||
95 | done by pkg value. */ | 99 | done by pkg value. */ |
96 | last_pkg = cpu_top->core_info[0].pkg; | 100 | last_pkg = cpu_top->core_info[0].pkg; |
97 | for(cpu = 1; cpu < cpus; cpu++) { | 101 | for(cpu = 1; cpu < cpus; cpu++) { |
98 | if(cpu_top->core_info[cpu].pkg != last_pkg) { | 102 | if (cpu_top->core_info[cpu].pkg != last_pkg && |
103 | cpu_top->core_info[cpu].pkg != -1) { | ||
104 | |||
99 | last_pkg = cpu_top->core_info[cpu].pkg; | 105 | last_pkg = cpu_top->core_info[cpu].pkg; |
100 | cpu_top->pkgs++; | 106 | cpu_top->pkgs++; |
101 | } | 107 | } |
102 | } | 108 | } |
103 | cpu_top->pkgs++; | 109 | if (!cpu_top->core_info[0].pkg == -1) |
110 | cpu_top->pkgs++; | ||
104 | 111 | ||
105 | /* Intel's cores count is not consecutively numbered, there may | 112 | /* Intel's cores count is not consecutively numbered, there may |
106 | * be a core_id of 3, but none of 2. Assume there always is 0 | 113 | * be a core_id of 3, but none of 2. Assume there always is 0 |
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c index c4bae9203a69..05f953f0f0a0 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | |||
@@ -143,6 +143,9 @@ void print_results(int topology_depth, int cpu) | |||
143 | /* Be careful CPUs may got resorted for pkg value do not just use cpu */ | 143 | /* Be careful CPUs may got resorted for pkg value do not just use cpu */ |
144 | if (!bitmask_isbitset(cpus_chosen, cpu_top.core_info[cpu].cpu)) | 144 | if (!bitmask_isbitset(cpus_chosen, cpu_top.core_info[cpu].cpu)) |
145 | return; | 145 | return; |
146 | if (!cpu_top.core_info[cpu].is_online && | ||
147 | cpu_top.core_info[cpu].pkg == -1) | ||
148 | return; | ||
146 | 149 | ||
147 | if (topology_depth > 2) | 150 | if (topology_depth > 2) |
148 | printf("%4d|", cpu_top.core_info[cpu].pkg); | 151 | printf("%4d|", cpu_top.core_info[cpu].pkg); |
@@ -191,7 +194,8 @@ void print_results(int topology_depth, int cpu) | |||
191 | * It's up to the monitor plug-in to check .is_online, this one | 194 | * It's up to the monitor plug-in to check .is_online, this one |
192 | * is just for additional info. | 195 | * is just for additional info. |
193 | */ | 196 | */ |
194 | if (!cpu_top.core_info[cpu].is_online) { | 197 | if (!cpu_top.core_info[cpu].is_online && |
198 | cpu_top.core_info[cpu].pkg != -1) { | ||
195 | printf(_(" *is offline\n")); | 199 | printf(_(" *is offline\n")); |
196 | return; | 200 | return; |
197 | } else | 201 | } else |
@@ -388,6 +392,9 @@ int cmd_monitor(int argc, char **argv) | |||
388 | return EXIT_FAILURE; | 392 | return EXIT_FAILURE; |
389 | } | 393 | } |
390 | 394 | ||
395 | if (!cpu_top.core_info[0].is_online) | ||
396 | printf("WARNING: at least one cpu is offline\n"); | ||
397 | |||
391 | /* Default is: monitor all CPUs */ | 398 | /* Default is: monitor all CPUs */ |
392 | if (bitmask_isallclear(cpus_chosen)) | 399 | if (bitmask_isallclear(cpus_chosen)) |
393 | bitmask_setall(cpus_chosen); | 400 | bitmask_setall(cpus_chosen); |
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index bde0ef1a63df..d8e4b20b6d54 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -75,6 +75,7 @@ unsigned int aperf_mperf_multiplier = 1; | |||
75 | int do_smi; | 75 | int do_smi; |
76 | double bclk; | 76 | double bclk; |
77 | double base_hz; | 77 | double base_hz; |
78 | unsigned int has_base_hz; | ||
78 | double tsc_tweak = 1.0; | 79 | double tsc_tweak = 1.0; |
79 | unsigned int show_pkg; | 80 | unsigned int show_pkg; |
80 | unsigned int show_core; | 81 | unsigned int show_core; |
@@ -96,6 +97,7 @@ unsigned int do_ring_perf_limit_reasons; | |||
96 | unsigned int crystal_hz; | 97 | unsigned int crystal_hz; |
97 | unsigned long long tsc_hz; | 98 | unsigned long long tsc_hz; |
98 | int base_cpu; | 99 | int base_cpu; |
100 | double discover_bclk(unsigned int family, unsigned int model); | ||
99 | 101 | ||
100 | #define RAPL_PKG (1 << 0) | 102 | #define RAPL_PKG (1 << 0) |
101 | /* 0x610 MSR_PKG_POWER_LIMIT */ | 103 | /* 0x610 MSR_PKG_POWER_LIMIT */ |
@@ -511,9 +513,13 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
511 | } | 513 | } |
512 | 514 | ||
513 | /* Bzy_MHz */ | 515 | /* Bzy_MHz */ |
514 | if (has_aperf) | 516 | if (has_aperf) { |
515 | outp += sprintf(outp, "%8.0f", | 517 | if (has_base_hz) |
516 | 1.0 * t->tsc * tsc_tweak / units * t->aperf / t->mperf / interval_float); | 518 | outp += sprintf(outp, "%8.0f", base_hz / units * t->aperf / t->mperf); |
519 | else | ||
520 | outp += sprintf(outp, "%8.0f", | ||
521 | 1.0 * t->tsc / units * t->aperf / t->mperf / interval_float); | ||
522 | } | ||
517 | 523 | ||
518 | /* TSC_MHz */ | 524 | /* TSC_MHz */ |
519 | outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float); | 525 | outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float); |
@@ -1158,12 +1164,6 @@ int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, | |||
1158 | static void | 1164 | static void |
1159 | calculate_tsc_tweak() | 1165 | calculate_tsc_tweak() |
1160 | { | 1166 | { |
1161 | unsigned long long msr; | ||
1162 | unsigned int base_ratio; | ||
1163 | |||
1164 | get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr); | ||
1165 | base_ratio = (msr >> 8) & 0xFF; | ||
1166 | base_hz = base_ratio * bclk * 1000000; | ||
1167 | tsc_tweak = base_hz / tsc_hz; | 1167 | tsc_tweak = base_hz / tsc_hz; |
1168 | } | 1168 | } |
1169 | 1169 | ||
@@ -1440,7 +1440,7 @@ dump_config_tdp(void) | |||
1440 | 1440 | ||
1441 | get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); | 1441 | get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); |
1442 | fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); | 1442 | fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); |
1443 | fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xEF); | 1443 | fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0x7F); |
1444 | fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1); | 1444 | fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1); |
1445 | fprintf(stderr, ")\n"); | 1445 | fprintf(stderr, ")\n"); |
1446 | } | 1446 | } |
@@ -1821,6 +1821,7 @@ void check_permissions() | |||
1821 | int probe_nhm_msrs(unsigned int family, unsigned int model) | 1821 | int probe_nhm_msrs(unsigned int family, unsigned int model) |
1822 | { | 1822 | { |
1823 | unsigned long long msr; | 1823 | unsigned long long msr; |
1824 | unsigned int base_ratio; | ||
1824 | int *pkg_cstate_limits; | 1825 | int *pkg_cstate_limits; |
1825 | 1826 | ||
1826 | if (!genuine_intel) | 1827 | if (!genuine_intel) |
@@ -1829,6 +1830,8 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) | |||
1829 | if (family != 6) | 1830 | if (family != 6) |
1830 | return 0; | 1831 | return 0; |
1831 | 1832 | ||
1833 | bclk = discover_bclk(family, model); | ||
1834 | |||
1832 | switch (model) { | 1835 | switch (model) { |
1833 | case 0x1A: /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */ | 1836 | case 0x1A: /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */ |
1834 | case 0x1E: /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */ | 1837 | case 0x1E: /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */ |
@@ -1871,9 +1874,13 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) | |||
1871 | return 0; | 1874 | return 0; |
1872 | } | 1875 | } |
1873 | get_msr(base_cpu, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); | 1876 | get_msr(base_cpu, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); |
1874 | |||
1875 | pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; | 1877 | pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; |
1876 | 1878 | ||
1879 | get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr); | ||
1880 | base_ratio = (msr >> 8) & 0xFF; | ||
1881 | |||
1882 | base_hz = base_ratio * bclk * 1000000; | ||
1883 | has_base_hz = 1; | ||
1877 | return 1; | 1884 | return 1; |
1878 | } | 1885 | } |
1879 | int has_nhm_turbo_ratio_limit(unsigned int family, unsigned int model) | 1886 | int has_nhm_turbo_ratio_limit(unsigned int family, unsigned int model) |
@@ -2780,7 +2787,6 @@ void process_cpuid() | |||
2780 | do_skl_residency = has_skl_msrs(family, model); | 2787 | do_skl_residency = has_skl_msrs(family, model); |
2781 | do_slm_cstates = is_slm(family, model); | 2788 | do_slm_cstates = is_slm(family, model); |
2782 | do_knl_cstates = is_knl(family, model); | 2789 | do_knl_cstates = is_knl(family, model); |
2783 | bclk = discover_bclk(family, model); | ||
2784 | 2790 | ||
2785 | rapl_probe(family, model); | 2791 | rapl_probe(family, model); |
2786 | perf_limit_reasons_probe(family, model); | 2792 | perf_limit_reasons_probe(family, model); |