On Tue, Oct 11, 2016 at 14:40:52 -0500, Richard Henderson wrote: > From: "Emilio G. Cota" <c...@braap.org> > > With this microbenchmark we can measure the overhead of emulating atomic > instructions with a configurable degree of contention. > > The benchmark spawns $n threads, each performing $o atomic ops (additions) > in a loop. Each atomic operation is performed on a different cache line > (assuming lines are 64b long) that is randomly selected from a range [0, $r). > > [ Note: each $foo corresponds to a -foo flag ] > > Signed-off-by: Emilio G. Cota <c...@braap.org> > Signed-off-by: Richard Henderson <r...@twiddle.net> > Message-Id: <1467054136-10430-20-git-send-email-c...@braap.org>
Can you please fix up this patch with the below? It does the same as we're doing in qht-bench: http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg03034.html Thanks, Emilio commit e3f226e427358778c57a102a3c5e35373f1f98cf Author: Emilio G. Cota <c...@braap.org> Date: Fri Oct 14 17:15:25 2016 -0400 atomic_add-bench: relax test_start/stop atomic accesses Signed-off-by: Emilio G. Cota <c...@braap.org> diff --git a/tests/atomic_add-bench.c b/tests/atomic_add-bench.c index 69c59ad..caa1e8e 100644 --- a/tests/atomic_add-bench.c +++ b/tests/atomic_add-bench.c @@ -50,7 +50,7 @@ static void *thread_func(void *arg) struct thread_info *info = arg; atomic_inc(&n_ready_threads); - while (!atomic_mb_read(&test_start)) { + while (!atomic_read(&test_start)) { cpu_relax(); } @@ -72,11 +72,11 @@ static void run_test(void) while (atomic_read(&n_ready_threads) != n_threads) { cpu_relax(); } - atomic_mb_set(&test_start, true); + atomic_set(&test_start, true); do { remaining = sleep(duration); } while (remaining); - atomic_mb_set(&test_stop, true); + atomic_set(&test_stop, true); for (i = 0; i < n_threads; i++) { qemu_thread_join(&threads[i]);