[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175446920768.1420.10144196712187691411.tip-bot2@tip-bot2>
Date: Wed, 06 Aug 2025 08:33:27 -0000
From: "tip-bot2 for Brian Norris" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Guenter Roeck <linux@...ck-us.net>,
Brian Norris <briannorris@...omium.org>, Thomas Gleixner <tglx@...utronix.de>,
x86@...nel.org, linux-kernel@...r.kernel.org, maz@...nel.org
Subject: [tip: irq/urgent] genirq/test: Resolve irq lock inversion warnings
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 5b65258229117995eb6c4bd74995e15fb5f2cfe3
Gitweb: https://git.kernel.org/tip/5b65258229117995eb6c4bd74995e15fb5f2cfe3
Author: Brian Norris <briannorris@...omium.org>
AuthorDate: Tue, 05 Aug 2025 11:32:20 -07:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Wed, 06 Aug 2025 10:29:48 +02:00
genirq/test: Resolve irq lock inversion warnings
irq_shutdown_and_deactivate() is normally called with the descriptor lock
held, and interrupts disabled. Nested a few levels down, it grabs the
global irq_resend_lock. Lockdep rightfully complains when interrupts are
not disabled:
CPU0 CPU1
---- ----
lock(irq_resend_lock);
local_irq_disable();
lock(&irq_desc_lock_class);
lock(irq_resend_lock);
<Interrupt>
lock(&irq_desc_lock_class);
...
_raw_spin_lock+0x2b/0x40
clear_irq_resend+0x14/0x70
irq_shutdown_and_deactivate+0x29/0x80
irq_shutdown_depth_test+0x1ce/0x600
kunit_try_run_case+0x90/0x120
Grab the descriptor lock and disable interrupts, to resolve the
problem.
Fixes: 66067c3c8a1e ("genirq: Add kunit tests for depth counts")
Reported-by: Guenter Roeck <linux@...ck-us.net>
Signed-off-by: Brian Norris <briannorris@...omium.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Guenter Roeck <linux@...ck-us.net>
Link: https://lore.kernel.org/all/aJJONEIoIiTSDMqc@google.com
Closes: https://lore.kernel.org/lkml/31a761e4-8f81-40cf-aaf5-d220ba11911c@roeck-us.net/
---
kernel/irq/irq_test.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/irq/irq_test.c b/kernel/irq/irq_test.c
index 5161b56..a75abeb 100644
--- a/kernel/irq/irq_test.c
+++ b/kernel/irq/irq_test.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: LGPL-2.1+
+#include <linux/cleanup.h>
#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/interrupt.h>
@@ -134,7 +135,8 @@ static void irq_shutdown_depth_test(struct kunit *test)
disable_irq(virq);
KUNIT_EXPECT_EQ(test, desc->depth, 1);
- irq_shutdown_and_deactivate(desc);
+ scoped_guard(raw_spinlock_irqsave, &desc->lock)
+ irq_shutdown_and_deactivate(desc);
KUNIT_EXPECT_FALSE(test, irqd_is_activated(data));
KUNIT_EXPECT_FALSE(test, irqd_is_started(data));
Powered by blists - more mailing lists