Re: [PATCH] irq: Make refcount_interrupt kunit test selectable
Boqun Feng <[email protected]>
| Newsgroups | org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Aug 23, 2026 at 04:46:23PM -0400, Radu Rendec wrote:
> On Sun, 2026-08-23 at 17:17 +0000, Kuan-Wei Chiu wrote:
> > Currently, refcount_interrupt_test is built unconditionally when
> > CONFIG_KUNIT is enabled, causing it to run unexpectedly during boot.
> >
> > Fix this by introducing CONFIG_REFCOUNT_INTERRUPT_KUNIT_TEST so the
> > test can be configured independently, following standard kunit
> > practices.
> >
> > Fixes: 07a88e2bcd5b ("irq: Add KUnit test for refcounted interrupt enable/disable")
> > Signed-off-by: Kuan-Wei Chiu <[email protected]>
> > ---
> >  kernel/irq/Kconfig | 12 ++++++++++++
> > Â kernel/irq/Makefile |Â 2 +-
> > Â 2 files changed, 13 insertions(+), 1 deletion(-)
>
> Can someone please explain me why this needs to be a separate unit test
> in the first place and can't be integrated into the (previously)
> existing unit test gated by IRQ_KUNIT_TEST?
>
If you look at the irq_test.c, you will find that it primarily tests the
{request,disable,enable}_irq() API (i.e. allocating IRQ vectors and
enabling and disabling them), which is not the same scope as
local_interrupt_{disable,enable}() (i.e. operating the CPU irq disabling
status), so it makes sense to have a separate test case.
But yes, I agree Kuan-Wei's fix is needed.
Regards,
Boqun
> Ironically, both the issue that this patch is trying to fix and my
> question were raised by sashiko here:
> https://lore.kernel.org/all/[email protected]/
>
> > diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
> > index 05cba4e16dad..6923f37eaab4 100644
> > --- a/kernel/irq/Kconfig
> > +++ b/kernel/irq/Kconfig
> > @@ -150,6 +150,18 @@ config IRQ_KUNIT_TEST
> > Â
> > Â Â If unsure, say N.
> > Â
> > +config REFCOUNT_INTERRUPT_KUNIT_TEST
> > + tristate "Test refcounted interrupt enable/disable" if !KUNIT_ALL_TESTS
> > + depends on KUNIT
> > + default KUNIT_ALL_TESTS
> > + help
> > + Â This builds the kunit tests for the refcounted interrupt
> > + Â infrastructure. It verifies the correctness of single, nested,
> > + Â and multiple interrupt enable/disable state changes and ensures
> > + Â that the underlying reference counting mechanisms work as expected.
> > +
> > + Â If unsure, say N.
> > +
> > Â endmenu
> > Â
> > Â config GENERIC_IRQ_MULTI_HANDLER
> > diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile
> > index 44c4d6fc502a..0e5df962a149 100644
> > --- a/kernel/irq/Makefile
> > +++ b/kernel/irq/Makefile
> > @@ -16,4 +16,4 @@ obj-$(CONFIG_SMP) += affinity.o
> > Â obj-$(CONFIG_GENERIC_IRQ_DEBUGFS) += debugfs.o
> > Â obj-$(CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR) += matrix.o
> > Â obj-$(CONFIG_IRQ_KUNIT_TEST) += irq_test.o
> > -obj-$(CONFIG_KUNIT) += refcount_interrupt_test.o
> > +obj-$(CONFIG_REFCOUNT_INTERRUPT_KUNIT_TEST) += refcount_interrupt_test.o