diff mbox

[05/10] dmatest: support xor-only, or pq-only channels in tests

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

Commit Message

Dan Williams Nov. 7, 2013, 2:18 a.m. UTC
Currently we only test raid channels that happen to also have 'copy'
capability.  Search for capable channels that do not have DMA_MEMCPY.

Note the return value from run_threaded_test never really made sense
because it could return errors after successfully starting tests.  We
already have the test results per channel so missing channels can be
detected at that time.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/dma/dmatest.c |   58 +++++++++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 26 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, 11:56 a.m. UTC | #1
On Wed, 2013-11-06 at 18:18 -0800, Dan Williams wrote:
> Currently we only test raid channels that happen to also have 'copy'
> capability.  Search for capable channels that do not have DMA_MEMCPY.
> 

Does it mean user can't manage the channel type to test?

I remember there was a patch (or an idea if you wish) to allow user to
choose what types of channels, and therefore test type, their would like
to perform.

> Note the return value from run_threaded_test never really made sense
> because it could return errors after successfully starting tests.  We
> already have the test results per channel so missing channels can be
> detected at that time.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/dma/dmatest.c |   58 +++++++++++++++++++++++++++----------------------
>  1 files changed, 32 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
> index c5048671daf7..ea829659149a 100644
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -734,31 +734,20 @@ static bool filter(struct dma_chan *chan, void *param)
>  		return true;
>  }
>  
> -static int run_threaded_test(struct dmatest_info *info)
> +static void request_channels(struct dmatest_info *info,
> +			     enum dma_transaction_type type)
>  {
>  	dma_cap_mask_t mask;
> -	struct dma_chan *chan;
> -	struct dmatest_params *params = &info->params;
> -	int err = 0;
> -
> -	/* Copy test parameters */
> -	params->buf_size = test_buf_size;
> -	strlcpy(params->channel, strim(test_channel), sizeof(params->channel));
> -	strlcpy(params->device, strim(test_device), sizeof(params->device));
> -	params->threads_per_chan = threads_per_chan;
> -	params->max_channels = max_channels;
> -	params->iterations = iterations;
> -	params->xor_sources = xor_sources;
> -	params->pq_sources = pq_sources;
> -	params->timeout = timeout;
>  
>  	dma_cap_zero(mask);
> -	dma_cap_set(DMA_MEMCPY, mask);
> +	dma_cap_set(type, mask);
>  	for (;;) {
> +		struct dmatest_params *params = &info->params;
> +		struct dma_chan *chan;
> +
>  		chan = dma_request_channel(mask, filter, params);
>  		if (chan) {
> -			err = dmatest_add_channel(info, chan);
> -			if (err) {
> +			if (dmatest_add_channel(info, chan)) {
>  				dma_release_channel(chan);
>  				break; /* add_channel failed, punt */
>  			}
> @@ -768,9 +757,27 @@ static int run_threaded_test(struct dmatest_info *info)
>  		    info->nr_channels >= params->max_channels)
>  			break; /* we have all we need */
>  	}
> -	return err;
>  }
>  
> +static void run_threaded_test(struct dmatest_info *info)
> +{
> +	struct dmatest_params *params = &info->params;
> +
> +	/* Copy test parameters */
> +	params->buf_size = test_buf_size;
> +	strlcpy(params->channel, strim(test_channel), sizeof(params->channel));
> +	strlcpy(params->device, strim(test_device), sizeof(params->device));
> +	params->threads_per_chan = threads_per_chan;
> +	params->max_channels = max_channels;
> +	params->iterations = iterations;
> +	params->xor_sources = xor_sources;
> +	params->pq_sources = pq_sources;
> +	params->timeout = timeout;
> +
> +	request_channels(info, DMA_MEMCPY);
> +	request_channels(info, DMA_XOR);
> +	request_channels(info, DMA_PQ);
> +}
>  
>  static void stop_threaded_test(struct dmatest_info *info)
>  {
> @@ -788,19 +795,19 @@ static void stop_threaded_test(struct dmatest_info *info)
>  	info->nr_channels = 0;
>  }
>  
> -static int restart_threaded_test(struct dmatest_info *info, bool run)
> +static void restart_threaded_test(struct dmatest_info *info, bool run)
>  {
>  	/* we might be called early to set run=, defer running until all
>  	 * parameters have been evaluated
>  	 */
>  	if (!info->did_init)
> -		return 0;
> +		return;
>  
>  	/* Stop any running test first */
>  	stop_threaded_test(info);
>  
>  	/* Run test with new parameters */
> -	return run_threaded_test(info);
> +	run_threaded_test(info);
>  }
>  
>  static bool is_threaded_test_run(struct dmatest_info *info)
> @@ -850,7 +857,7 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)
>  	if (is_threaded_test_run(info))
>  		ret = -EBUSY;
>  	else if (dmatest_run)
> -		ret = restart_threaded_test(info, dmatest_run);
> +		restart_threaded_test(info, dmatest_run);
>  
>  	mutex_unlock(&info->lock);
>  
> @@ -860,11 +867,10 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)
>  static int __init dmatest_init(void)
>  {
>  	struct dmatest_info *info = &test_info;
> -	int ret = 0;
>  
>  	if (dmatest_run) {
>  		mutex_lock(&info->lock);
> -		ret = run_threaded_test(info);
> +		run_threaded_test(info);
>  		mutex_unlock(&info->lock);
>  	}
>  
> @@ -873,7 +879,7 @@ static int __init dmatest_init(void)
>  	 */
>  	info->did_init = true;
>  
> -	return ret;
> +	return 0;
>  }
>  /* when compiled-in wait for drivers to load first */
>  late_initcall(dmatest_init);
>
Dan Williams Nov. 12, 2013, 10:49 p.m. UTC | #2
On Tue, Nov 12, 2013 at 3:56 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Wed, 2013-11-06 at 18:18 -0800, Dan Williams wrote:
>> Currently we only test raid channels that happen to also have 'copy'
>> capability.  Search for capable channels that do not have DMA_MEMCPY.
>>
>
> Does it mean user can't manage the channel type to test?

