lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 22 Feb 2023 16:26:37 +0530
From:   Vivek Pernamitta <quic_vpernami@...cinc.com>
To:     mhi@...ts.linux.dev
Cc:     quic_qianyu@...cinc.com, manivannan.sadhasivam@...aro.org,
        quic_vbadigan@...cinc.com, quic_krichai@...cinc.com,
        quic_skananth@...cinc.com,
        Vivek Pernamitta <quic_vpernami@...cinc.com>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Alex Elder <elder@...aro.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Hemant Kumar <hemantk@...eaurora.org>,
        Jeffrey Hugo <quic_jhugo@...cinc.com>,
        Paul Davey <paul.davey@...iedtelesis.co.nz>,
        Bhaumik Bhatt <bbhatt@...eaurora.org>,
        linux-arm-msm@...r.kernel.org (open list:MHI BUS),
        linux-kernel@...r.kernel.org (open list)
Subject: [PATCH V2] bus: mhi: host: Avoid ringing EV DB if there is no elements to process

Avoid ringing Event DB if there is no elements to process.
As mhi_poll function can be called by mhi client drivers
which will call process_event, which will ring DB even if
there no ring elements to process.

Signed-off-by: Vivek Pernamitta <quic_vpernami@...cinc.com>
---
 drivers/bus/mhi/host/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c
index df0fbfe..0311a31 100644
--- a/drivers/bus/mhi/host/main.c
+++ b/drivers/bus/mhi/host/main.c
@@ -961,7 +961,7 @@ 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)))
+	if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl)) && count)
 		mhi_ring_er_db(mhi_event);
 	read_unlock_bh(&mhi_cntrl->pm_lock);
 
@@ -1031,7 +1031,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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