All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Hemant Kumar <hemantk@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	jhugo@codeaurora.org, bbhatt@codeaurora.org
Subject: Re: [PATCH v1 5/5] bus: mhi: core: Handle write lock properly in mhi_pm_m0_transition
Date: Tue, 12 May 2020 12:27:15 +0530	[thread overview]
Message-ID: <20200512065715.GG4928@Mani-XPS-13-9360> (raw)
In-Reply-To: <1589248989-23824-6-git-send-email-hemantk@codeaurora.org>

On Mon, May 11, 2020 at 07:03:09PM -0700, Hemant Kumar wrote:
> Take write lock only to protect db_mode member of mhi channel.
> This allows rest of the mhi channels to just take read lock which
> fine grains the locking. It prevents channel readers to starve if
> they try to enter critical section after a writer.
> 
> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/pm.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
> index 345f197..de5abb2 100644
> --- a/drivers/bus/mhi/core/pm.c
> +++ b/drivers/bus/mhi/core/pm.c
> @@ -288,14 +288,18 @@ int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl)
>  	for (i = 0; i < mhi_cntrl->max_chan; i++, mhi_chan++) {
>  		struct mhi_ring *tre_ring = &mhi_chan->tre_ring;
>  
> -		write_lock_irq(&mhi_chan->lock);
> -		if (mhi_chan->db_cfg.reset_req)
> +		if (mhi_chan->db_cfg.reset_req) {
> +			write_lock_irq(&mhi_chan->lock);
>  			mhi_chan->db_cfg.db_mode = true;
> +			write_unlock_irq(&mhi_chan->lock);
> +		}
> +
> +		read_lock_irq(&mhi_chan->lock);
>  
>  		/* Only ring DB if ring is not empty */
>  		if (tre_ring->base && tre_ring->wp  != tre_ring->rp)
>  			mhi_ring_chan_db(mhi_cntrl, mhi_chan);
> -		write_unlock_irq(&mhi_chan->lock);
> +		read_unlock_irq(&mhi_chan->lock);
>  	}
>  
>  	mhi_cntrl->wake_put(mhi_cntrl, false);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project

  reply	other threads:[~2020-05-12  6:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12  2:03 [PATCH v1 0/5] MHI Misc Fixes Hemant Kumar
2020-05-12  2:03 ` [PATCH v1 1/5] bus: mhi: core: Remove the system error worker thread Hemant Kumar
2020-05-12  6:46   ` Manivannan Sadhasivam
2020-05-12  2:03 ` [PATCH v1 2/5] bus: mhi: core: Handle disable transitions in state worker Hemant Kumar
2020-05-12  6:47   ` Manivannan Sadhasivam
2020-05-12  2:03 ` [PATCH v1 3/5] bus: mhi: core: Skip handling BHI irq if MHI reg access is not allowed Hemant Kumar
2020-05-12  6:53   ` Manivannan Sadhasivam
2020-05-13  0:28     ` Hemant Kumar
2020-05-13  7:04       ` Manivannan Sadhasivam
2020-05-13 18:39         ` Hemant Kumar
2020-05-13  7:58   ` Manivannan Sadhasivam
2020-05-12  2:03 ` [PATCH v1 4/5] bus: mhi: core: Do not process SYS_ERROR if RDDM is supported Hemant Kumar
2020-05-12  6:55   ` Manivannan Sadhasivam
2020-05-12  2:03 ` [PATCH v1 5/5] bus: mhi: core: Handle write lock properly in mhi_pm_m0_transition Hemant Kumar
2020-05-12  6:57   ` Manivannan Sadhasivam [this message]
2020-05-12  7:04 ` [PATCH v1 0/5] MHI Misc Fixes Manivannan Sadhasivam
2020-05-13 10:35 ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512065715.GG4928@Mani-XPS-13-9360 \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=bbhatt@codeaurora.org \
    --cc=hemantk@codeaurora.org \
    --cc=jhugo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.