genirq/test: Fix depth tests on architectures with NOREQUEST by default.
PATCH 1/1 genirq/test: Fix depth tests on architectures with NOREQUEST by default.
The new irq KUnit tests fail on some architectures (notably PowerPC and 32-bit ARM), as the request_irq() call fails due to the ARCH_IRQ_INIT_FLAGS containing IRQ_NOREQUEST, yielding the following errors:
[10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:88
[10:17:45] Expected ret == 0, but
[10:17:45] ret == -22 (0xffffffffffffffea)
[10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:90
[10:17:45] Expected desc->depth == 0, but
[10:17:45] desc->depth == 1 (0x1)
[10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:93
[10:17:45] Expected desc->depth == 1, but
[10:17:45] desc->depth == 2 (0x2)
If we clear IRQ_NOREQUEST from the desc, these tests now pass on arm and powerpc.
--- kernel/irq/irq_test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/irq/irq_test.c +12 -0
@@ -54,6 +54,9 @@ static void irq_disable_depth_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + ret =request_irq (virq, noop_handler,0 ,"test_irq" ,NULL );KUNIT_EXPECT_EQ (test, ret,0 );
@@ -81,6 +84,9 @@ static void irq_free_disabled_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + ret =request_irq (virq, noop_handler,0 ,"test_irq" ,NULL );KUNIT_EXPECT_EQ (test, ret,0 );
@@ -120,6 +126,9 @@ static void irq_shutdown_depth_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + data =irq_desc_get_irq_data (desc);KUNIT_ASSERT_PTR_NE (test, data,NULL );
@@ -180,6 +189,9 @@ static void irq_cpuhotplug_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + data =irq_desc_get_irq_data (desc);KUNIT_ASSERT_PTR_NE (test, data,NULL );
Signature · 1 line
2.51.0.rc1.167.g924127e9c0-goog
Quoted 14 lines · David Gow
The new irq KUnit tests fail on some architectures (notably PowerPC and 32-bit ARM), as the
request_irq()call fails due to theARCH_IRQ_INIT_FLAGScontainingIRQ_NOREQUEST, yielding the following errors:
[10:17:45] #irq_free_disabled_test: EXPECTATION FAILED atkernel/irq/irq_test.c:88
[10:17:45] Expected ret == 0, but
[10:17:45] ret == -22 (0xffffffffffffffea)
[10:17:45] #irq_free_disabled_test: EXPECTATION FAILED atkernel/irq/irq_test.c:90
[10:17:45] Expecteddesc->depth== 0, but
[10:17:45]desc->depth== 1 (0x1)
[10:17:45] #irq_free_disabled_test: EXPECTATION FAILED atkernel/irq/irq_test.c:93
[10:17:45] Expecteddesc->depth== 1, but
[10:17:45]desc->depth== 2 (0x2)
Quoted 5 lines
If we clear
IRQ_NOREQUESTfrom the desc, these tests now pass on arm and powerpc.Fixes 66067c3c8a1e ("genirq: Add kunit tests for depth counts")Signed-off-by David Gow <[email protected]>
This doesn't completely fix the problems with the code, but it is a start.
From:
Unit test results:
pass: 640019 fail: 652
to:
Unit test results:
pass: 640559 fail: 114
Above tests now pass for most architectures/platforms, so
Detailed test results are at https://kerneltests.org/builders in the "testing" column in case anyone wants to have a look.
Guenter
Quoted 14 lines · David Gow
The new irq KUnit tests fail on some architectures (notably PowerPC and 32-bit ARM), as the
request_irq()call fails due to theARCH_IRQ_INIT_FLAGScontainingIRQ_NOREQUEST, yielding the following errors:
[10:17:45] #irq_free_disabled_test: EXPECTATION FAILED atkernel/irq/irq_test.c:88
[10:17:45] Expected ret == 0, but
[10:17:45] ret == -22 (0xffffffffffffffea)
[10:17:45] #irq_free_disabled_test: EXPECTATION FAILED atkernel/irq/irq_test.c:90
[10:17:45] Expecteddesc->depth== 0, but
[10:17:45]desc->depth== 1 (0x1)
[10:17:45] #irq_free_disabled_test: EXPECTATION FAILED atkernel/irq/irq_test.c:93
[10:17:45] Expecteddesc->depth== 1, but
[10:17:45]desc->depth== 2 (0x2)
Quoted 5 lines
If we clear
IRQ_NOREQUESTfrom the desc, these tests now pass on arm and powerpc.Fixes 66067c3c8a1e ("genirq: Add kunit tests for depth counts")Signed-off-by David Gow <[email protected]>
I was about to send essentially the same patch. Works for me.
tools/testing/kunit/kunit.py run 'irq_test_cases*' --arch arm \
--qemu_args '-smp 2' --cross_compile arm-linux-gnueabi-...
[09:44:15] Testing complete. Ran 4 tests: passed: 4
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: c9163915a93d40e32c4e4aeb942c0adcb190d72e Gitweb: https://git.kernel.org/tip/c9163915a93d40e32c4e4aeb942c0adcb190d72e Author: David Gow <[email protected]> AuthorDate: Sat, 16 Aug 2025 17:45:28 +08:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Wed, 03 Sep 2025 17:04:51 +02:00
genirq/test: Fix depth tests on architectures with NOREQUEST by default.
The new irq KUnit tests fail on some architectures (notably PowerPC and 32-bit ARM), as the request_irq() call fails due to the ARCH_IRQ_INIT_FLAGS containing IRQ_NOREQUEST, yielding the following errors:
[10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:88
[10:17:45] Expected ret == 0, but
[10:17:45] ret == -22 (0xffffffffffffffea)
[10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:90
[10:17:45] Expected desc->depth == 0, but
[10:17:45] desc->depth == 1 (0x1)
[10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:93
[10:17:45] Expected desc->depth == 1, but
[10:17:45] desc->depth == 2 (0x2)
By clearing IRQ_NOREQUEST from the interrupt descriptor, these tests now pass on ARM and PowerPC.
--- kernel/irq/irq_test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/irq/irq_test.c +12 -0
@@ -54,6 +54,9 @@ static void irq_disable_depth_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + ret =request_irq (virq, noop_handler,0 ,"test_irq" ,NULL );KUNIT_EXPECT_EQ (test, ret,0 );
@@ -81,6 +84,9 @@ static void irq_free_disabled_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + ret =request_irq (virq, noop_handler,0 ,"test_irq" ,NULL );KUNIT_EXPECT_EQ (test, ret,0 );
@@ -120,6 +126,9 @@ static void irq_shutdown_depth_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + data =irq_desc_get_irq_data (desc);KUNIT_ASSERT_PTR_NE (test, data,NULL );
@@ -180,6 +189,9 @@ static void irq_cpuhotplug_test(struct kunit *test) desc =irq_to_desc (virq);KUNIT_ASSERT_PTR_NE (test, desc,NULL ); +/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */ +irq_settings_clr_norequest (desc); + data =irq_desc_get_irq_data (desc);KUNIT_ASSERT_PTR_NE (test, data,NULL );