[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1369139597-24446-1-git-send-email-andriy.shevchenko@linux.intel.com>
Date: Tue, 21 May 2013 15:33:17 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Vinod Koul <vinod.koul@...el.com>, "djbw @ fb . com" <djbw@...com>,
"linux-kernel @ vger . kernel . org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel @ lists . infradead . org"
<linux-arm-kernel@...ts.infradead.org>, viresh.kumar@...aro.org,
Will Deacon <will.deacon@....com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH] dmatest: abort transfers immediately when asked for
When thread is going to be stopped we have to unconditionally terminate all
ongoing transfers. Otherwise it would be possible that callback function will
be called on the next interrupt and will try to access to already freed
structures.
The patch introduces specific error message for this, though it doesn't
increase the counter of the failed tests.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Reported-by: Will Deacon <will.deacon@....com>
---
drivers/dma/dmatest.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index d8ce4ec..f61bd55 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -92,6 +92,7 @@ enum dmatest_error_type {
DMATEST_ET_MAP_DST,
DMATEST_ET_PREP,
DMATEST_ET_SUBMIT,
+ DMATEST_ET_ABORT,
DMATEST_ET_TIMEOUT,
DMATEST_ET_DMA_ERROR,
DMATEST_ET_DMA_IN_PROGRESS,
@@ -366,6 +367,7 @@ static char *thread_result_get(const char *name,
[DMATEST_ET_MAP_DST] = "dst mapping error",
[DMATEST_ET_PREP] = "prep error",
[DMATEST_ET_SUBMIT] = "submit error",
+ [DMATEST_ET_ABORT] = "transfer aborted",
[DMATEST_ET_TIMEOUT] = "test timed out",
[DMATEST_ET_DMA_ERROR] =
"got completion callback (DMA_ERROR)",
@@ -720,6 +722,15 @@ static int dmatest_func(void *data)
done.done || kthread_should_stop(),
msecs_to_jiffies(params->timeout));
+ /* terminate all transfers on specified channel if needed */
+ if (kthread_should_stop()) {
+ dmaengine_terminate_all(chan);
+ thread_result_add(info, result, DMATEST_ET_ABORT,
+ total_tests, src_off, dst_off,
+ len, 0);
+ break;
+ }
+
status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
if (!done.done) {
--
1.8.2.rc0.22.gb3600c3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists