Skip to content

Commit b2b94be

Browse files
committed
Revert "tools/power turbostat: adjust for temperature offset"
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>
1 parent 6c5c656 commit b2b94be

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
@@ -4879,33 +4879,12 @@ double discover_bclk(unsigned int family, unsigned int model)
48794879
* below this value, including the Digital Thermal Sensor (DTS),
48804880
* Package Thermal Management Sensor (PTM), and thermal event thresholds.
48814881
*/
4882-
int read_tcc_activation_temp()
4882+
int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
48834883
{
48844884
unsigned long long msr;
4885-
unsigned int tcc, target_c, offset_c;
4886-
4887-
/* Temperature Target MSR is Nehalem and newer only */
4888-
if (!do_nhm_platform_info)
4889-
return 0;
4890-
4891-
if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
4892-
return 0;
4893-
4894-
target_c = (msr >> 16) & 0xFF;
4895-
4896-
offset_c = (msr >> 24) & 0xF;
4897-
4898-
tcc = target_c - offset_c;
4899-
4900-
if (!quiet)
4901-
fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C) (%d default - %d offset)\n",
4902-
base_cpu, msr, tcc, target_c, offset_c);
4903-
4904-
return tcc;
4905-
}
4885+
unsigned int target_c_local;
4886+
int cpu;
49064887

4907-
int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p)
4908-
{
49094888
/* tcc_activation_temp is used only for dts or ptm */
49104889
if (!(do_dts || do_ptm))
49114890
return 0;
@@ -4914,18 +4893,43 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk
49144893
if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
49154894
return 0;
49164895

4896+
cpu = t->cpu_id;
4897+
if (cpu_migrate(cpu)) {
4898+
fprintf(outf, "Could not migrate to CPU %d\n", cpu);
4899+
return -1;
4900+
}
4901+
49174902
if (tcc_activation_temp_override != 0) {
49184903
tcc_activation_temp = tcc_activation_temp_override;
4919-
fprintf(outf, "Using cmdline TCC Target (%d C)\n", tcc_activation_temp);
4904+
fprintf(outf, "cpu%d: Using cmdline TCC Target (%d C)\n",
4905+
cpu, tcc_activation_temp);
49204906
return 0;
49214907
}
49224908

4923-
tcc_activation_temp = read_tcc_activation_temp();
4924-
if (tcc_activation_temp)
4925-
return 0;
4909+
/* Temperature Target MSR is Nehalem and newer only */
4910+
if (!do_nhm_platform_info)
4911+
goto guess;
4912+
4913+
if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
4914+
goto guess;
4915+
4916+
target_c_local = (msr >> 16) & 0xFF;
4917+
4918+
if (!quiet)
4919+
fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n",
4920+
cpu, msr, target_c_local);
4921+
4922+
if (!target_c_local)
4923+
goto guess;
4924+
4925+
tcc_activation_temp = target_c_local;
4926+
4927+
return 0;
49264928

4929+
guess:
49274930
tcc_activation_temp = TJMAX_DEFAULT;
4928-
fprintf(outf, "Guessing tjMax %d C, Please use -T to specify\n", tcc_activation_temp);
4931+
fprintf(outf, "cpu%d: Guessing tjMax %d C, Please use -T to specify\n",
4932+
cpu, tcc_activation_temp);
49294933

49304934
return 0;
49314935
}

0 commit comments

Comments
 (0)