Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4126654rwl; Mon, 10 Apr 2023 06:37:38 -0700 (PDT) X-Google-Smtp-Source: AKy350Z1YlXxrM6aJ4NObG8Ahss5tLsST5a6ik9A+Zt0OguTBxTy9YZCRtw6wql53WnS/0XLeb4w X-Received: by 2002:a17:906:6b1a:b0:947:9142:e521 with SMTP id q26-20020a1709066b1a00b009479142e521mr5951328ejr.35.1681133858135; Mon, 10 Apr 2023 06:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681133858; cv=none; d=google.com; s=arc-20160816; b=QWlEdfO7yXMTPGkNREo+BH5Xvj3lZp0WfbMnpnejveOofY4KESP5bdxSzwyjkHWdWR EaYWP5gbSjUKeQedG19Sq4hSfKglYgCycYm6AYFIoCyrLxLpL5Z2jGVYUpn06xiZC9B6 vmSmVYwcvgJUPt/9HsAWsNi+/1rcp3AcN1GT59yLqEw+b/rB9B13zeR0u+QkNp3OzJ0r gQ/sgrfzCZeqLPoY6e3Ae5SievZuAvzTGaIV999lzS3BdLMYFcZkukebE6trhDKXEoKu GByBqjDDbyF4V6AfLUFl8N+L42kzJ9wheG9b1Z2cxCkDWL1RiKZeYx8E2pcVMB8ydbGI XecA== 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=WGdI1glaMMCETseerlSSFNfrR5Qrxo/4KeSk73dAhQU=; b=ynRYrN+jQo6VJIY8XpzbqkhIIT4rZKpGupvDwoNd+rndgr3qrl7ZU4fLD68AdB5C01 oHU5Cx1z3aRNMtfMZ8lsYDfxpUdAXj2qscAJH0LlwP5jMVbbWE02Bic6rDrX1ncYWIlv +CsV53eHlh0uUaECogUL+Co+yaDwoKt8Cwikvz/JnKzCMQP0sYN0d4mCmWdZ+xaZ8rCX vcOwUrsIqTDhmBA6yQ8Gxn/2+Uh1G7Ol+t9gI4lzOSJs88FiNjbHoxfNcFTZaoWO3t6T CdRY2VAvDhzJbddsXetZg38YqFe55MwF635Vn1P5+AUlddqcJad6FiRBiZWSdgHKpW5A 4Fnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uwds1kNB; 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 lw25-20020a170906bcd900b008dffd95e783si9448527ejb.568.2023.04.10.06.37.13; Mon, 10 Apr 2023 06:37:38 -0700 (PDT) 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=uwds1kNB; 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 S229882AbjDJNO6 (ORCPT + 99 others); Mon, 10 Apr 2023 09:14:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjDJNO5 (ORCPT ); Mon, 10 Apr 2023 09:14:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B425E4ECF; Mon, 10 Apr 2023 06:14:56 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 48F4C60F55; Mon, 10 Apr 2023 13:14:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E30CC433EF; Mon, 10 Apr 2023 13:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681132495; bh=W7rc4tAnnkDF+jqiSqVFhUih0Hb85Hq/IAnA8/Fl6wc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uwds1kNB3HtTwdCpSbG1OP3oAWrx/VpYSONB6hkkKPKVnV9NrYMq824H8Hqj2rD2m J7bWBbhsKRXjJ/zoku+2fFKlg9gwgHM3t00M0KU2ymXCNWEh52CFt6BOYz14O0idRx zXqA6u5LLoUv/kk+42jVMuoKPVBnuW4V29S18sBZh88eYZFcpS30CvOORrOguiOStn utw2eQMkOma7h98QuDvWMJgKcVbPKhQE99B5ie6RMEYMyT/YP1ccPXLnzCnDOyZgGA FY/MqIVx2FwsLreNY9jNIVYSPOPWlxaaFSEG+aIwHpf9nJPvqlTTGSlDE2KZSzuvMc quvgenwnZv47g== Date: Mon, 10 Apr 2023 18:44:46 +0530 From: Manivannan Sadhasivam To: Vivek Pernamitta Cc: mhi@lists.linux.dev, quic_qianyu@quicinc.com, manivannan.sadhasivam@linaro.org, quic_vbadigan@quicinc.com, quic_krichai@quicinc.com, quic_skananth@quicinc.com, Jeffrey Hugo , Hemant Kumar , Bhaumik Bhatt , "open list:MHI BUS" , open list Subject: Re: [PATCH V6] bus: mhi: host: Avoid ringing EV DB if there is no elements to process Message-ID: <20230410131446.GA4630@thinkpad> References: <1680601458-9105-1-git-send-email-quic_vpernami@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1680601458-9105-1-git-send-email-quic_vpernami@quicinc.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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, Apr 04, 2023 at 03:14:16PM +0530, Vivek Pernamitta wrote: > currently mhi_process_data_event_ring()/mhi_process_ctrl_ev_ring() > will ring DB even if there no ring elements to process. > This could cause doorbell event to be processed by MHI device > to check for any ring elements even it is none. > So ring event DB only if any event ring elements are processed. > > Signed-off-by: Vivek Pernamitta Slightly reworded the commit message and applied to mhi-next! - Mani > Reviewed-by: Jeffrey Hugo > Reviewed-by: Manivannan Sadhasivam > --- > changes since v6: > updating the commit text. > changes since v5: > updating the commit text. > changes since v4: > updating the commit text with more information. > changes since v3: > - Updating commit text for multiple versions of patches. > changes since v2: > - Updated comments in code. > changes since v1: > - Add an check to avoid ringing EV DB in mhi_process_ctrl_ev_ring(). > --- > drivers/bus/mhi/host/main.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c > index df0fbfe..1bbdb75 100644 > --- a/drivers/bus/mhi/host/main.c > +++ b/drivers/bus/mhi/host/main.c > @@ -961,7 +961,9 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl, > } > > read_lock_bh(&mhi_cntrl->pm_lock); > - if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) > + > + /* Ring EV DB only if there is any pending element to process */ > + if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl)) && count) > mhi_ring_er_db(mhi_event); > read_unlock_bh(&mhi_cntrl->pm_lock); > > @@ -1031,7 +1033,9 @@ int mhi_process_data_event_ring(struct mhi_controller *mhi_cntrl, > count++; > } > read_lock_bh(&mhi_cntrl->pm_lock); > - if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) > + > + /* Ring EV DB only if there is any pending element to process */ > + if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl)) && count) > mhi_ring_er_db(mhi_event); > read_unlock_bh(&mhi_cntrl->pm_lock); > > -- > 2.7.4 > -- மணிவண்ணன் சதாசிவம்