Re: [patch V4 04/15] x86/irq: Make irqstats array based

From: Thomas Gleixner

Date: Tue Mar 31 2026 - 10:49:06 EST


On Tue, Mar 31 2026 at 09:25, Thomas Gleixner wrote:
> +static int __init irq_init_stats(void)
> +{
> + struct irq_stat_info *info = irq_stat_info;
> +
> + for (unsigned int i = 0; i < ARRAY_SIZE(irq_stat_info); i++, info++) {
> + if (info->skip_vector && test_bit(info->skip_vector, system_vectors))
> + info->skip_vector = 0;
> + }
> +
> +#ifdef CONFIG_X86_LOCAL_APIC
> + if (!x86_platform_ipi_callback)
> + irq_stat_info[IRQ_COUNT_X86_PLATFORM_IPI].skip_vector = 1;
> +#endif
> +
> +#ifdef CONFIG_X86_POSTED_MSI
> + if (!posted_msi_enabled())
> + irq_stat_info[IRQ_COUNT_POSTED_MSI_NOTIFICATION].skip_vector = 1;
> +#endif
> +
> +#ifdef CONFIG_X86_MCE_AMD
> + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
> + boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
> + irq_stat_info[IRQ_COUNT_DEFERRED_VECTOR].skip_vector = 1;

Grmbl. IRQ_COUNT_DEFERRED_ERROR. The next patch fixes it but ....

> +#endif
> + return 0;
> +}
> +late_initcall(irq_init_stats);
> +
> +/*
> + * Used for default enabled counters to increment the stats and to enable the
> + * entry for /proc/interrupts output.
> + */
> +void irq_stat_inc_and_enable(enum irq_stat_counts which)
> +{
> + this_cpu_inc(irq_stat.counts[which]);
> + set_bit(which, irq_stat_count_show);
> +}

Also this one needs to be in the next patch.