Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1901736rwb; Thu, 17 Nov 2022 03:54:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5y5RpwQ/j5BVYS9BEBebIxxL70x9mKKJ3ODC45KnWYxY3J4kT6KVBfV50FlCxiVOVBd+8y X-Received: by 2002:a17:903:3052:b0:174:af35:4b90 with SMTP id u18-20020a170903305200b00174af354b90mr2493549pla.8.1668686078682; Thu, 17 Nov 2022 03:54:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668686078; cv=none; d=google.com; s=arc-20160816; b=TOfnr6WUTV2JyKZAhz5XBHWdhP7Fuhsvu1rbsTFvK+HJd9MxUDOPkjEe/e1MJ/QViz 5b2uI6m+DS4fCxwVJ5/xfpKZ8euhaRptLmCE1syBGQxEsSYpz8RxXDw9/f/u2PJlULjj KfpIT+i/u8VIUuo8hsw07oGv/WI/6V7H76oXSFw1DMk5CR/h7b+jgCkCkDzbiVdUVtqB ycuYUBo/ulX1o58FjOQ/nekofIope2ElTJLjqJgBMCUxNi5dh6svACM/qfXDmvx95XKp Tai0bkOVY+8IzCU1+D7vV0JrFUwtqv8VgL3g5nOnkq38WLtIfaxZeIqZsnB+xKSXJMa5 1IdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TdC7rnkaDK9ZoS0jepjAUUQ8+isHqYw7hCD5ky0w/zg=; b=Eq+CVLztRk0J42fsxKZQaff+FLnSaLRT0oC4WNZNybIVN3zhxDGeLg6Pjak7YQGbZe yATg+s59MpSGjoacMZoxDwrKcxnOTN78sfBPjcRw80YMlI/Ot5VIKIiD8DBf1vpZLkeN anAzmEVjHd4YgunhVU7BH3knvnLlVGA4i++GinaN/pU1UNdxNKYTegBnRrUUEZWODPWf bEuRI+/Vgfom7aacYq0Fkz9MBCr2VNE9N6dh+pjn6c3jFTcw4xs9MQNbIxOo9avj/JH/ 1YPFWm7Hv5rg5G6eovzQtsTPBhF8Up8TDlfJrqZPXmn3T1Pv4G3rqrKuLfRaSWNQxcwJ WRew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d9IX4d7e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z190-20020a6265c7000000b00563352f734asi682604pfb.69.2022.11.17.03.54.27; Thu, 17 Nov 2022 03:54:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d9IX4d7e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239823AbiKQLnx (ORCPT + 92 others); Thu, 17 Nov 2022 06:43:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239811AbiKQLnu (ORCPT ); Thu, 17 Nov 2022 06:43:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A1E51C3A; Thu, 17 Nov 2022 03:43:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4F9E0B81FF8; Thu, 17 Nov 2022 11:43:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3449FC433C1; Thu, 17 Nov 2022 11:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668685427; bh=xgKPqZLlA+5TY1lw/gQlp4xDwC3HaX8Anj5NcM7+ksQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d9IX4d7eD50LL8mVClfWD1wICywrMzh+btm6VU32ub1WbE/RWdJRE1VTe+RQBT7xN LfSfwAbF8tNGEC1WRqmXNo7+KV1yg1me2kO/VyZ9G58OwwQu73WTmRxm0GYFNf2Mx8 Sq0QQLh95a3Uk2AezAQWCQVn+LQg8HM3AmFt4OvRUGihVJBs/c4jZXNxh6De+rDtut F3GIiC9ru2f+YyTPCfXaZR0vLIyeawHZN8I2QPpc5kz5Ykk7TktQBPebzBEifgjZBA fOlQIqPvYTR24puShvqMvyYpAL0hc2OE3AOJo5EG82h8wRPzOBWLqhXX96NIa4qaLN 72q60AbRVTDxg== Date: Thu, 17 Nov 2022 17:13:36 +0530 From: Manivannan Sadhasivam To: Qiang Yu Cc: mani@kernel.org, loic.poulain@linaro.org, mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, mrana@quicinc.com Subject: Re: [PATCH v3] bus: mhi: host: Disable preemption while processing data events Message-ID: <20221117114336.GC93179@thinkpad> References: <1668479031-12853-1-git-send-email-quic_qianyu@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1668479031-12853-1-git-send-email-quic_qianyu@quicinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 15, 2022 at 10:23:51AM +0800, 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 I'm counting on Jeff's review for this patch. Thanks, Mani > --- > v2->v3: modify the comment > 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..5dca0a0 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 multiple IRQs come, the tasklet will be scheduled out with event ring lock > + * 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) > -- > 2.7.4 > > -- மணிவண்ணன் சதாசிவம்