diff options
| author | Ricardo Neri <ricardo.neri-calderon@linux.intel.com> | 2026-09-24 19:33:21 -0700 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-10-18 09:35:08 -0700 |
| commit | 5407d2b7d5279b7100621d92f2181184c8f00d62 (patch) | |
| tree | 0d2e7808907ca508f50988c464773d630987a846 /tools/perf/scripts/python/stackcollapse.py | |
| parent | aa8ae39a725347db3511076d2fc5d10caf0a5d8e (diff) | |
| download | linux-5407d2b7d5279b7100621d92f2181184c8f00d62.tar.gz linux-5407d2b7d5279b7100621d92f2181184c8f00d62.zip | |
hwmon: (coretemp) Read TjMax only when refreshing the temperature
show_temp() reads TjMax before checking whether the cached temperature is
still fresh, but consumes it only when recomputing that temperature. On a
cache hit the value is discarded.
Discarding it is not free. On CPUs that report TjMax in
MSR_IA32_TEMPERATURE_TARGET, get_tjmax() returns the value it just read
without storing it in tdata->tjmax, so every call reads the MSR again.
That is a cross-CPU call whenever the CPU owning the sensor is not the
current one, and it is made while holding tdata->update_lock.
Read TjMax where it is used. The value cannot go stale in the meantime:
bits 23:16 of MSR_IA32_TEMPERATURE_TARGET are read-only, and the register
is package-scoped, so every CPU of the package reads the same value.
The temperature reported to userspace does not change.
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Link: https://patch.msgid.link/20260924-coretemp-temp-fault-v1-2-1884f0ff97d5@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
