summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorRicardo Neri <ricardo.neri-calderon@linux.intel.com>2026-09-24 19:33:21 -0700
committerGuenter Roeck <linux@roeck-us.net>2026-09-29 06:57:31 -0700
commitd038bed333f2b911654a935cc957efbdd7fe700c (patch)
tree50c90e7f7362ad3f9e1535584229ca3e0e0120f3 /tools/lib/python
parent501e87e90b87a78e91b316ce391a43b30a8cce7f (diff)
downloadlinux-next-d038bed333f2b911654a935cc957efbdd7fe700c.tar.gz
linux-next-d038bed333f2b911654a935cc957efbdd7fe700c.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/lib/python')
0 files changed, 0 insertions, 0 deletions