diff mbox

[11/11] dmaengine: cppi41: Fix teardown warnings

Message ID 20170109160656.3470-12-abailon@baylibre.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Alexandre Bailon Jan. 9, 2017, 4:06 p.m. UTC
During the teardown of a RX channel, because there is only one
completion queue available for RX channel, descriptor of another
channel may be popped which will cause 2 warnings:
- the first one because we popped a wrong descriptor
  (neither the channel's descriptor, neither the teardown descriptor).
- the second one happen during the teardown of another channel,
  because we can't find the channel descriptor
  (that is, the one that caused the first warning).
Use the teardown queue as completion queue during the teardown.

Note that fix doesn't fix all the teardown warnings:
I still get some when I run some corner case.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
 drivers/dma/cppi41.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sergei Shtylyov Jan. 9, 2017, 6:46 p.m. UTC | #1
On 01/09/2017 07:06 PM, Alexandre Bailon wrote:

> During the teardown of a RX channel, because there is only one
> completion queue available for RX channel, descriptor of another
> channel may be popped which will cause 2 warnings:
> - the first one because we popped a wrong descriptor
>   (neither the channel's descriptor, neither the teardown descriptor).

    Neither ... nor.

> - the second one happen during the teardown of another channel,
>   because we can't find the channel descriptor
>   (that is, the one that caused the first warning).
> Use the teardown queue as completion queue during the teardown.

    Hm, what's a teardown queue? I don't remember this documented...
memory fade is always possible tho... :-)

> Note that fix doesn't fix all the teardown warnings:
> I still get some when I run some corner case.
>
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexandre Bailon Jan. 10, 2017, 11:11 a.m. UTC | #2
On 01/09/2017 07:46 PM, Sergei Shtylyov wrote:
> On 01/09/2017 07:06 PM, Alexandre Bailon wrote:
> 
>> During the teardown of a RX channel, because there is only one
>> completion queue available for RX channel, descriptor of another
>> channel may be popped which will cause 2 warnings:
>> - the first one because we popped a wrong descriptor
>>   (neither the channel's descriptor, neither the teardown descriptor).
> 
>    Neither ... nor.
> 
>> - the second one happen during the teardown of another channel,
>>   because we can't find the channel descriptor
>>   (that is, the one that caused the first warning).
>> Use the teardown queue as completion queue during the teardown.
> 
>    Hm, what's a teardown queue? I don't remember this documented...
> memory fade is always possible tho... :-)
I guess your memory is right :-)
There is no teardown queue. Though, we have to "allocate" an unassigned
queue and populate it with free teardown descriptors.
And when we are doing the teardown, we can select the queue to use for
completion. In the driver, we have to configure both of them.

Best regards,
Alexandre
> 
>> Note that fix doesn't fix all the teardown warnings:
>> I still get some when I run some corner case.
>>
>> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> [...]
> 
> MBR, Sergei
> 

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 0060391..eeab29d 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -698,7 +698,7 @@  static int cppi41_tear_down_chan(struct cppi41_channel *c)
 		if (!c->is_tx) {
 			reg |= GCR_STARV_RETRY;
 			reg |= GCR_DESC_TYPE_HOST;
-			reg |= c->q_comp_num;
+			reg |= cdd->td_queue.complete;
 		}
 		reg |= GCR_TEARDOWN;
 		cppi_writel(reg, c->gcr_reg);
@@ -709,7 +709,7 @@  static int cppi41_tear_down_chan(struct cppi41_channel *c)
 	if (!c->td_seen || !c->td_desc_seen) {
 
 		desc_phys = cppi41_pop_desc(cdd, cdd->td_queue.complete);
-		if (!desc_phys)
+		if (!desc_phys && c->is_tx)
 			desc_phys = cppi41_pop_desc(cdd, c->q_comp_num);
 
 		if (desc_phys == c->desc_phys) {