Alex Richardson 371f152c7f Significantly speed up libthr/mutex_test and make more reliable
Instead of using a simple global++ as the data race, with this change we
perform the increment by loading the global, delaying for a bit and then
storing back the incremented value. If I move the increment outside of the
mutex protected range, I can now see the data race with only 100 iterations
on amd64 in almost all cases. Before this change such a racy test almost
always passed with < 100,000 iterations and only reliably failed with the
current limit of 10 million.

I noticed this poorly written test because the mutex:mutex{2,3} and
timedmutex:mutex{2,3} tests were always timing out on our CheriBSD Jenkins.
Writing good concurrency tests is hard so I won't attempt to do so, but this
change should make the test more likely to fail if pthread_mutex_lock is not
implemented correctly while also significantly reducing the time it takes to
run these four tests. It will also reduce the time it takes for QEMU RISC-V
testsuite runs by almost 40 minutes (out of currently 7 hours).

Reviewed By:	brooks, ngie
Differential Revision: https://reviews.freebsd.org/D26473
2020-11-26 13:31:57 +00:00
..
2020-10-01 15:45:07 +00:00
2020-11-20 06:02:31 +00:00
2020-03-29 02:40:03 +00:00
2020-10-24 15:58:42 +00:00
2019-12-21 21:05:53 +00:00
2020-01-25 21:16:45 +00:00
2020-10-16 17:03:27 +00:00
2020-10-24 17:08:59 +00:00
2020-08-22 20:52:02 +00:00
2020-02-19 17:09:08 +00:00
2020-07-10 19:58:07 +00:00
2020-06-24 01:51:05 +00:00
2020-06-17 10:42:20 +00:00
2019-11-20 23:56:20 +00:00
2020-08-24 18:13:44 +00:00
2020-06-22 07:46:24 +00:00
2020-08-07 08:41:14 +00:00
2020-06-17 11:57:48 +00:00
2020-10-22 01:05:34 +00:00
2020-10-27 23:03:15 +00:00
2020-06-09 05:43:51 +00:00