Re: [PATCH] hwmon: (coretemp) Retry failed sensor creation
From: Guenter Roeck
Date: Tue Oct 20 2026 - 14:39:19 EST
On Tue, Oct 20, 2026 at 09:39:35PM +0400, Ximing Zhang via B4 Relay wrote:
> From: Ximing Zhang <xzhangjr@xxxxxxxxx>
>
> coretemp_add_core() only logs create_core_data() failures, but
> coretemp_cpu_online() still records the CPU in pdata->cpumask. When an
> SMT sibling is processed later, the mask makes the driver skip sensor
> creation. The core interface then remains absent until all siblings are
> cycled or the module is reloaded.
>
> Package sensor creation is similarly attempted only when the hwmon
> device is first registered. A failure leaves the package interface
> absent for the lifetime of that device.
>
> Retry missing package and core sensors whenever an eligible CPU comes
> online. Determine whether a core sensor exists from its temperature data
> instead of the CPU mask, which continues to track CPUs available for MSR
> reads and hotplug retargeting.
>
> A package retry might fail after per-core data exists. Keep the core_data
> array alive until the hwmon device is unregistered so failure cleanup
> cannot discard live per-core pointers. Publish nr_cores only after that
> array is allocated successfully, and rate-limit errors because a
> permanent failure can now be retried.
>
> Tested on an Intel Core i7-10510U running 7.2.5-1-cachyos. With
> test-only fault injection, two package creation failures and one Core 0
> creation failure left the unpatched driver without both interfaces. The
> patched driver retried and exposed all five readable sensors. SMT sibling
> hotplug and 20 module unload/load cycles also retained the expected
> sensors.
>
> Signed-off-by: Ximing Zhang <xzhangjr@xxxxxxxxx>
> ---
> coretemp currently treats a failed package or per-core sensor creation as
> permanent for the lifetime of the hwmon device. This change retries missing
> sensors as eligible CPUs come online while keeping the CPU mask available for
> MSR targeting and hotplug handling.
>
> Tested on an Intel Core i7-10510U running 7.2.5-1-cachyos. Test-only fault
> injection reproduced missing package and Core 0 interfaces with the current
Is that a theoretic or a real problem ? "Test-only fault injection" very
much suggests that it is a theoretic problem. Have you observed it on
a real system (without artificial fault injection) ?
Thanks,
Guenter