From patchwork Fri Oct 14 21:19:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 9377493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EC7C6075E for ; Fri, 14 Oct 2016 21:20:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CC0E2A6D1 for ; Fri, 14 Oct 2016 21:20:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 118692A78D; Fri, 14 Oct 2016 21:20:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5DF12A78F for ; Fri, 14 Oct 2016 21:20:18 +0000 (UTC) Received: from localhost ([::1]:49454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv9tp-00034z-BH for patchwork-qemu-devel@patchwork.kernel.org; Fri, 14 Oct 2016 17:20:17 -0400 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 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D083220214; Fri, 14 Oct 2016 17:19:36 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 14 Oct 2016 17:19:36 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=braap.org; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=ZoXFW Oo+1YycRuXy8h9C7r1zMss=; b=AL6d3Pzqcz71iJQrpeCRmG0MBVOjPXycN74Vq /IysJfpqWWNrYg4K6D+ZhoAtKHdtgsefjl8SxhsoNd5P0r4SIs9XN1nXuJOMERAF Xj2czU4ZirJN2PccOjeIBxAhhNWzgrydG9jymORzeUB2g4mPac5Dp6Hg3a1pyH8B wZRq24= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=ZoXFWOo+1YycRuXy8h9C7r1zMss=; b=k3uiW V0GPDExrS2n+pkYssDSCck6V4jrb50UU0C0c+XK4edkUMsZBoSkgUYI0g6YwoXGe J9XZkdunIiU86KSGuK9y1ThRYDtwNNbhZqg3PJE6yiTdZFcYd0584jTIs3VnaOFQ tIp1pBakxOIvmVr3JKlQJ9EAVdmycipv1ftMGQ= X-Sasl-enc: zrvYDqdSu5ROjI9P8xQ3W/oeCjAP01GuOnyLNeKmSgbF 1476479976 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 9448BF29D3; Fri, 14 Oct 2016 17:19:36 -0400 (EDT) Date: Fri, 14 Oct 2016 17:19:36 -0400 From: "Emilio G. Cota" To: Richard Henderson 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-Disposition: inline In-Reply-To: <1476214861-31658-27-git-send-email-rth@twiddle.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: Re: [Qemu-devel] [PATCH v6 26/35] tests: add atomic_add-bench X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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]);