From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv9ta-00034c-3O for qemu-devel@nongnu.org; Fri, 14 Oct 2016 17:20:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bv9tV-0001wZ-Vg for qemu-devel@nongnu.org; Fri, 14 Oct 2016 17:20:01 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44583) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bv9tR-0001t1-EF for qemu-devel@nongnu.org; Fri, 14 Oct 2016 17:19:57 -0400 Date: Fri, 14 Oct 2016 17:19:36 -0400 From: "Emilio G. Cota" Message-ID: <20161014211936.GA23123@flamenco> References: <1476214861-31658-1-git-send-email-rth@twiddle.net> <1476214861-31658-27-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476214861-31658-27-git-send-email-rth@twiddle.net> Subject: Re: [Qemu-devel] [PATCH v6 26/35] tests: add atomic_add-bench List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, alex.bennee@linaro.org On Tue, Oct 11, 2016 at 14:40:52 -0500, Richard Henderson wrote: > From: "Emilio G. Cota" > > 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 > Signed-off-by: Richard Henderson > Message-Id: <1467054136-10430-20-git-send-email-cota@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 Date: Fri Oct 14 17:15:25 2016 -0400 atomic_add-bench: relax test_start/stop atomic accesses Signed-off-by: Emilio G. Cota 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]);