Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH] hwmon: (coretemp) Fix missing sensors with uneven core counts
@ 2026-12-04 14:46 Aveline Noir
  2026-12-04 15:04 ` sashiko-bot
  2026-12-04 15:53 ` Asaf Nuri Bertizlioğlu
  0 siblings, 2 replies; 9+ messages in thread
From: Aveline Noir @ 2026-12-04 14:46 UTC (permalink / raw)
  To: linux; +Cc: bakshansky.lists, linux-hwmon, sashiko-reviews, sashiko-bot

topology_num_cores_per_package() only counts the cores of one package.
If another package has more cores, e.g. because the BIOS disabled cores
on only one CPU, the extra cores get no temperature sensors.

Use num_possible_cpus() as the limit instead.

Fixes: b89e1255c92b ("hwmon: (coretemp) replace hardcoded core count with dynamic value")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-hwmon/20260516121622.1E9DAC19425@smtp.kernel.org/
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
---
Only tested in QEMU, with 2+4 cores.
---
 drivers/hwmon/coretemp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 96d57fe12de6..2353d2d096e7 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -491,7 +491,8 @@ init_temp_data(struct platform_data *pdata, unsigned int cpu, int pkg_flag)
 	struct temp_data *tdata;
 
 	if (!pdata->core_data) {
-		int nr_cores = topology_num_cores_per_package();
+		/* Packages can have different numbers of cores */
+		int nr_cores = num_possible_cpus();
 
 		pdata->core_data = kzalloc_objs(struct temp_data *, nr_cores);
 		if (!pdata->core_data)

---
base-commit: 19cc08c1a6a650f8e54c0461ff198be6448f425d
change-id: 20261205-coretemp-core-limit-4e403bcd7b15


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

end of thread, other threads:[~2026-12-05  6:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 14:46 [PATCH] hwmon: (coretemp) Fix missing sensors with uneven core counts Aveline Noir
2026-12-04 15:04 ` sashiko-bot
2026-12-04 15:13   ` Aveline Noir
2026-12-04 20:34     ` Guenter Roeck
2026-12-05  6:11       ` Aveline Noir
2026-12-04 15:53 ` Asaf Nuri Bertizlioğlu
2026-12-04 16:04   ` Aveline Noir
2026-12-04 16:30     ` Asaf Nuri Bertizlioğlu
2026-12-04 16:43       ` Aveline Noir

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