[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8aae17cf-7c2b-85bb-d0f5-a5f71e792d16@quicinc.com>
Date: Mon, 14 Nov 2022 07:53:28 -0700
From: Jeffrey Hugo <quic_jhugo@...cinc.com>
To: Qiang Yu <quic_qianyu@...cinc.com>, <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>
Subject: Re: [PATCH v2] bus: mhi: host: Disable preemption while processing
data events
On 11/14/2022 2:58 AM, Qiang Yu wrote:
> 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>
> ---
> v1->v2: add comments about why we disable local irq
>
> drivers/bus/mhi/host/main.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c
> index f3aef77a..fcb2586 100644
> --- a/drivers/bus/mhi/host/main.c
> +++ b/drivers/bus/mhi/host/main.c
> @@ -1027,13 +1027,20 @@ int mhi_process_data_event_ring(struct mhi_controller *mhi_cntrl,
>
> void mhi_ev_task(unsigned long data)
> {
> + unsigned long flags;
> struct mhi_event *mhi_event = (struct mhi_event *)data;
> struct mhi_controller *mhi_cntrl = mhi_event->mhi_cntrl;
>
> /* process all pending events */
> - spin_lock_bh(&mhi_event->lock);
> + spin_lock_irqsave(&mhi_event->lock, flags);
> + /*
> + * When muiltiple IRQs come, the tasklet will be scheduled out with event ring lock
multiple
> + * remaining acquired, causing M0 event process on another core gets stuck when it
> + * tries to acquire the same event ring lock. Thus let's disable local IRQs here.
> + */
> +
> 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)
Powered by blists - more mailing lists