No this patch is just a fix.  For example, if a channel only support
DMA_XOR currently dmatest will ignore it.

>
> I remember there was a patch (or an idea if you wish) to allow user to
> choose what types of channels, and therefore test type, their would like
> to perform.

That was a feature proposed by Jon I believe, and it will simply plug
in to dmatest_add_channels and filter things out according to the
specified parameters.

--
Dan
--
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
Andy Shevchenko Nov. 13, 2013, 2:38 p.m. UTC | #3
On Tue, 2013-11-12 at 14:49 -0800, Dan Williams wrote:
> On Tue, Nov 12, 2013 at 3:56 AM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Wed, 2013-11-06 at 18:18 -0800, Dan Williams wrote:
> >> Currently we only test raid channels that happen to also have 'copy'
> >> capability.  Search for capable channels that do not have DMA_MEMCPY.
> >>
> >
> > Does it mean user can't manage the channel type to test?
> 
> No this patch is just a fix.  For example, if a channel only support
> DMA_XOR currently dmatest will ignore it.

It clarifies, thanks.

Have my

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

P.S. So, can we have channels that support all of such capabilities at
once?
Dan Williams Nov. 14, 2013, 12:45 a.m. UTC | #4
On Wed, Nov 13, 2013 at 6:38 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Tue, 2013-11-12 at 14:49 -0800, Dan Williams wrote:
>> On Tue, Nov 12, 2013 at 3:56 AM, Andy Shevchenko
>> <andriy.shevchenko@linux.intel.com> wrote:
>> > On Wed, 2013-11-06 at 18:18 -0800, Dan Williams wrote:
>> >> Currently we only test raid channels that happen to also have 'copy'
>> >> capability.  Search for capable channels that do not have DMA_MEMCPY.
>> >>
>> >
>> > Does it mean user can't manage the channel type to test?
>>
>> No this patch is just a fix.  For example, if a channel only support
>> DMA_XOR currently dmatest will ignore it.
>
> It clarifies, thanks.
>
> Have my
>
> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>

Thank you.

> P.S. So, can we have channels that support all of such capabilities at
> once?
>

Yes, the ioatdma engine is one such device.  It has copy, xor, pq
operations on its raid enabled channels.
--
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
diff mbox

Patch

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index c5048671daf7..ea829659149a 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -734,31 +734,20 @@  static bool filter(struct dma_chan *chan, void *param)
 		return true;
 }
 
