[PATCH v2 22/22] alpha: select SPARSE_IRQ
From: Matt Turner <mattst88@gmail.com>
Date: 2026-09-05 19:30:16
Also in:
linux-alpha, linux-hardening, lkml
Subsystem:
alpha port, the rest · Maintainers:
Richard Henderson, Matt Turner, Magnus Lindholm, Linus Torvalds
NR_IRQS on Alpha is sized for the largest configuration each platform supports, and for Marvel that is 32 PIDs, or 32784 interrupts. Without SPARSE_IRQ that becomes a static irq_desc[] array of 12.6 MB in .data, carried by every Marvel and every generic kernel regardless of how many interrupts the machine actually has. A real ES47 uses 87 of them. That is not just wasted memory, it constrains where the kernel can be loaded. The image links at a fixed 0xfffffc0001010000, just above the console's low memory reservation, and with memory striping enabled the console leaves only about 16 MB of usable low memory before the rest is relocated to an interleaved aperture. A 12.6 MB array of mostly unused interrupt descriptors is the difference between fitting and not. Alpha already goes through irq_to_desc() rather than indexing irq_desc[] directly, so nothing stands in the way. The platforms do wire up their interrupts by number, though, which needs the descriptors to exist by then, so provide arch_probe_nr_irqs() returning the machine vector's count instead of taking the NR_IRQS_LEGACY default. Without it every interrupt above 15 would have no descriptor and the handler setup would be silently dropped. Tested on an ES47 (Marvel, 2 EV7z): boots with all device interrupts working, and .data drops by 12.6 MB, from 15.7 MB to 3.1 MB. Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> --- arch/alpha/Kconfig | 1 + arch/alpha/kernel/irq_alpha.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 96b38d320eb8..8efb2da3246f 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig@@ -64,6 +64,7 @@ config ALPHA select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67 select MMU_GATHER_NO_RANGE select MMU_GATHER_RCU_TABLE_FREE + select SPARSE_IRQ select SPARSEMEM_EXTREME if SPARSEMEM select SYSCTL_EXCEPTION_TRACE select ZONE_DMA
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index f90ff898a71a..8366d6de439d 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c@@ -152,6 +152,19 @@ common_init_isa_dma(void) outb(0, DMA2_CLR_MASK_REG); } +/* + * The platforms wire up their interrupts by calling into the generic irq + * code with fixed interrupt numbers, so the descriptors have to exist by + * then. Preallocate the machine's full complement rather than take the + * NR_IRQS_LEGACY default, which would leave everything above IRQ 15 + * without a descriptor and silently drop the handler setup. + */ +int __init +arch_probe_nr_irqs(void) +{ + return alpha_mv.nr_irqs; +} + void __init init_IRQ(void) {
--
2.54.0