From patchwork Tue Feb 25 12:46:54 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: 183837 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1765900ile; Tue, 25 Feb 2020 05:40:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyQ0RecdM0MFIMTkUeBQadHYa4Z2rRO18iOsJUDfxuqpicb0RSlQVH1GB0VeWVWkvRdfDiV X-Received: by 2002:ac8:163c:: with SMTP id p57mr54394504qtj.106.1582638047199; Tue, 25 Feb 2020 05:40:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582638047; cv=none; d=google.com; s=arc-20160816; b=xAYPGSDEmF57L6V/55pTDCuP4W37b6nv2HZpBNirrxWDyJhpg9Nl9yJGpX5LJDnVAR +vr6gOwj6UEArlN0LmhlEmWQHK0l5ciCWKYhkG1BmoGOPm5RnzOF5EResu9HF0su5Kdn rSAs3i4noTiwnvGNC1xaqYn6828pf5UCu/u5sYw0qXaENTjIhKPamPOj5IQ1OVsbc8t8 Apced38zqeI+matL6umXU1NfWZ2W+/0l07Ss2tLq/mxXhJhmdJm0d4ZKeG5IS++CeESh vsJuiu+fhnLmZdoc/Z1Q6FeNYVo6ooZoOeyK5pjBQLkTWksYnnn7WcEC3LbCYMmBTKyC 9ipw== 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=ndtaMrRIwsDFvpEiq4H5pWdLQ72M5z3ggW6arSA/c7n5Hh3FgwX7tZ93Q+zVJy26h6 uJcphNhgAK+/cpL6cvo+T8w5HXP+ImRdAZbuUmG8owfabUWOmpxe90f5DfhzM4J2ZeT1 NSYeMdqpaFQYUMxPJcfuS2QwY9Yb6Vfy3kn8qUNX7MjQqlXLCowThnjJeEACg/Gb15IF R2HVEQLPpeW3VjXMDVMkmOuC9FwAOQANBRj5j/4ftjPz0qtMyd9twv7wAGnIL57QV4rO DgLvdTvSMF1D1/rW4lEWirTmn9x/VBgIJIPpjvLpD3zY0n4VlBVJl0gBOvxfWGudAqIV ogIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wuf1amqS; 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 11si4084889qkm.369.2020.02.25.05.40.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Feb 2020 05:40:47 -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=Wuf1amqS; 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]:56240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6aS6-0004So-MU for patch@linaro.org; Tue, 25 Feb 2020 08:40:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59115) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6ZcL-0005MO-Vl for qemu-devel@nongnu.org; Tue, 25 Feb 2020 07:47:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6ZcK-0007CW-Vv for qemu-devel@nongnu.org; Tue, 25 Feb 2020 07:47:17 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:44705) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6ZcK-0007Br-Pd for qemu-devel@nongnu.org; Tue, 25 Feb 2020 07:47:16 -0500 Received: by mail-wr1-x441.google.com with SMTP id m16so14544316wrx.11 for ; Tue, 25 Feb 2020 04:47: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=Wuf1amqSb6UKAG6mhYgdyoZiZV1IQ6vCZpGsVhYf2nby1Vtx3XfNAEsb17LWHvARL4 XirsQO8AnDLr/Glnmn+xAmjVWHtswngc/ImRZ6mEodPOosUhKlbmCttXCC52syugLrN/ JX/Kkl+qtqNNNiTGu32234FM53bsZRXXcpu/yHhV28fYNRU7ZtJzNLbmfbUoQZZOoHdQ gU+ZrWyG51v44iIUJRzQTPb6+cg2wBGp88Bw7+Yb0j2YgfT45lldJVb2dfZGM1bjA9V1 oLdnGQ6tFNv+wICC4UcfhhHK5O/oC5oq6p7ZnqEueM61908hwTOC3NqZGa1t7hFImWjw LArA== 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=PdafRgygvD98hkBahNFBWkvV6KZhnTGU9Dc6LHi0PI0q3m9jKwjQa2ECLDgwcAvrzA 9kkMJzePQEJOTcsJhJ0/2DqLXMlDH8Vle/+m6z0khyD/SjuRmfg6BNggMFhNVECoGCON lrA4ORxkrgfKAQbYkTpo2QlaFqaLz78q4gee192jimp4BWyr2ebiflYi6AEmsN6J9dPc 4fkHrugDS+SVMn7UCtz8ddlobhpudSmQOgLi7vadg5r260RXAeX1Mf0QKoQTWHJibW9h E3KNitQQkL5mz4bHauYR/LYseNMGkjjiSchRXurzolLSEYftS0qBb29DuI9eUNXntGbr 1m8w== X-Gm-Message-State: APjAAAVgmb0KyoPwHupYWOpjoOYhFrrDFGv4t7+BiadNKyAVxDb/rIUC nmTyEttMKrBKB2WHVbsB4R6lJA== X-Received: by 2002:adf:94a3:: with SMTP id 32mr1769240wrr.276.1582634835609; Tue, 25 Feb 2020 04:47:15 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d9sm24247090wrx.94.2020.02.25.04.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 04:47:13 -0800 (PST) Received: from zen.home.arpa (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8866F1FF90; Tue, 25 Feb 2020 12:47:10 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 03/19] tests/rcutorture: better document locking of stats Date: Tue, 25 Feb 2020 12:46:54 +0000 Message-Id: <20200225124710.14152-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200225124710.14152-1-alex.bennee@linaro.org> References: <20200225124710.14152-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::441 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];