-static int run_threaded_test(struct dmatest_info *info)
+static void request_channels(struct dmatest_info *info,
+			     enum dma_transaction_type type)
 {
 	dma_cap_mask_t mask;
-	struct dma_chan *chan;
-	struct dmatest_params *params = &info->params;
-	int err = 0;
-
-	/* Copy test parameters */
-	params->buf_size = test_buf_size;
-	strlcpy(params->channel, strim(test_channel), sizeof(params->channel));
-	strlcpy(params->device, strim(test_device), sizeof(params->device));
-	params->threads_per_chan = threads_per_chan;
-	params->max_channels = max_channels;
-	params->iterations = iterations;
-	params->xor_sources = xor_sources;
-	params->pq_sources = pq_sources;
-	params->timeout = timeout;
 
 	dma_cap_zero(mask);
-	dma_cap_set(DMA_MEMCPY, mask);
+	dma_cap_set(type, mask);
 	for (;;) {
+		struct dmatest_params *params = &info->params;
+		struct dma_chan *chan;
+
 		chan = dma_request_channel(mask, filter, params);
 		if (chan) {
-			err = dmatest_add_channel(info, chan);
-			if (err) {
+			if (dmatest_add_channel(info, chan)) {
 				dma_release_channel(chan);
 				break; /* add_channel failed, punt */
 			}
@@ -768,9 +757,27 @@  static int run_threaded_test(struct dmatest_info *info)
 		    info->nr_channels >= params->max_channels)
 			break; /* we have all we need */
 	}
-	return err;
 }
 
+static void run_threaded_test(struct dmatest_info *info)
+{
+	struct dmatest_params *params = &info->params;
+
+	/* Copy test parameters */
+	params->buf_size = test_buf_size;
+	strlcpy(params->channel, strim(test_channel), sizeof(params->channel));
+	strlcpy(params->device, strim(test_device), sizeof(params->device));
+	params->threads_per_chan = threads_per_chan;
+	params->max_channels = max_channels;
+	params->iterations = iterations;
+	params->xor_sources = xor_sources;
+	params->pq_sources = pq_sources;
+	params->timeout = timeout;
+
+	request_channels(info, DMA_MEMCPY);
+	request_channels(info, DMA_XOR);
+	request_channels(info, DMA_PQ);
+}
 
 static void stop_threaded_test(struct dmatest_info *info)
 {
@@ -788,19 +795,19 @@  static void stop_threaded_test(struct dmatest_info *info)
 	info->nr_channels = 0;
 }
 
-static int restart_threaded_test(struct dmatest_info *info, bool run)
+static void restart_threaded_test(struct dmatest_info *info, bool run)
 {
 	/* we might be called early to set run=, defer running until all
 	 * parameters have been evaluated
 	 */
 	if (!info->did_init)
-		return 0;
+		return;
 
 	/* Stop any running test first */
 	stop_threaded_test(info);
 
 	/* Run test with new parameters */
-	return run_threaded_test(info);
+	run_threaded_test(info);
 }
 
 static bool is_threaded_test_run(struct dmatest_info *info)
@@ -850,7 +857,7 @@  static int dmatest_run_set(const char *val, const struct kernel_param *kp)
 	if (is_threaded_test_run(info))
 		ret = -EBUSY;
 	else if (dmatest_run)
-		ret = restart_threaded_test(info, dmatest_run);
+		restart_threaded_test(info, dmatest_run);
 
 	mutex_unlock(&info->lock);
 
@@ -860,11 +867,10 @@  static int dmatest_run_set(const char *val, const struct kernel_param *kp)
 static int __init dmatest_init(void)
 {
 	struct dmatest_info *info = &test_info;
-	int ret = 0;
 
 	if (dmatest_run) {
 		mutex_lock(&info->lock);
-		ret = run_threaded_test(info);
+		run_threaded_test(info);
 		mutex_unlock(&info->lock);
 	}
 
@@ -873,7 +879,7 @@  static int __init dmatest_init(void)
 	 */
 	info->did_init = true;
 
-	return ret;
+	return 0;
 }
 /* when compiled-in wait for drivers to load first */
 late_initcall(dmatest_init);