Skip to content

Commit 0a2ff57

Browse files
Nicolas Ferredjbw
authored andcommitted
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 <[email protected]> Cc: Haavard Skinnemoen <[email protected]> Acked-by: Maciej Sosnowski <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent c019894 commit 0a2ff57

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/dma/dmatest.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ module_param(max_channels, uint, S_IRUGO);
3838
MODULE_PARM_DESC(max_channels,
3939
"Maximum number of channels to use (default: all)");
4040

41+
static unsigned int iterations;
42+
module_param(iterations, uint, S_IRUGO);
43+
MODULE_PARM_DESC(iterations,
44+
"Iterations before stopping test (default: infinite)");
45+
4146
static unsigned int xor_sources = 3;
4247
module_param(xor_sources, uint, S_IRUGO);
4348
MODULE_PARM_DESC(xor_sources,
@@ -270,7 +275,8 @@ static int dmatest_func(void *data)
270275

271276
flags = DMA_CTRL_ACK | DMA_COMPL_SKIP_DEST_UNMAP | DMA_PREP_INTERRUPT;
272277

273-
while (!kthread_should_stop()) {
278+
while (!kthread_should_stop()
279+
&& !(iterations && total_tests >= iterations)) {
274280
struct dma_device *dev = chan->device;
275281
struct dma_async_tx_descriptor *tx = NULL;
276282
dma_addr_t dma_srcs[src_cnt];
@@ -416,6 +422,13 @@ static int dmatest_func(void *data)
416422
err_srcs:
417423
pr_notice("%s: terminating after %u tests, %u failures (status %d)\n",
418424
thread_name, total_tests, failed_tests, ret);
425+
426+
if (iterations > 0)
427+
while (!kthread_should_stop()) {
428+
DECLARE_WAIT_QUEUE_HEAD(wait_dmatest_exit);
429+
interruptible_sleep_on(&wait_dmatest_exit);
430+
}
431+
419432
return ret;
420433
}
421434

0 commit comments

Comments
 (0)