diff mbox

[07/10] dmatest: add support for skipping verification and random data setup

Message ID 20131107021817.15120.53443.stgit@viggo.jf.intel.com (mailing list archive)
State Accepted
Commit e3b9c347316fe243bea6abd08681050c43ca22ee
Delegated to: Dan Williams
Headers show

Commit Message

Dan Williams Nov. 7, 2013, 2:18 a.m. UTC
Towards enabling dmatest to checkout performance add a 'noverify' mode.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/dma/dmatest.c |   44 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 33 insertions(+), 11 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andy Shevchenko Nov. 12, 2013, 12:06 p.m. UTC | #1
On Wed, 2013-11-06 at 18:18 -0800, Dan Williams wrote:
> Towards enabling dmatest to checkout performance add a 'noverify' mode.
> 


Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/dma/dmatest.c |   44 +++++++++++++++++++++++++++++++++-----------
>  1 files changed, 33 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
> index 01ac7112b5fd..d07b73275d0f 100644
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -66,6 +66,10 @@ module_param(timeout, uint, S_IRUGO | S_IWUSR);
>  MODULE_PARM_DESC(timeout, "Transfer Timeout in msec (default: 3000), "
>  		 "Pass -1 for infinite timeout");
>  
> +static bool noverify;
> +module_param(noverify, bool, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(noverify, "Disable random data setup and verification");
> +
>  /**
>   * struct dmatest_params - test parameters.
>   * @buf_size:		size of the memcpy test buffer
> @@ -88,6 +92,7 @@ struct dmatest_params {
>  	unsigned int	xor_sources;
>  	unsigned int	pq_sources;
>  	int		timeout;
> +	bool		noverify;
>  };
>  
>  /**
> @@ -435,18 +440,30 @@ static int dmatest_func(void *data)
>  			break;
>  		}
>  
> -		len = dmatest_random() % params->buf_size + 1;
> +		if (params->noverify) {
> +			len = params->buf_size;
> +			src_off = 0;
> +			dst_off = 0;
> +		} else {
> +			len = dmatest_random() % params->buf_size + 1;
> +			len = (len >> align) << align;
> +			if (!len)
> +				len = 1 << align;
> +			src_off = dmatest_random() % (params->buf_size - len + 1);
> +			dst_off = dmatest_random() % (params->buf_size - len + 1);
> +
> +			src_off = (src_off >> align) << align;
> +			dst_off = (dst_off >> align) << align;
> +
> +			dmatest_init_srcs(thread->srcs, src_off, len,
> +					  params->buf_size);
> +			dmatest_init_dsts(thread->dsts, dst_off, len,
> +					  params->buf_size);
> +		}
> +
>  		len = (len >> align) << align;
>  		if (!len)
>  			len = 1 << align;
> -		src_off = dmatest_random() % (params->buf_size - len + 1);
> -		dst_off = dmatest_random() % (params->buf_size - len + 1);
> -
> -		src_off = (src_off >> align) << align;
> -		dst_off = (dst_off >> align) << align;
> -
> -		dmatest_init_srcs(thread->srcs, src_off, len, params->buf_size);
> -		dmatest_init_dsts(thread->dsts, dst_off, len, params->buf_size);
>  
>  		for (i = 0; i < src_cnt; i++) {
>  			u8 *buf = thread->srcs[i] + src_off;
> @@ -555,10 +572,14 @@ static int dmatest_func(void *data)
>  		unmap_src(dev->dev, dma_srcs, len, src_cnt);
>  		unmap_dst(dev->dev, dma_dsts, params->buf_size, dst_cnt);
>  
> -		error_count = 0;
> +		if (params->noverify) {
> +			dbg_result("test passed", total_tests, src_off, dst_off,
> +				   len, 0);
> +			continue;
> +		}
>  
>  		pr_debug("%s: verifying source buffer...\n", current->comm);
> -		error_count += dmatest_verify(thread->srcs, 0, src_off,
> +		error_count = dmatest_verify(thread->srcs, 0, src_off,
>  				0, PATTERN_SRC, true);
>  		error_count += dmatest_verify(thread->srcs, src_off,
>  				src_off + len, src_off,
> @@ -773,6 +794,7 @@ static void run_threaded_test(struct dmatest_info *info)
>  	params->xor_sources = xor_sources;
>  	params->pq_sources = pq_sources;
>  	params->timeout = timeout;
> +	params->noverify = noverify;
>  
>  	request_channels(info, DMA_MEMCPY);
>  	request_channels(info, DMA_XOR);
>
diff mbox

Patch

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 01ac7112b5fd..d07b73275d0f 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -66,6 +66,10 @@  module_param(timeout, uint, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(timeout, "Transfer Timeout in msec (default: 3000), "
 		 "Pass -1 for infinite timeout");
 
+static bool noverify;
+module_param(noverify, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(noverify, "Disable random data setup and verification");
+
 /**
  * struct dmatest_params - test parameters.
  * @buf_size:		size of the memcpy test buffer
@@ -88,6 +92,7 @@  struct dmatest_params {
 	unsigned int	xor_sources;
 	unsigned int	pq_sources;
 	int		timeout;
+	bool		noverify;
 };
 
 /**
@@ -435,18 +440,30 @@  static int dmatest_func(void *data)
 			break;
 		}
 
-		len = dmatest_random() % params->buf_size + 1;
+		if (params->noverify) {
+			len = params->buf_size;
+			src_off = 0;
+			dst_off = 0;
+		} else {
+			len = dmatest_random() % params->buf_size + 1;
+			len = (len >> align) << align;
+			if (!len)
+				len = 1 << align;
+			src_off = dmatest_random() % (params->buf_size - len + 1);
+			dst_off = dmatest_random() % (params->buf_size - len + 1);
+
+			src_off = (src_off >> align) << align;
+			dst_off = (dst_off >> align) << align;
+
+			dmatest_init_srcs(thread->srcs, src_off, len,
+					  params->buf_size);
+			dmatest_init_dsts(thread->dsts, dst_off, len,
+					  params->buf_size);
+		}
+
 		len = (len >> align) << align;
 		if (!len)
 			len = 1 << align;
-		src_off = dmatest_random() % (params->buf_size - len + 1);
-		dst_off = dmatest_random() % (params->buf_size - len + 1);
-
-		src_off = (src_off >> align) << align;
-		dst_off = (dst_off >> align) << align;
-
-		dmatest_init_srcs(thread->srcs, src_off, len, params->buf_size);
-		dmatest_init_dsts(thread->dsts, dst_off, len, params->buf_size);
 
 		for (i = 0; i < src_cnt; i++) {
 			u8 *buf = thread->srcs[i] + src_off;
@@ -555,10 +572,14 @@  static int dmatest_func(void *data)
 		unmap_src(dev->dev, dma_srcs, len, src_cnt);
 		unmap_dst(dev->dev, dma_dsts, params->buf_size, dst_cnt);
 
-		error_count = 0;
+		if (params->noverify) {
+			dbg_result("test passed", total_tests, src_off, dst_off,
+				   len, 0);
+			continue;
+		}
 
 		pr_debug("%s: verifying source buffer...\n", current->comm);
-		error_count += dmatest_verify(thread->srcs, 0, src_off,
+		error_count = dmatest_verify(thread->srcs, 0, src_off,
 				0, PATTERN_SRC, true);
 		error_count += dmatest_verify(thread->srcs, src_off,
 				src_off + len, src_off,
@@ -773,6 +794,7 @@  static void run_threaded_test(struct dmatest_info *info)
 	params->xor_sources = xor_sources;
 	params->pq_sources = pq_sources;
 	params->timeout = timeout;
+	params->noverify = noverify;
 
 	request_channels(info, DMA_MEMCPY);
 	request_channels(info, DMA_XOR);