All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Two cpp41 pm runtime found when testing with usb
@ 2016-11-09 16:47 Tony Lindgren
       [not found] ` <20161109164759.24913-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Tony Lindgren @ 2016-11-09 16:47 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul
  Cc: Bin Liu, Daniel Mack, Felipe Balbi, George Cherian, Johan Hovold,
	Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

Hi,

I found two pm runtime issues when testing with usb on beaglebone.

In the am335x case cppi41 and two instances of musb controller share
the same interconnect wrapper module, so any pm issues with musb or
cppi41 will keep the interconnect wrapper module busy.

Regards,

Tony


Tony Lindgren (2):
  dma: cppi41: Fix list not empty warning on module removal
  dma: cppi41: Fix unpaired pm runtime when only a USB hub is connected

 drivers/dma/cppi41.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

-- 
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dma: cppi41: Fix list not empty warning on module removal
       [not found] ` <20161109164759.24913-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2016-11-09 16:47   ` Tony Lindgren
  2016-11-09 16:47   ` [PATCH 2/2] dma: cppi41: Fix unpaired pm runtime when only a USB hub is connected Tony Lindgren
  2016-11-14  5:28   ` [PATCH 0/2] Two cpp41 pm runtime found when testing with usb Vinod Koul
  2 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2016-11-09 16:47 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul
  Cc: Bin Liu, Daniel Mack, Felipe Balbi, George Cherian, Johan Hovold,
	Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

If musb controller is configured with USB peripherals and we have
enumerated with a USB host, we can get warnings on removal of the
modules:

WARNING: CPU: 0 PID: 1269 at drivers/dma/cppi41.c:391
cppi41_dma_free_chan_resources

Fix the issue by adding the missing pm_runtime_get to
cppi41_dma_free_chan_resources to make sure the pending work
list is cleared on removal.

Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/dma/cppi41.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -1072,7 +1072,12 @@ static int cppi41_dma_probe(struct platform_device *pdev)
 static int cppi41_dma_remove(struct platform_device *pdev)
 {
 	struct cppi41_dd *cdd = platform_get_drvdata(pdev);
+	int error;
 
+	error = pm_runtime_get_sync(&pdev->dev);
+	if (error < 0)
+		dev_err(&pdev->dev, "%s could not pm_runtime_get: %i\n",
+			__func__, error);
 	of_dma_controller_free(pdev->dev.of_node);
 	dma_async_device_unregister(&cdd->ddev);
 
-- 
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] dma: cppi41: Fix unpaired pm runtime when only a USB hub is connected
       [not found] ` <20161109164759.24913-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  2016-11-09 16:47   ` [PATCH 1/2] dma: cppi41: Fix list not empty warning on module removal Tony Lindgren
@ 2016-11-09 16:47   ` Tony Lindgren
  2016-11-14  5:28   ` [PATCH 0/2] Two cpp41 pm runtime found when testing with usb Vinod Koul
  2 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2016-11-09 16:47 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul
  Cc: Bin Liu, Daniel Mack, Felipe Balbi, George Cherian, Johan Hovold,
	Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

On am335x with musb host we can end up with unpaired pm runtime calls
if a hub with no devices is connected and disconnected.

This is because of the conditional pm runtime calls which are always
a bad idea. Let's fix the issue by making them unconditional and
paired in each function.

Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/dma/cppi41.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -318,6 +318,11 @@ static irqreturn_t cppi41_irq(int irq, void *data)
 		while (val) {
 			u32 desc, len;
 
+			status = pm_runtime_get(cdd->ddev.dev);
+			if (status < 0)
+				dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
+					__func__, status);
+
 			q_num = __fls(val);
 			val &= ~(1 << q_num);
 			q_num += 32 * i;
@@ -338,7 +343,6 @@ static irqreturn_t cppi41_irq(int irq, void *data)
 			dma_cookie_complete(&c->txd);
 			dmaengine_desc_get_callback_invoke(&c->txd, NULL);
 
-			/* Paired with cppi41_dma_issue_pending */
 			pm_runtime_mark_last_busy(cdd->ddev.dev);
 			pm_runtime_put_autosuspend(cdd->ddev.dev);
 		}
@@ -460,7 +464,6 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
 	struct cppi41_dd *cdd = c->cdd;
 	int error;
 
-	/* PM runtime paired with dmaengine_desc_get_callback_invoke */
 	error = pm_runtime_get(cdd->ddev.dev);
 	if ((error != -EINPROGRESS) && error < 0) {
 		dev_err(cdd->ddev.dev, "Failed to pm_runtime_get: %i\n",
@@ -473,6 +476,9 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
 		push_desc_queue(c);
 	else
 		pending_desc(c);
+
+	pm_runtime_mark_last_busy(cdd->ddev.dev);
+	pm_runtime_put_autosuspend(cdd->ddev.dev);
 }
 
 static u32 get_host_pd0(u32 length)
-- 
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Two cpp41 pm runtime found when testing with usb
       [not found] ` <20161109164759.24913-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  2016-11-09 16:47   ` [PATCH 1/2] dma: cppi41: Fix list not empty warning on module removal Tony Lindgren
  2016-11-09 16:47   ` [PATCH 2/2] dma: cppi41: Fix unpaired pm runtime when only a USB hub is connected Tony Lindgren
