mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: (coretemp) Document sysfs numbering and label meaning
@ 2026-10-15 17:17 Asaf Nuri Bertizlioğlu
  2026-10-18 16:36 ` Ximing Zhang
  2026-10-19 12:45 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Asaf Nuri Bertizlioğlu @ 2026-10-15 17:17 UTC (permalink / raw)
  To: linux, linux-hwmon
  Cc: corbet, skhan, rdunlap, linux-doc, linux-kernel,
	Asaf Nuri Bertizlioğlu

The documentation says that all sysfs entries are named with their
core_id, and that the "Core X" label contains the processor number.
Neither is accurate. create_core_attrs() numbers the per-core
attributes core_id + 2 and always uses temp1 for the package sensor,
and show_label() prints topology_core_id(), not the logical CPU
number.

The difference is easy to see on hybrid CPUs. On an i7-14700F, the
"Core 4" label is on temp6 and belongs to CPUs 2 and 3, and the
E-cores report core IDs 32 to 43.

Describe the actual numbering.

The mismatch was found by an LLM comparing the documentation with the
code, and verified on the i7-14700F above.

Assisted-by: LLM
Signed-off-by: Asaf Nuri Bertizlioğlu <ycistak@gmail.com>
---

Notes:
    The LLM (Claude) also drafted the documentation change and this
    changelog. Values checked on my machine: temp6_label is "Core 4",
    cpu2 and cpu3 have core_id 4, temp1_label is "Package id 0".

 Documentation/hwmon/coretemp.rst | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/hwmon/coretemp.rst b/Documentation/hwmon/coretemp.rst
index 34930168338..95b0a578c4d 100644
--- a/Documentation/hwmon/coretemp.rst
+++ b/Documentation/hwmon/coretemp.rst
@@ -46,7 +46,8 @@ mechanism will perform actions to forcibly cool down the processor. Alarm
 may be raised, if the temperature grows enough (more than TjMax) to trigger
 the Out-Of-Spec bit. The following table summarizes the exported sysfs files:
 
-All sysfs entries are named with their core_id (represented here by 'X').
+Per-core sysfs entries are numbered core_id + 2 (represented here by 'X').
+The package entries, if available, are always temp1_*.
 
 ================= ========================================================
 tempX_input	  Core temperature (in millidegrees Celsius).
@@ -55,9 +56,12 @@ tempX_max	  Maximum recommended operating temperature (Tcontrol).
 tempX_crit	  Maximum junction temperature (in millidegrees Celsius).
 tempX_crit_alarm  Set when Out-of-spec bit is set, never clears.
 		  Correct CPU operation is no longer guaranteed.
-tempX_label	  Contains string "Core X", where X is processor
-		  number. For Package temp, this will be "Package id Y",
-		  where Y is the package number.
+tempX_label	  Contains string "Core N", where N is the core_id
+		  (X - 2), as shown in
+		  /sys/devices/system/cpu/cpu*/topology/core_id. This
+		  is not the logical CPU number, and core_id values
+		  may be sparse. For Package temp, this will be
+		  "Package id Y", where Y is the package number.
 ================= ========================================================
 
 On modern CPUs (Nehalem and newer), TjMax is read from the
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (coretemp) Document sysfs numbering and label meaning
  2026-10-15 17:17 [PATCH] hwmon: (coretemp) Document sysfs numbering and label meaning Asaf Nuri Bertizlioğlu
@ 2026-10-18 16:36 ` Ximing Zhang
  2026-10-19 12:45 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Ximing Zhang @ 2026-10-18 16:36 UTC (permalink / raw)
  To: ycistak
  Cc: linux, linux-hwmon, corbet, skhan, rdunlap, linux-doc, linux-kernel

I tested the documented sysfs numbering on an Intel Core i7-10510U
running 7.2.5-1-cachyos, with all eight logical CPUs online.

coretemp exposed the package sensor as temp1 with label "Package id 0".
The four per-core sensors were exposed as temp2 through temp5 with
labels "Core 0" through "Core 3", respectively.

The topology files reported the following SMT sibling pairs:

  cpu0/cpu4: core_id 0
  cpu1/cpu5: core_id 1
  cpu2/cpu6: core_id 2
  cpu3/cpu7: core_id 3

This confirms that the per-core attribute number is core_id + 2 and
that the label identifies the core_id rather than the logical CPU
number.

Tested-by: Ximing Zhang <xzhangjr@gmail.com>
Reviewed-by: Ximing Zhang <xzhangjr@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (coretemp) Document sysfs numbering and label meaning
  2026-10-15 17:17 [PATCH] hwmon: (coretemp) Document sysfs numbering and label meaning Asaf Nuri Bertizlioğlu
  2026-10-18 16:36 ` Ximing Zhang
@ 2026-10-19 12:45 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2026-10-19 12:45 UTC (permalink / raw)
  To: Asaf Nuri Bertizlioğlu
  Cc: linux-hwmon, corbet, skhan, rdunlap, linux-doc, linux-kernel

On Thu, Oct 15, 2026 at 08:17:59PM +0300, Asaf Nuri Bertizlioğlu wrote:
> The documentation says that all sysfs entries are named with their
> core_id, and that the "Core X" label contains the processor number.
> Neither is accurate. create_core_attrs() numbers the per-core
> attributes core_id + 2 and always uses temp1 for the package sensor,
> and show_label() prints topology_core_id(), not the logical CPU
> number.
> 
> The difference is easy to see on hybrid CPUs. On an i7-14700F, the
> "Core 4" label is on temp6 and belongs to CPUs 2 and 3, and the
> E-cores report core IDs 32 to 43.
> 
> Describe the actual numbering.
> 
> The mismatch was found by an LLM comparing the documentation with the
> code, and verified on the i7-14700F above.
> 
> Assisted-by: LLM
> Signed-off-by: Asaf Nuri Bertizlioğlu <ycistak@gmail.com>
> Tested-by: Ximing Zhang <xzhangjr@gmail.com>
> Reviewed-by: Ximing Zhang <xzhangjr@gmail.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-19 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15 17:17 [PATCH] hwmon: (coretemp) Document sysfs numbering and label meaning Asaf Nuri Bertizlioğlu
2026-10-18 16:36 ` Ximing Zhang
2026-10-19 12:45 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®