From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
To: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Cc: Alexandre Bailon
<abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
nsekhar-l0cyMroinI0@public.gmane.org,
khilman-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
ptitiano-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH v2 1/2] dmaengine: cppi41: Fix list not empty warning on runtime suspend
Date: Thu, 12 Jan 2017 09:45:16 -0800 [thread overview]
Message-ID: <20170112174515.GH2630@atomide.com> (raw)
In-Reply-To: <ac236cf1-d1e1-8f1f-fb62-b63cabf746d6-l0cyMroinI0@public.gmane.org>
* Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org> [170112 09:24]:
> On 01/12/2017 11:09 AM, Tony Lindgren wrote:
> > Below is what seems to fix issues for me, not seeing any more warnings
> > either.
> >
> > Care to give it a try with your USB headset?
>
> This looks more close to what is provided in Documentation\power\runtime_pm.txt
> (example at the end of the file),
> but as per this document custom locking is required to access .active var.
OK so sounds like we're on the right track then :) Here's a version
using atomic.h.
Regards,
Tony
8< -------------------
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -1,3 +1,4 @@
+#include <linux/atomic.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
@@ -153,6 +154,8 @@ struct cppi41_dd {
/* context for suspend/resume */
unsigned int dma_tdfdq;
+
+ atomic_t active;
};
#define FIST_COMPLETION_QUEUE 93
@@ -320,7 +323,8 @@ static irqreturn_t cppi41_irq(int irq, void *data)
int error;
error = pm_runtime_get(cdd->ddev.dev);
- if (error < 0)
+ if (((error != -EINPROGRESS) && error < 0) ||
+ !atomic_read(&cdd->active))
dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n",
__func__, error);
@@ -482,7 +486,7 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan)
return;
}
- if (likely(pm_runtime_active(cdd->ddev.dev)))
+ if (likely(atomic_read(&cdd->active)))
push_desc_queue(c);
else
pending_desc(c);
@@ -1003,6 +1007,7 @@ static int cppi41_dma_probe(struct platform_device *pdev)
cdd->ddev.dst_addr_widths = CPPI41_DMA_BUSWIDTHS;
cdd->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
cdd->ddev.dev = dev;
+ atomic_set(&cdd->active, 0);
INIT_LIST_HEAD(&cdd->ddev.channels);
cpp41_dma_info.dma_cap = cdd->ddev.cap_mask;
@@ -1151,6 +1156,7 @@ static int __maybe_unused cppi41_runtime_suspend(struct device *dev)
{
struct cppi41_dd *cdd = dev_get_drvdata(dev);
+ atomic_set(&cdd->active, 0);
WARN_ON(!list_empty(&cdd->pending));
return 0;
@@ -1159,13 +1165,20 @@ static int __maybe_unused cppi41_runtime_suspend(struct device *dev)
static int __maybe_unused cppi41_runtime_resume(struct device *dev)
{
struct cppi41_dd *cdd = dev_get_drvdata(dev);
- struct cppi41_channel *c, *_c;
+ struct cppi41_channel *c;
unsigned long flags;
+ atomic_set(&cdd->active, 1);
+
spin_lock_irqsave(&cdd->lock, flags);
- list_for_each_entry_safe(c, _c, &cdd->pending, node) {
- push_desc_queue(c);
+ while (!list_empty(&cdd->pending)) {
+ c = list_first_entry(&cdd->pending,
+ struct cppi41_channel,
+ node);
list_del(&c->node);
+ spin_unlock_irqrestore(&cdd->lock, flags);
+ push_desc_queue(c);
+ spin_lock_irqsave(&cdd->lock, flags);
}
spin_unlock_irqrestore(&cdd->lock, flags);
--
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
next prev parent reply other threads:[~2017-01-12 17:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-09 17:03 [PATCH v2 0/2] dmaengine: cppi41: PM runtime fixes Alexandre Bailon
[not found] ` <20170109170337.6957-1-abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-01-09 17:03 ` [PATCH v2 1/2] dmaengine: cppi41: Fix list not empty warning on runtime suspend Alexandre Bailon
[not found] ` <20170109170337.6957-2-abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-01-09 18:08 ` Sergei Shtylyov
2017-01-09 18:16 ` Grygorii Strashko
[not found] ` <bc8f9562-b33a-1270-ee8f-b2925664172a-l0cyMroinI0@public.gmane.org>
2017-01-10 9:46 ` Alexandre Bailon
2017-01-09 18:34 ` Tony Lindgren
[not found] ` <20170109183416.GJ2630-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-01-12 17:09 ` Tony Lindgren
[not found] ` <20170112170900.GG2630-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-01-12 17:23 ` Grygorii Strashko
[not found] ` <ac236cf1-d1e1-8f1f-fb62-b63cabf746d6-l0cyMroinI0@public.gmane.org>
2017-01-12 17:41 ` Alexandre Bailon
[not found] ` <e17b04c8-037c-fc6d-84b8-60f968de3b4f-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-01-12 17:47 ` Tony Lindgren
2017-01-12 17:45 ` Tony Lindgren [this message]
2017-01-09 17:03 ` [PATCH v2 2/2] dmaengine: cppi41: Ignore EINPROGRESS for PM runtime in interrupt handler Alexandre Bailon
[not found] ` <20170109170337.6957-3-abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-01-09 18:39 ` Tony Lindgren
[not found] ` <20170109183946.GK2630-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-01-09 19:11 ` Grygorii Strashko
[not found] ` <7f446fd6-23ac-392c-6a2e-6b63843e0299-l0cyMroinI0@public.gmane.org>
2017-01-10 11:34 ` Alexandre Bailon
[not found] ` <7be08973-1233-a19a-a263-3ca194c4854c-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-01-11 1:05 ` Andy Shevchenko
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=20170112174515.GH2630@atomide.com \
--to=tony-4v6ys6ai5vpbdgjk7y7tuq@public.gmane.org \
--cc=abailon-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
--cc=khilman-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nsekhar-l0cyMroinI0@public.gmane.org \
--cc=ptitiano-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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.