* [PATCH] dmaengine: at_hdmac: fix race condition in atc_advance_work()
@ 2013-04-16 11:49 Nicolas Ferre
2013-04-16 13:15 ` Vinod Koul
2013-04-18 7:52 ` [PATCH for 3.9-final] " Nicolas Ferre
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Ferre @ 2013-04-16 11:49 UTC (permalink / raw)
To: linux-arm-kernel
From: Ludovic Desroches <ludovic.desroches@atmel.com>
The BUG_ON() directive is triggered probably due to a latency modification
following inclusion of 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>
---
Linus,
We have identified a race condition on the Atmel ARM-based AT91 DMA controller
driver that leads to hitting a BUG_ON() directive.
This error, only triggered after the inclusion of a patch that reduces the
softirq latency, is affecting several AT91 SoCs and can be seen
as a regression by people using the dmaengine driver (on NAND flash
accesses for instance).
I know that it is late in the development cycle but can you please consider
including it in your tree before 3.9-final?
This patch can also go through dmaengine tree (Vinod Koul) but I do not know if
there is enough time remaining.
Thanks a lot, best regards,
Nicolas Ferre
drivers/dma/at_hdmac.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 6e13f26..88cfc61 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -310,8 +310,6 @@ static void atc_complete_all(struct at_dma_chan *atchan)
dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n");
- BUG_ON(atc_chan_is_enabled(atchan));
-
/*
* Submit queued descriptors ASAP, i.e. before we go through
* the completed ones.
@@ -368,6 +366,9 @@ static void atc_advance_work(struct at_dma_chan *atchan)
{
dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n");
+ if (atc_chan_is_enabled(atchan))
+ return;
+
if (list_empty(&atchan->active_list) ||
list_is_singular(&atchan->active_list)) {
atc_complete_all(atchan);
@@ -1078,9 +1079,7 @@ static void atc_issue_pending(struct dma_chan *chan)
return;
spin_lock_irqsave(&atchan->lock, flags);
- if (!atc_chan_is_enabled(atchan)) {
- atc_advance_work(atchan);
- }
+ atc_advance_work(atchan);
spin_unlock_irqrestore(&atchan->lock, flags);
}
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] dmaengine: at_hdmac: fix race condition in atc_advance_work()
2013-04-16 11:49 [PATCH] dmaengine: at_hdmac: fix race condition in atc_advance_work() Nicolas Ferre
@ 2013-04-16 13:15 ` Vinod Koul
2013-04-18 7:52 ` [PATCH for 3.9-final] " Nicolas Ferre
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2013-04-16 13:15 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 16, 2013 at 01:49:34PM +0200, Nicolas Ferre wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>
> The BUG_ON() directive is triggered probably due to a latency modification
> following inclusion of 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>
> ---
> Linus,
>
> We have identified a race condition on the Atmel ARM-based AT91 DMA controller
> driver that leads to hitting a BUG_ON() directive.
> This error, only triggered after the inclusion of a patch that reduces the
> softirq latency, is affecting several AT91 SoCs and can be seen
> as a regression by people using the dmaengine driver (on NAND flash
> accesses for instance).
>
> I know that it is late in the development cycle but can you please consider
> including it in your tree before 3.9-final?
>
> This patch can also go through dmaengine tree (Vinod Koul) but I do not know if
> there is enough time remaining.
>
> Thanks a lot, best regards,
>
> Nicolas Ferre
>
>
> drivers/dma/at_hdmac.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 6e13f26..88cfc61 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -310,8 +310,6 @@ static void atc_complete_all(struct at_dma_chan *atchan)
>
> dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n");
>
> - BUG_ON(atc_chan_is_enabled(atchan));
> -
> /*
> * Submit queued descriptors ASAP, i.e. before we go through
> * the completed ones.
> @@ -368,6 +366,9 @@ static void atc_advance_work(struct at_dma_chan *atchan)
> {
> dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n");
>
> + if (atc_chan_is_enabled(atchan))
> + return;
> +
> if (list_empty(&atchan->active_list) ||
> list_is_singular(&atchan->active_list)) {
> atc_complete_all(atchan);
> @@ -1078,9 +1079,7 @@ static void atc_issue_pending(struct dma_chan *chan)
> return;
>
> spin_lock_irqsave(&atchan->lock, flags);
> - if (!atc_chan_is_enabled(atchan)) {
> - atc_advance_work(atchan);
> - }
> + atc_advance_work(atchan);
> spin_unlock_irqrestore(&atchan->lock, flags);
> }
>
> --
> 1.8.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH for 3.9-final] dmaengine: at_hdmac: fix race condition in atc_advance_work()
2013-04-16 11:49 [PATCH] dmaengine: at_hdmac: fix race condition in atc_advance_work() Nicolas Ferre
2013-04-16 13:15 ` Vinod Koul
@ 2013-04-18 7:52 ` Nicolas Ferre
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Ferre @ 2013-04-18 7:52 UTC (permalink / raw)
To: linux-arm-kernel
From: Ludovic Desroches <ludovic.desroches@atmel.com>
The BUG_ON() directive is triggered probably due to a latency modification
following inclusion of 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>
---
Linus,
I re-send the patch with Vinod's acknowledgement and a little "for 3.9-final"
tag to make sure that you see it before the 3.9 release.
We have identified a race condition on the Atmel ARM-based AT91 DMA controller
driver that leads to hitting a BUG_ON() directive.
This error, only triggered after the inclusion of a patch that reduces the
softirq latency, is affecting several AT91 SoCs and can be seen
as a regression by people using the dmaengine driver (on NAND flash
accesses for instance).
I know that it is late in the development cycle but can you please consider
including it in your tree before 3.9-final?
Thanks a lot, best regards,
Nicolas Ferre
drivers/dma/at_hdmac.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 6e13f26..88cfc61 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -310,8 +310,6 @@ static void atc_complete_all(struct at_dma_chan *atchan)
dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n");
- BUG_ON(atc_chan_is_enabled(atchan));
-
/*
* Submit queued descriptors ASAP, i.e. before we go through
* the completed ones.
@@ -368,6 +366,9 @@ static void atc_advance_work(struct at_dma_chan *atchan)
{
dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n");
+ if (atc_chan_is_enabled(atchan))
+ return;
+
if (list_empty(&atchan->active_list) ||
list_is_singular(&atchan->active_list)) {
atc_complete_all(atchan);
@@ -1078,9 +1079,7 @@ static void atc_issue_pending(struct dma_chan *chan)
return;
spin_lock_irqsave(&atchan->lock, flags);
- if (!atc_chan_is_enabled(atchan)) {
- atc_advance_work(atchan);
- }
+ atc_advance_work(atchan);
spin_unlock_irqrestore(&atchan->lock, flags);
}
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-18 7:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 11:49 [PATCH] dmaengine: at_hdmac: fix race condition in atc_advance_work() Nicolas Ferre
2013-04-16 13:15 ` Vinod Koul
2013-04-18 7:52 ` [PATCH for 3.9-final] " Nicolas Ferre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).