From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AD32C2B9F4 for ; Sat, 19 Jun 2021 07:44:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34339611AC for ; Sat, 19 Jun 2021 07:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231970AbhFSHrC (ORCPT ); Sat, 19 Jun 2021 03:47:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:38960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229466AbhFSHq7 (ORCPT ); Sat, 19 Jun 2021 03:46:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 416A26102A; Sat, 19 Jun 2021 07:44:46 +0000 (UTC) Date: Sat, 19 Jun 2021 13:14:42 +0530 From: Manivannan Sadhasivam To: Bhaumik Bhatt Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, loic.poulain@linaro.org Subject: Re: [PATCH] bus: mhi: core: Disable pre-emption for data events tasklet processing Message-ID: <20210619074442.GC4889@workstation> References: <1624054985-31365-1-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1624054985-31365-1-git-send-email-bbhatt@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 18, 2021 at 03:23:05PM -0700, Bhaumik Bhatt wrote: > With spin_lock_bh(), it is possible that a tasklet processing data > events gets scheduled out if another higher priority tasklet is > ready to run. While the tasklet is sleeping, 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 this issue by disabling pre-emption on the core > processing data events and allow it to run to completion such that > other tasklets do not block for long periods. > Are you sure? IIUC, the tasklets priority is only used while trying to schedule the next pending tasklet. But I don't think a high priority tasklet can preempt the low priority one. Please correct me if I'm wrong. Thanks, Mani > Fixes: 1d3173a3bae7 ("bus: mhi: core: Add support for processing events from client device") > Signed-off-by: Bhaumik Bhatt > --- > 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 >