From patchwork Thu Feb 13 22:50:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 183437 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1079965ile; Thu, 13 Feb 2020 14:53:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyMuT9sf+el8ibPbDdKpwgNVJhq2hG/YsdL355EF1x5zQNsXuRsaUlr1TQ9EEUmTpc/nHnD X-Received: by 2002:a37:f50f:: with SMTP id l15mr14262942qkk.257.1581634419995; Thu, 13 Feb 2020 14:53:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581634419; cv=none; d=google.com; s=arc-20160816; b=wU1kBeeHK/DTsh+DCB8xQluF7Ma7qAeoV4qUV7242udp0ExKBhNke6I1YcMXMy8dXJ 3IFM8rOnTkBob/VEH4nZGu1FJDj3gH4GZGP67EqwgEQnb9KEceZiIMWfEQX5NYiop2P0 oO3SKYBVM8mygjHu5E8JwebDjjogym60zAwMs2MWpZ4TBSnl2xbOh0VOj5OP17p7ZF8c gmZg+et6Qd8i23OMD05AnphbDneljcoas7gSu/q8M7QGcEP7Y3hXrWCwgLfSo/LRup6L KqsNY6N5mgZzf7bSWjgX3iVc0e2JcZBYuISWIdS4HWCYtAQPn2kPrBQiRZtC1pdkEtQF if8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=V4YbJuHMHTKZppvspX7lYfndG26GXtbu1NuW0h2HVeE=; b=VU5Y6dP+nl4MoUVKyxtZblNhUTn+Yf3rTjWQy7rm9ezIyXJqO/uizj5LHnWPQuvDcx hHZFiwKdV1Lv47pOO6aT8a9p7xwCHKW2t9CV8jTXWox/H0jPiQ0ZKd6S4YHuws60rxgV qzCHUTlvGVopLsvWlPESSZIiaAUAUA33x11kUHR2n+IiMPqbwqTzbvlS8o3Y0KAeEFEC 6g+dCpqgPBJQI06wtuqikYEAL6rBBUvkeJupvlrSGc5Dly9kTzS49SnH0EnyXIMhkJ7o rT16cfAeAASzRIwzON1h7owAM2I+VDAAa9OJAK0MU2A7jDEjtNoRBYhmOzEFjUTl9cuj uq5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="KLe/bGVB"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n30si1971481qtl.258.2020.02.13.14.53.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Feb 2020 14:53:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="KLe/bGVB"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2NMZ-0000Lc-GX for patch@linaro.org; Thu, 13 Feb 2020 17:53:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39532) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2NKH-0004dH-Or for qemu-devel@nongnu.org; Thu, 13 Feb 2020 17:51:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2NKG-0003gU-N3 for qemu-devel@nongnu.org; Thu, 13 Feb 2020 17:51:17 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:53456) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2NKG-0003eD-HM for qemu-devel@nongnu.org; Thu, 13 Feb 2020 17:51:16 -0500 Received: by mail-wm1-x342.google.com with SMTP id s10so8061213wmh.3 for ; Thu, 13 Feb 2020 14:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V4YbJuHMHTKZppvspX7lYfndG26GXtbu1NuW0h2HVeE=; b=KLe/bGVBvPm8isgWPAVPHM5oSTWD5CeeAi+60HnDmHOsABIrSO582YnKMq/c4eWdI+ 5HAN3ZFukntEWg92EoiWUOHZZBoG9nAyAS2LQjzbhbnmsJppYf7IwMsKm+LcuKabBQXH dZL/NmjPCDG8N0eb58+nwLyC3poEjVNWm0OrX4gvWKDTYgpkW0FZ9Xl/4Iu0pdowwRHW rIO0kDlghWSDPYrMKqr/UDo0IB486bGDRDe1aaoXeTLm7x7NDfFq2MIAL6rseYmwHuJj DgiyXy/IuTNgzOx99Y+wdZCprdUptPXt5o8MKi7+iRn3YuEkIdw1UV6MD+Qa/mJjGGMg tp1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V4YbJuHMHTKZppvspX7lYfndG26GXtbu1NuW0h2HVeE=; b=XwokRkDb87ykg4C9BW+zQPhMXBj/PTqy6iPsmk1Oebbeys8z4FF3x3UVJRuHNQQsqI Rfzjs5NuZjgA6LOTVD+k6TflJ3nd5aayi0E1+B7WTdGqaJwKEnMv0c+CCnzDoBD0uAx0 sGzlbr3mTtxR2G8/XUM3515o13gP1hYWn+mQQ8EjG4QRlJZjLGKn0CBqw2xFH8Ti0Wza qu3OzadxKI/lQEYBCcFlwI6CXS1hFFrK6pVGextPcfq3P2AxKy1XDNXsU/BhrfX3fG+4 fbTzU1hnIhq4oy76FkEsGCfTkZrLGWPXAZepTdh9N9NhY0kEX3msziVOAMFa2iHZhttd s83w== X-Gm-Message-State: APjAAAXxnsRiXc3OzI6l3AkWhZ1us+cv6uDcuAMULEqBcXxoUFfGDilS 0Z9MNhbduulbLZDpuDG0ySOBjA== X-Received: by 2002:a1c:1d8d:: with SMTP id d135mr328313wmd.92.1581634275415; Thu, 13 Feb 2020 14:51:15 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id x14sm4753745wmj.42.2020.02.13.14.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 14:51:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DF7711FF90; Thu, 13 Feb 2020 22:51:09 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 03/19] tests/rcutorture: better document locking of stats Date: Thu, 13 Feb 2020 22:50:53 +0000 Message-Id: <20200213225109.13120-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200213225109.13120-1-alex.bennee@linaro.org> References: <20200213225109.13120-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, berrange@redhat.com, robert.foley@linaro.org, pbonzini@redhat.com, stefanb@linux.vnet.ibm.com, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , marcandre.lureau@redhat.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is pure code motion with no functional effect. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé --- tests/rcutorture.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/tests/rcutorture.c b/tests/rcutorture.c index e8b2169e7dd..256d24ed5ba 100644 --- a/tests/rcutorture.c +++ b/tests/rcutorture.c @@ -65,8 +65,6 @@ #include "qemu/rcu.h" #include "qemu/thread.h" -long long n_reads = 0LL; -long n_updates = 0L; int nthreadsrunning; #define GOFLAG_INIT 0 @@ -78,11 +76,20 @@ static volatile int goflag = GOFLAG_INIT; #define RCU_READ_RUN 1000 #define NR_THREADS 100 -static QemuMutex counts_mutex; static QemuThread threads[NR_THREADS]; static struct rcu_reader_data *data[NR_THREADS]; static int n_threads; +/* + * Statistical counts + * + * These are the sum of local counters at the end of a run. + * Updates are protected by a mutex. + */ +static QemuMutex counts_mutex; +long long n_reads = 0LL; +long n_updates = 0L; + static void create_thread(void *(*func)(void *)) { if (n_threads >= NR_THREADS) { @@ -230,8 +237,9 @@ struct rcu_stress { struct rcu_stress rcu_stress_array[RCU_STRESS_PIPE_LEN] = { { 0 } }; struct rcu_stress *rcu_stress_current; int rcu_stress_idx; - int n_mberror; + +/* Updates protected by counts_mutex */ long long rcu_stress_count[RCU_STRESS_PIPE_LEN + 1];