Skip to content

Commit bbbcbb8

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 504d005 commit bbbcbb8

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
@@ -4822,33 +4822,12 @@ double discover_bclk(unsigned int family, unsigned int model)
48224822
* below this value, including the Digital Thermal Sensor (DTS),
48234823
* Package Thermal Management Sensor (PTM), and thermal event thresholds.
48244824
*/
4825-
int read_tcc_activation_temp()
4825+
int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
48264826
{
48274827
unsigned long long msr;
4828-
unsigned int tcc, target_c, offset_c;
4829-
4830-
/* Temperature Target MSR is Nehalem and newer only */
4831-
if (!do_nhm_platform_info)
4832-
return 0;
4833-
4834-
if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
4835-
return 0;
4836-
4837-
target_c = (msr >> 16) & 0xFF;
4838-
4839-
offset_c = (msr >> 24) & 0xF;
4840-
4841-
tcc = target_c - offset_c;
4842-
4843-
if (!quiet)
4844-
fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C) (%d default - %d offset)\n",
4845-
base_cpu, msr, tcc, target_c, offset_c);
4846-
4847-
return tcc;
4848-
}
4828+
unsigned int target_c_local;
4829+
int cpu;
48494830

4850-
int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
4851-
{
48524831
/* tcc_activation_temp is used only for dts or ptm */
48534832
if (!(do_dts || do_ptm))
48544833
return 0;
@@ -4857,18 +4836,43 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk
48574836
if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
48584837
return 0;
48594838

4839+
cpu = t->cpu_id;
4840+
if (cpu_migrate(cpu)) {
4841+
fprintf(outf, "Could not migrate to CPU %d\n", cpu);
4842+
return -1;
4843+
}
4844+
48604845
if (tcc_activation_temp_override != 0) {
48614846
tcc_activation_temp = tcc_activation_temp_override;
4862-
fprintf(outf, "Using cmdline TCC Target (%d C)\n", tcc_activation_temp);
4847+
fprintf(outf, "cpu%d: Using cmdline TCC Target (%d C)\n",
4848+
cpu, tcc_activation_temp);
48634849
return 0;
48644850
}
48654851

4866-
tcc_activation_temp = read_tcc_activation_temp();
4867-
if (tcc_activation_temp)
4868-
return 0;
4852+
/* Temperature Target MSR is Nehalem and newer only */
4853+
if (!do_nhm_platform_info)
4854+
goto guess;
4855+
4856+
if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
4857+
goto guess;
4858+
4859+
target_c_local = (msr >> 16) & 0xFF;
4860+
4861+
if (!quiet)
4862+
fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n",
4863+
cpu, msr, target_c_local);
4864+
4865+
if (!target_c_local)
4866+
goto guess;
4867+
4868+
tcc_activation_temp = target_c_local;
4869+
4870+
return 0;
48694871

4872+
guess:
48704873
tcc_activation_temp = TJMAX_DEFAULT;
4871-
fprintf(outf, "Guessing tjMax %d C, Please use -T to specify\n", tcc_activation_temp);
4874+
fprintf(outf, "cpu%d: Guessing tjMax %d C, Please use -T to specify\n",
4875+
cpu, tcc_activation_temp);
48724876

48734877
return 0;
48744878
}

0 commit comments

Comments
 (0)