Skip to content

Commit 7f69649

Browse files
lenbgregkh
authored andcommitted
Revert "tools/power turbostat: adjust for temperature offset"
commit b2b94be upstream. This reverts commit 6ff7cb3. Apparently the TCC offset should not be used to adjust what temperature we show the user after all. (on most systems, TCC offset is 0, FWIW) Fixes: 6ff7cb3 Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0781a13 commit 7f69649

1 file changed

Lines changed: 33 additions & 29 deletions

File tree

‎tools/power/x86/turbostat/turbostat.c‎

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4795,33 +4795,12 @@ double discover_bclk(unsigned int family, unsigned int model)
47954795
* below this value, including the Digital Thermal Sensor (DTS),
47964796
* Package Thermal Management Sensor (PTM), and thermal event thresholds.
47974797
*/
4798-
int read_tcc_activation_temp()
4798+
int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
47994799
{
48004800
unsigned long long msr;
4801-
unsigned int tcc, target_c, offset_c;
4802-
4803-
/* Temperature Target MSR is Nehalem and newer only */
4804-
if (!do_nhm_platform_info)
4805-
return 0;
4806-
4807-
if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
4808-
return 0;
4809-
4810-
target_c = (msr >> 16) & 0xFF;
4811-
4812-
offset_c = (msr >> 24) & 0xF;
4813-
4814-
tcc = target_c - offset_c;
4815-
4816-
if (!quiet)
4817-
fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C) (%d default - %d offset)\n",
4818-
base_cpu, msr, tcc, target_c, offset_c);
4819-
4820-
return tcc;
4821-
}
4801+
unsigned int target_c_local;
4802+
int cpu;
48224803

4823-
int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
4824-
{
48254804
/* tcc_activation_temp is used only for dts or ptm */
48264805
if (!(do_dts || do_ptm))
48274806
return 0;
@@ -4830,18 +4809,43 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk
48304809
if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
48314810
return 0;
48324811

4812+
cpu = t->cpu_id;
4813+
if (cpu_migrate(cpu)) {
4814+
fprintf(outf, "Could not migrate to CPU %d\n", cpu);
4815+
return -1;
4816+
}
4817+
48334818
if (tcc_activation_temp_override != 0) {
48344819
tcc_activation_temp = tcc_activation_temp_override;
4835-
fprintf(outf, "Using cmdline TCC Target (%d C)\n", tcc_activation_temp);
4820+
fprintf(outf, "cpu%d: Using cmdline TCC Target (%d C)\n",
4821+
cpu, tcc_activation_temp);
48364822
return 0;
48374823
}
48384824

4839-
tcc_activation_temp = read_tcc_activation_temp();
4840-
if (tcc_activation_temp)
4841-
return 0;
4825+
/* Temperature Target MSR is Nehalem and newer only */
4826+
if (!do_nhm_platform_info)
4827+
goto guess;
4828+
4829+
if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
4830+
goto guess;
4831+
4832+
target_c_local = (msr >> 16) & 0xFF;
4833+
4834+
if (!quiet)
4835+
fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n",
4836+
cpu, msr, target_c_local);
4837+
4838+
if (!target_c_local)
4839+
goto guess;
4840+
4841+
tcc_activation_temp = target_c_local;
4842+
4843+
return 0;
48424844

4845+
guess:
48434846
tcc_activation_temp = TJMAX_DEFAULT;
4844-
fprintf(outf, "Guessing tjMax %d C, Please use -T to specify\n", tcc_activation_temp);
4847+
fprintf(outf, "cpu%d: Guessing tjMax %d C, Please use -T to specify\n",
4848+
cpu, tcc_activation_temp);
48454849

48464850
return 0;
48474851
}

0 commit comments

Comments
 (0)