[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1669023264-84125-1-git-send-email-quic_qianyu@quicinc.com>
Date: Mon, 21 Nov 2022 17:34:24 +0800
From: Qiang Yu <quic_qianyu@...cinc.com>
To: mani@...nel.org, loic.poulain@...aro.org
Cc: mhi@...ts.linux.dev, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_cang@...cinc.com,
mrana@...cinc.com, Qiang Yu <quic_qianyu@...cinc.com>
Subject: [PATCH v4] bus: mhi: host: Disable preemption while processing data events
If data processing of an event is scheduled out because core
is busy handling multiple irqs, this can starve the processing
of MHI M0 state change event on another core. Fix this issue by
disabling irq on the core processing data events.
Signed-off-by: Qiang Yu <quic_qianyu@...cinc.com>
---
v3->v4: modify the comment
v2->v3: modify the comment
v1->v2: add comments about why we disable local irq
drivers/bus/mhi/host/main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c
index f3aef77a..6c804c3 100644
--- a/drivers/bus/mhi/host/main.c
+++ b/drivers/bus/mhi/host/main.c
@@ -1029,11 +1029,17 @@ void mhi_ev_task(unsigned long data)
{
struct mhi_event *mhi_event = (struct mhi_event *)data;
struct mhi_controller *mhi_cntrl = mhi_event->mhi_cntrl;
+ unsigned long flags;
+ /*
+ * When multiple IRQs arrive, the tasklet will be scheduled out with event ring lock
+ * acquired, causing other high priority events like M0 state transition getting stuck
+ * while trying to acquire the same event ring lock. Thus, let's disable local IRQs here.
+ */
+ spin_lock_irqsave(&mhi_event->lock, flags);
/* process all pending events */
- spin_lock_bh(&mhi_event->lock);
mhi_event->process_event(mhi_cntrl, mhi_event, U32_MAX);
- spin_unlock_bh(&mhi_event->lock);
+ spin_unlock_irqrestore(&mhi_event->lock, flags);
}
void mhi_ctrl_ev_task(unsigned long data)
--
2.7.4
Powered by blists - more mailing lists