Re: [PATCH 1/2] thermal: intel: hfi: Disable HFI on shutdown and kexec
From: Ricardo Neri
Date: Thu Nov 19 2026 - 00:34:41 EST
On Wed, Oct 28, 2026 at 12:14:45AM +0000, Jez Ng via B4 Relay wrote:
> From: Jez Ng <jez@xxxxxxxxxxxxx>
[ ... ]
> +static void hfi_syscore_shutdown(void *data)
> +{
> + struct hfi_instance *hfi_instance;
> + int i;
> +
> + /*
> + * Hardware keeps writing to the HFI table after a kexec, into memory
> + * that the next kernel owns. Disable HFI in every package, and keep it
> + * disabled: user space runs until machine_shutdown() stops the other
> + * CPUs, and kexec enables CPU hotplug again, so a new thermal netlink
> + * client or a CPU coming online could otherwise enable it.
> + */
> + mutex_lock(&hfi_instance_lock);
> + hfi_shutdown_done = true;
> + for (i = 0; i < max_hfi_instances; i++) {
> + hfi_instance = &hfi_instances[i];
> + if (cpumask_empty(hfi_instance->cpus))
> + continue;
> +
> + smp_call_function_single(cpumask_any(hfi_instance->cpus),
> + hfi_shutdown_instance, hfi_instance, true);
> + }
> + mutex_unlock(&hfi_instance_lock);
Using guard(mutex)(&hfi_instance_lock) would read more simply here.
However, this patch is tagged for stable, and kernels older than v6.5,
such as 6.1, do not have guard(). It is probably better to leave it as
is.
I tested this patch once on a Panther Lake-H client system (one
package, 16 CPUs), together with patch 2. With a thermal netlink client
subscribed, a kexec left HW_FEEDBACK_CONFIG at 0 in the new kernel.
Reviewed-by: Ricardo Neri ricardo.neri-calderon@xxxxxxxxxxxxxxx
Tested-by: Ricardo Neri ricardo.neri-calderon@xxxxxxxxxxxxxxx