On Fri, Jan 08, 2021 at 09:54:30AM +0100, Borislav Petkov wrote:
> +#ifdef CONFIG_X86_THERMAL_VECTOR
> +static void unexpected_thermal_interrupt(void)
> +{
> +     pr_err("CPU%d: Unexpected LVT thermal interrupt!\n",
> +             smp_processor_id());
> +}
> +
> +static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt;
> +
> +void thermal_set_handler(void (*handler)(void))
> +{
> +     if (handler) {
                WARN_ON(smp_thermal_vector != unexpected_thermal_interrupt);
> +             smp_thermal_vector = handler;
> +     } else
> +             smp_thermal_vector = unexpected_thermal_interrupt;
> +}
> +EXPORT_SYMBOL_GPL(thermal_set_handler);

You really don't want multiple modules to touch that at the same time.

> +DEFINE_IDTENTRY_SYSVEC(sysvec_thermal)
> +{
> +     trace_thermal_apic_entry(THERMAL_APIC_VECTOR);
> +     inc_irq_stat(irq_thermal_count);
> +     smp_thermal_vector();
> +     trace_thermal_apic_exit(THERMAL_APIC_VECTOR);
> +     ack_APIC_irq();
> +}
> +#endif

Reply via email to