]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
ntb_perf: Improve thread handling to increase robustness
authorLogan Gunthorpe <logang@deltatee.com>
Mon, 20 Jun 2016 19:15:05 +0000 (13:15 -0600)
committerJon Mason <jdmason@kudzu.us>
Fri, 5 Aug 2016 14:21:06 +0000 (10:21 -0400)
commitda573eaa3a13f60efafcbe25e4f4465cf1a1b40b
tree4de19d41638f8499bbc19a80c7cbd9c36c5bac1f
parentfd2ecd885bab8e456298d0b702806ea736456c62
ntb_perf: Improve thread handling to increase robustness

This commit accomplishes a few things:

1) Properly prevent multiple sets of threads from running at once using
a mutex. Lots of race issues existed with the thread_cleanup.

2) The mutex allows us to ensure that threads are finished before
tearing down the device or module.

3) Don't use kthread_stop when the threads can exit by themselves, as
this is counter-indicated by the kthread_create documentation. Threads
now wait for kthread_stop to occur.

4) Writing to the run file now blocks until the threads are complete.
The test can then be safely interrupted by a SIGINT.

Also, while I was at it:

5) debugfs_run_write shouldn't return 0 in the early check cases as this
could cause debugfs_run_write to loop undesirably.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
drivers/ntb/test/ntb_perf.c