[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    dmaengine: dmatest: add a maximum number of test iterations
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2009-07-30 23:59:53
Message-ID: 200907302359.n6UNxrbN024432 () hera ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/0a2ff57d6fba92842272889b4bca447344cd9d36
Commit:     0a2ff57d6fba92842272889b4bca447344cd9d36
Parent:     c019894efc9c9ba5939948caa78c133b1ec8ae63
Author:     Nicolas Ferre <nicolas.ferre@atmel.com>
AuthorDate: Fri Jul 3 19:26:51 2009 +0200
Committer:  Dan Williams <dan.j.williams@intel.com>
CommitDate: Wed Jul 22 22:05:26 2009 -0700

    dmaengine: dmatest: add a maximum number of test iterations
    
    The dmatest usually waits for the killing of its kthreads to stop
    running tests.  This patch adds a parameter that sets a maximum
    number of test iterations.
    
    This feature is quite interesting for debugging when you set a lot of
    traces in your dmaengine controller driver.
    
    Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
    Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
    Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/dma/dmatest.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index cec1ec0..2d973d6 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -38,6 +38,11 @@ module_param(max_channels, uint, S_IRUGO);
 MODULE_PARM_DESC(max_channels,
 		"Maximum number of channels to use (default: all)");
 
+static unsigned int iterations;
+module_param(iterations, uint, S_IRUGO);
+MODULE_PARM_DESC(iterations,
+		"Iterations before stopping test (default: infinite)");
+
 static unsigned int xor_sources = 3;
 module_param(xor_sources, uint, S_IRUGO);
 MODULE_PARM_DESC(xor_sources,
@@ -270,7 +275,8 @@ static int dmatest_func(void *data)
 
 	flags = DMA_CTRL_ACK | DMA_COMPL_SKIP_DEST_UNMAP | DMA_PREP_INTERRUPT;
 
-	while (!kthread_should_stop()) {
+	while (!kthread_should_stop()
+	       && !(iterations && total_tests >= iterations)) {
 		struct dma_device *dev = chan->device;
 		struct dma_async_tx_descriptor *tx = NULL;
 		dma_addr_t dma_srcs[src_cnt];
@@ -416,6 +422,13 @@ err_srcbuf:
 err_srcs:
 	pr_notice("%s: terminating after %u tests, %u failures (status %d)\n",
 			thread_name, total_tests, failed_tests, ret);
+
+	if (iterations > 0)
+		while (!kthread_should_stop()) {
+			DECLARE_WAIT_QUEUE_HEAD(wait_dmatest_exit);
+			interruptible_sleep_on(&wait_dmatest_exit);
+		}
+
 	return ret;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic