Skip to content

Commit d202f05

Browse files
ldesrochestorvalds
authored andcommitted
dmaengine: at_hdmac: fix race condition in atc_advance_work()
The BUG_ON() directive is triggered probably due to a latency modification following inclusion of commit c10d736 ("softirq: reduce latencies"). This condition has not been met before 3.9-rc1 and doesn't trigger without this patch. We now make sure that DMA channel is idle before calling atc_complete_all() which makes the BUG_ON() "protection" useless. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ebe8054 commit d202f05

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎drivers/dma/at_hdmac.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,6 @@ static void atc_complete_all(struct at_dma_chan *atchan)
310310

311311
dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n");
312312

313-
BUG_ON(atc_chan_is_enabled(atchan));
314-
315313
/*
316314
* Submit queued descriptors ASAP, i.e. before we go through
317315
* the completed ones.
@@ -368,6 +366,9 @@ static void atc_advance_work(struct at_dma_chan *atchan)
368366
{
369367
dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n");
370368

369+
if (atc_chan_is_enabled(atchan))
370+
return;
371+
371372
if (list_empty(&atchan->active_list) ||
372373
list_is_singular(&atchan->active_list)) {
373374
atc_complete_all(atchan);
@@ -1078,9 +1079,7 @@ static void atc_issue_pending(struct dma_chan *chan)
10781079
return;
10791080

10801081
spin_lock_irqsave(&atchan->lock, flags);
1081-
if (!atc_chan_is_enabled(atchan)) {
1082-
atc_advance_work(atchan);
1083-
}
1082+
atc_advance_work(atchan);
10841083
spin_unlock_irqrestore(&atchan->lock, flags);
10851084
}
10861085

0 commit comments

Comments
 (0)