2020-06-29 18:52:20

by Bhaumik Bhatt

[permalink] [raw]
Subject: [PATCH v4 2/9] bus: mhi: core: Abort suspends due to outgoing pending packets

Add the missing check to abort suspends if a client has pending outgoing
packets to send to the device. This allows better utilization of the MHI
bus wherein clients on the host are not left waiting for longer suspend
or resume cycles to finish for data transfers.

Signed-off-by: Bhaumik Bhatt <[email protected]>
---
drivers/bus/mhi/core/pm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 7960980..661d704 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -686,7 +686,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)
return -EIO;

/* Return busy if there are any pending resources */
- if (atomic_read(&mhi_cntrl->dev_wake))
+ if (atomic_read(&mhi_cntrl->dev_wake) ||
+ atomic_read(&mhi_cntrl->pending_pkts))
return -EBUSY;

/* Take MHI out of M2 state */
@@ -712,7 +713,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)

write_lock_irq(&mhi_cntrl->pm_lock);

- if (atomic_read(&mhi_cntrl->dev_wake)) {
+ if (atomic_read(&mhi_cntrl->dev_wake) ||
+ atomic_read(&mhi_cntrl->pending_pkts)) {
write_unlock_irq(&mhi_cntrl->pm_lock);
return -EBUSY;
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2020-07-04 14:36:18

by Manivannan Sadhasivam

[permalink] [raw]
Subject: Re: [PATCH v4 2/9] bus: mhi: core: Abort suspends due to outgoing pending packets

On Mon, Jun 29, 2020 at 09:39:35AM -0700, Bhaumik Bhatt wrote:
> Add the missing check to abort suspends if a client has pending outgoing
> packets to send to the device. This allows better utilization of the MHI
> bus wherein clients on the host are not left waiting for longer suspend
> or resume cycles to finish for data transfers.
>

Just one nitpick: Please always use the terms 'client drivers' referring to the
MHI client drivers in the kernel and 'client devices' referring to the physical
MHI client devices. The term 'client' creates ambiguity.

> Signed-off-by: Bhaumik Bhatt <[email protected]>

Reviewed-by: Manivannan Sadhasivam <[email protected]>

Thanks,
Mani

> ---
> drivers/bus/mhi/core/pm.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
> index 7960980..661d704 100644
> --- a/drivers/bus/mhi/core/pm.c
> +++ b/drivers/bus/mhi/core/pm.c
> @@ -686,7 +686,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)
> return -EIO;
>
> /* Return busy if there are any pending resources */
> - if (atomic_read(&mhi_cntrl->dev_wake))
> + if (atomic_read(&mhi_cntrl->dev_wake) ||
> + atomic_read(&mhi_cntrl->pending_pkts))
> return -EBUSY;
>
> /* Take MHI out of M2 state */
> @@ -712,7 +713,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)
>
> write_lock_irq(&mhi_cntrl->pm_lock);
>
> - if (atomic_read(&mhi_cntrl->dev_wake)) {
> + if (atomic_read(&mhi_cntrl->dev_wake) ||
> + atomic_read(&mhi_cntrl->pending_pkts)) {
> write_unlock_irq(&mhi_cntrl->pm_lock);
> return -EBUSY;
> }
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>