[tip: locking/core] irq: Add max local_interrupt_disable() nesting level kunit test case
From: tip-bot2 for Boqun Feng
Date: Mon Oct 12 2026 - 09:35:06 EST
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 67e0eadd862616cb22145d6117b79b79c4ae48fe
Gitweb: https://git.kernel.org/tip/67e0eadd862616cb22145d6117b79b79c4ae48fe
Author: Boqun Feng <boqun@xxxxxxxxxx>
AuthorDate: Thu, 01 Oct 2026 10:25:19 +02:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Fri, 02 Oct 2026 11:47:14 +02:00
irq: Add max local_interrupt_disable() nesting level kunit test case
To confirm the max nesting level of local_interrupt_disable() works, a
kunit test is added to the whole test suite.
Note that when DEBUG_PREEMPT=y, it'll generate a warning which is
expected.
Suggested-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
Signed-off-by: Boqun Feng <boqun@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20261001082519.16195-6-boqun@xxxxxxxxxx
---
kernel/irq/refcount_interrupt_test.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/kernel/irq/refcount_interrupt_test.c b/kernel/irq/refcount_interrupt_test.c
index ca904db..38dfccb 100644
--- a/kernel/irq/refcount_interrupt_test.c
+++ b/kernel/irq/refcount_interrupt_test.c
@@ -52,6 +52,27 @@ static void test_multiple_irq_change(struct kunit *test)
TEST_IRQ_ON();
}
+static void test_max_nesting_irq_change(struct kunit *test)
+{
+ for (int i = 0; i < __IRQ_MASK(HARDIRQ_DISABLE_BITS); i++) {
+ local_interrupt_disable();
+ TEST_IRQ_OFF();
+ }
+
+
+ for (int i = 0; i < __IRQ_MASK(HARDIRQ_DISABLE_BITS); i++) {
+ TEST_IRQ_OFF();
+ local_interrupt_enable();
+ }
+
+ TEST_IRQ_ON();
+
+ local_interrupt_disable();
+ TEST_IRQ_OFF();
+ local_interrupt_enable();
+ TEST_IRQ_ON();
+}
+
static void test_irq_save(struct kunit *test)
{
unsigned long flags;
@@ -79,6 +100,7 @@ static struct kunit_case test_cases[] = {
KUNIT_CASE(test_single_irq_change),
KUNIT_CASE(test_nested_irq_change),
KUNIT_CASE(test_multiple_irq_change),
+ KUNIT_CASE(test_max_nesting_irq_change),
KUNIT_CASE(test_irq_save),
{},
};