@ 2016-11-14  5:28   ` Vinod Koul
  2016-11-14 14:49     ` Tony Lindgren
  2 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2016-11-14  5:28 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Dan Williams, Bin Liu, Daniel Mack, Felipe Balbi, George Cherian,
	Johan Hovold, Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

On Wed, Nov 09, 2016 at 09:47:57AM -0700, Tony Lindgren wrote:
> Hi,
> 
> I found two pm runtime issues when testing with usb on beaglebone.
> 
> In the am335x case cppi41 and two instances of musb controller share
> the same interconnect wrapper module, so any pm issues with musb or
> cppi41 will keep the interconnect wrapper module busy.

Applied both. And as I have told you previously please use the correct
subsystem tag. I have fixed them again!

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Two cpp41 pm runtime found when testing with usb
  2016-11-14  5:28   ` [PATCH 0/2] Two cpp41 pm runtime found when testing with usb Vinod Koul
@ 2016-11-14 14:49     ` Tony Lindgren
       [not found]       ` <20161114144912.GR7138-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Tony Lindgren @ 2016-11-14 14:49 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Dan Williams, Bin Liu, Daniel Mack, Felipe Balbi, George Cherian,
	Johan Hovold, Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

* Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> [161113 21:19]:
> On Wed, Nov 09, 2016 at 09:47:57AM -0700, Tony Lindgren wrote:
> > Hi,
> > 
> > I found two pm runtime issues when testing with usb on beaglebone.
> > 
> > In the am335x case cppi41 and two instances of musb controller share
> > the same interconnect wrapper module, so any pm issues with musb or
> > cppi41 will keep the interconnect wrapper module busy.
> 
> Applied both. And as I have told you previously please use the correct
> subsystem tag. I have fixed them again!

Sorry about that. What do you prefer for future reference? We are using
both "dma: cppi41" and "dmaengine: cppi41" currently..

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Two cpp41 pm runtime found when testing with usb
       [not found]       ` <20161114144912.GR7138-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
@ 2016-11-15  3:29         ` Vinod Koul
  2016-11-15  3:38           ` Tony Lindgren
  0 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2016-11-15  3:29 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Dan Williams, Bin Liu, Daniel Mack, Felipe Balbi, George Cherian,
	Johan Hovold, Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

On Mon, Nov 14, 2016 at 06:49:12AM -0800, Tony Lindgren wrote:
> * Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> [161113 21:19]:
> > On Wed, Nov 09, 2016 at 09:47:57AM -0700, Tony Lindgren wrote:
> > > Hi,
> > > 
> > > I found two pm runtime issues when testing with usb on beaglebone.
> > > 
> > > In the am335x case cppi41 and two instances of musb controller share
> > > the same interconnect wrapper module, so any pm issues with musb or
> > > cppi41 will keep the interconnect wrapper module busy.
> > 
> > Applied both. And as I have told you previously please use the correct
> > subsystem tag. I have fixed them again!
> 
> Sorry about that. What do you prefer for future reference? We are using
> both "dma: cppi41" and "dmaengine: cppi41" currently..

"dmaengine: cppi41: xxx" would be better

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Two cpp41 pm runtime found when testing with usb
  2016-11-15  3:29         ` Vinod Koul
@ 2016-11-15  3:38           ` Tony Lindgren
  0 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2016-11-15  3:38 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Dan Williams, Bin Liu, Daniel Mack, Felipe Balbi, George Cherian,
	Johan Hovold, Peter Ujfalusi, Sebastian Andrzej Siewior,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

* Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> [161114 19:20]:
> On Mon, Nov 14, 2016 at 06:49:12AM -0800, Tony Lindgren wrote:
> > * Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> [161113 21:19]:
> > > On Wed, Nov 09, 2016 at 09:47:57AM -0700, Tony Lindgren wrote:
> > > > Hi,
> > > > 
> > > > I found two pm runtime issues when testing with usb on beaglebone.
> > > > 
> > > > In the am335x case cppi41 and two instances of musb controller share
> > > > the same interconnect wrapper module, so any pm issues with musb or
> > > > cppi41 will keep the interconnect wrapper module busy.
> > > 
> > > Applied both. And as I have told you previously please use the correct
> > > subsystem tag. I have fixed them again!
> > 
> > Sorry about that. What do you prefer for future reference? We are using
> > both "dma: cppi41" and "dmaengine: cppi41" currently..
> 
> "dmaengine: cppi41: xxx" would be better

OK will use that for future patches then.

Thanks,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-15  3:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-09 16:47 [PATCH 0/2] Two cpp41 pm runtime found when testing with usb Tony Lindgren
     [not found] ` <20161109164759.24913-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-09 16:47   ` [PATCH 1/2] dma: cppi41: Fix list not empty warning on module removal Tony Lindgren
2016-11-09 16:47   ` [PATCH 2/2] dma: cppi41: Fix unpaired pm runtime when only a USB hub is connected Tony Lindgren
2016-11-14  5:28   ` [PATCH 0/2] Two cpp41 pm runtime found when testing with usb Vinod Koul
2016-11-14 14:49     ` Tony Lindgren
     [not found]       ` <20161114144912.GR7138-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-11-15  3:29         ` Vinod Koul
2016-11-15  3:38           ` Tony Lindgren

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.