From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] dmatest: abort transfers immediately when asked for
Date: Tue, 21 May 2013 15:33:17 +0300 [thread overview]
Message-ID: <1369139597-24446-1-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20130516153553.GI11706@mudshark.cambridge.arm.com>
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@linux.intel.com>
Reported-by: Will Deacon <will.deacon@arm.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
next prev parent reply other threads:[~2013-05-21 12:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 15:28 dmatest regression in 3.10-rc1 Will Deacon
2013-05-16 15:35 ` Will Deacon
2013-05-17 12:34 ` Vinod Koul
2013-05-17 14:18 ` Will Deacon
2013-05-20 7:52 ` Andy Shevchenko
2013-05-20 9:58 ` Will Deacon
2013-05-21 12:31 ` Andy Shevchenko
2013-05-21 12:33 ` Andy Shevchenko [this message]
2013-05-21 15:11 ` [PATCH] dmatest: abort transfers immediately when asked for Will Deacon
2013-05-21 17:24 ` Andy Shevchenko
2013-05-22 12:41 ` Will Deacon
2013-05-22 13:26 ` Andy Shevchenko
2013-05-23 10:09 ` Vinod Koul
2013-05-23 10:51 ` Andy Shevchenko
2013-05-23 10:22 ` Vinod Koul
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=1369139597-24446-1-git-send-email-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.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 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).