[PATCH v2] um: Support SPARSE_IRQ
Brian Norris
briannorris at chromium.org
Wed Aug 27 15:04:18 PDT 2025
From: Sinan Nalkaya <sardok at gmail.com>
Motivation: IRQ KUnit tests are going to require CONFIG_SPARSE_IRQ [1] in
order to:
(a) reliably allocate additional (fake) IRQs and
(b) ensure we can test managed affinity, which is only supported with
SPARSE_IRQ.
It seems that the only thing necessary for ARCH=um is to tell the genirq
core to skip over our preallocated NR_IRQS.
Tested with:
$ ./tools/testing/kunit/kunit.py run
[...]
[13:55:58] Testing complete. Ran 676 tests: passed: 646, skipped: 30
[...]
This compares with pre-patch results:
Ran 672 tests: passed: 644, skipped: 28
i.e., we no longer skip tests that 'depend on SPARSE_IRQ', and existing
tests all pass.
[1]
[PATCH v2 4/6] genirq/test: Depend on SPARSE_IRQ
https://lore.kernel.org/all/CABVgOSngoD0fh1WEkUCEwSdk0Joypo3dA_Y_SjW+K=nVDnZs3Q@mail.gmail.com/
Signed-off-by: Sinan Nalkaya <sardok at gmail.com>
[Brian: Adapted Sinan's patch; rewrote commit message]
Signed-off-by: Brian Norris <briannorris at chromium.org>
Tested-by: David Gow <davidgow at google.com>
---
This is adapted from Sinan's work at:
[PATCH 1/1] um: Fix broken IRQs if SPARSE_IRQ is selected
https://lore.kernel.org/all/1360193940-31504-1-git-send-email-sardok@gmail.com/
Place any blame for errors on me of course.
I'm not much of a UML developer, although I've been developing KUnit
tests which default to running on ARCH=um.
I also can't quite tell if MAY_HAVE_SPARSE_IRQ or SPARSE_IRQ is a better
'select' target. Almost every other architecture uses 'select
SPARSE_IRQ', with the one exception of arch/csky. For my purposes, it's
better to 'select SPARSE_IRQ', for consistency with other ARCH'es, and
to make it easier for KUnit builds to get it. But I'm less sure if there
are good reasons to want to make it user-(un)selectable.
Changes in v2:
* Drop #ifdef
arch/um/Kconfig | 1 +
arch/um/kernel/irq.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 9083bfdb7735..8161cc5ae6f7 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -38,6 +38,7 @@ config UML
select HAVE_ARCH_TRACEHOOK
select HAVE_SYSCALL_TRACEPOINTS
select THREAD_INFO_IN_TASK
+ select SPARSE_IRQ
config MMU
bool
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 0dfaf96bb7da..d69d137a0334 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -691,6 +691,11 @@ void __init init_IRQ(void)
os_setup_epoll();
}
+int __init arch_probe_nr_irqs(void)
+{
+ return NR_IRQS;
+}
+
void sigchld_handler(int sig, struct siginfo *unused_si,
struct uml_pt_regs *regs, void *mc)
{
--
2.51.0.268.g9569e192d0-goog
More information about the linux-um
mailing list