linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] bus: mhi: core: Disable pre-emption for events tasklet processing
@ 2021-06-22  2:34 Bhaumik Bhatt
  0 siblings, 0 replies; only message in thread
From: Bhaumik Bhatt @ 2021-06-22  2:34 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: linux-arm-msm, hemantk, jhugo, linux-kernel, loic.poulain, Bhaumik Bhatt

With spin_lock_bh(), it is possible that a tasklet processing data
events gets pre-empted by RT tasks or a storm of threaded interrupt
handlers ready to run on that core. While the tasklet gets
scheduled out, it can hold the event ring spinlock and block
another tasklet, for example, one processing an M0 state change
event, from acquiring it. This can starve the core which blocks in
an attempt to acquire the spinlock until it gets released. Fix the
issue by disabling pre-emption on the core processing data events
and allow the tasklet to run to completion such that other tasklets
do not block on it for long periods.

Fixes: 1d3173a3bae7 ("bus: mhi: core: Add support for processing events from client device")
Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
---
v2:
-Updated description to clarify the scenario

 drivers/bus/mhi/core/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
index 3775c77..02c8c09 100644
--- a/drivers/bus/mhi/core/main.c
+++ b/drivers/bus/mhi/core/main.c
@@ -1036,11 +1036,12 @@ 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;
 
 	/* process all pending events */
-	spin_lock_bh(&mhi_event->lock);
+	spin_lock_irqsave(&mhi_event->lock, flags);
 	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)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-22  2:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  2:34 [PATCH v2] bus: mhi: core: Disable pre-emption for events tasklet processing Bhaumik Bhatt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).