From: Quanyang Wang <quanyang.w...@windriver.com>

The function irq_finalize_oneshot is called after local_bh_disable()
in irq_forced_thread_fn, and there is operation sequences as below:

 -> local_bh_disable()   <= Will call rcu_read_lock() to increase
                            rcu_preempt_depth()
 -> irq_finalize_oneshot
 -> chip_bus_lock(desc)
  -> gic_irq_lock
   -> mutex_lock()
    -> __schedule        <= Will check rcu_preempt_depth() here and if
                            not zero will trigger WARNING

We should change irq_bus_lock to be a raw_spinlock to fix the calltrace
as below:

[   50.474547] WARNING: CPU: 7 PID: 471 at kernel/rcu/tree_plugin.h:297 
rcu_note_context_switch+0x348/0x598
[   50.474565] Modules linked in:
[   50.474573] CPU: 7 PID: 471 Comm: irq/88-uart-pl0 Not tainted 
5.10.57-rt47-yocto-preempt-rt #1
[   50.474580] Hardware name: INTEL Axxia
[   50.474587] [<c060f7a4>] (unwind_backtrace) from [<c0609f94>] 
(show_stack+0x18/0x1c)
[   50.474606] [<c0609f94>] (show_stack) from [<c0dac3d0>] 
(dump_stack+0x7c/0x98)
[   50.474619] [<c0dac3d0>] (dump_stack) from [<c061d0e4>] (__warn+0xcc/0xf8)
[   50.474633] [<c061d0e4>] (__warn) from [<c0da6500>] 
(warn_slowpath_fmt+0x84/0xb8)
[   50.474650] [<c0da6500>] (warn_slowpath_fmt) from [<c067d8b4>] 
(rcu_note_context_switch+0x348/0x598)
[   50.474662] [<c067d8b4>] (rcu_note_context_switch) from [<c0db37dc>] 
(__schedule+0xa4/0x5f8)
[   50.474675] [<c0db37dc>] (__schedule) from [<c0db3dd8>] (schedule+0xa8/0x100)
[   50.474688] [<c0db3dd8>] (schedule) from [<c0db4ce8>] 
(__rt_mutex_slowlock+0xa4/0x110)
[   50.474702] [<c0db4ce8>] (__rt_mutex_slowlock) from [<c0db4e60>] 
(rt_mutex_slowlock_locked+0x10c/0x1b8)
[   50.474713] [<c0db4e60>] (rt_mutex_slowlock_locked) from [<c0db4f84>] 
(rt_mutex_slowlock+0x78/0xb8)
[   50.474722] [<c0db4f84>] (rt_mutex_slowlock) from [<c0db52c8>] 
(__rt_mutex_lock_state+0x54/0x5c)
[   50.474732] [<c0db52c8>] (__rt_mutex_lock_state) from [<c066b99c>] 
(irq_finalize_oneshot+0x3c/0xc0)
[   50.474744] [<c066b99c>] (irq_finalize_oneshot) from [<c066ba88>] 
(irq_forced_thread_fn+0x68/0x84)
[   50.474754] [<c066ba88>] (irq_forced_thread_fn) from [<c066b794>] 
(irq_thread+0xd0/0x1cc)
[   50.474763] [<c066b794>] (irq_thread) from [<c063be38>] (kthread+0x184/0x194)
[   50.474773] [<c063be38>] (kthread) from [<c0600140>] 
(ret_from_fork+0x14/0x34)

Signed-off-by: Quanyang Wang <quanyang.w...@windriver.com>
---
 arch/arm/mach-axxia/axxia-gic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-axxia/axxia-gic.c b/arch/arm/mach-axxia/axxia-gic.c
index e5a6bd86ee7e..6d6c72a8ba0b 100644
--- a/arch/arm/mach-axxia/axxia-gic.c
+++ b/arch/arm/mach-axxia/axxia-gic.c
@@ -171,7 +171,7 @@ struct gic_rpc_data {
 };
 
 static DEFINE_RAW_SPINLOCK(irq_controller_lock);
-static DEFINE_MUTEX(irq_bus_lock);
+static DEFINE_RAW_SPINLOCK(irq_bus_lock);
 
 static struct gic_chip_data gic_data __read_mostly;
 static struct gic_rpc_data gic_rpc_data = {NULL, 0, 0, 0, 0, NULL};
@@ -871,7 +871,7 @@ static void __init gic_pm_init(struct gic_chip_data *gic)
 static void gic_irq_lock(struct irq_data *d)
 {
        /* Take the bus lock. */
-       mutex_lock(&irq_bus_lock);
+       raw_spin_lock(&irq_bus_lock);
 }
 
 static void gic_irq_sync_unlock(struct irq_data *d)
@@ -953,7 +953,7 @@ static void gic_irq_sync_unlock(struct irq_data *d)
        gic_rpc_data.func_mask = 0;
 
        /* Give the bus lock. */
-       mutex_unlock(&irq_bus_lock);
+       raw_spin_unlock(&irq_bus_lock);
 }
 
 static void axxia_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#10383): 
https://lists.yoctoproject.org/g/linux-yocto/message/10383
Mute This Topic: https://lists.yoctoproject.org/mt/85432029/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to