From patchwork Wed Feb 26 07:39:13 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: 183891 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2787477ile; Tue, 25 Feb 2020 23:41:19 -0800 (PST) X-Google-Smtp-Source: APXvYqzw1l4zxzt1sdYdkm+FiKKBkt4WjtKsvN9towhImNHk80GEAwoPLWMvTIjU5tEaEIMRnTJR X-Received: by 2002:a37:4a11:: with SMTP id x17mr3818794qka.379.1582702878969; Tue, 25 Feb 2020 23:41:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582702878; cv=none; d=google.com; s=arc-20160816; b=09rf4kUNosHX7lJgHBGCg0dk/bJBfhM7AcbaRDn4wsbye6txAIvbN7PIKClHIHV8uF W4451B8cUJUFoBSaWXSk1+tm8MXav4unR5TD6p8HzPFgmajWldSyBeC0GOkBMGfy6tyO 74l3LpKgMewUpLI30Oyxpiq+AlX9Iedu9AImuE5prPS3VEJnE9c7X1zFO8rErJGpjw5M WoqdagkqzWADRQiofMLd0F6DLFhpblnv94cc5rnZsiPXDgIiIXitZeyJ3ogyL/tj1FEG JMexiqntfELHpZjrthZd0oLgRsB8hXWMCi0aaBCgg3tGAL59OVYIPfShGOxcSi3SCkPt yANg== 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=S8rlQzQx2BTIEiZ1sv279qV7IyK6QViRdYXPZhA7VgE=; b=h1E7rADMTR9kMFi6UB7wdyiUjWvpWJGmlOlxoKBsjMQIUiWhy8XUDvZ5bpe8Zwiu7U dXHphkNyVKtgT72eOx7puG3r8cwMgbHX2ubl1VY0pAYn7ZFRqIvYqy48h6OmsyIlL5mu FBHO9ZoBDw9jHxoX6KQ1L3Vknl8vhz6qp8StpON9y5wTedZmx5275ggVt9Elf6xUFEpc 1Ln/Kqszr/crYOwiAv/gDLxfnxG3QpQVkd4FJ+rvoe2EOWfsdLmV4sFhNcIY7csl14MW udhrcx5plpBMMYEBcc88RMkS0zh0EOob9j48itFrVZTW0OUkG7QR0fl3nzgg93rr1PIW 5t3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fSD7nClc; 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 q10si545070qvo.107.2020.02.25.23.41.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Feb 2020 23:41:18 -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=fSD7nClc; 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]:39240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6rJm-0003tY-EP for patch@linaro.org; Wed, 26 Feb 2020 02:41:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45947) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6rI9-0000KH-T7 for qemu-devel@nongnu.org; Wed, 26 Feb 2020 02:39:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6rI8-0002Ov-Vq for qemu-devel@nongnu.org; Wed, 26 Feb 2020 02:39:37 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:37115) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6rI8-0002MI-Px for qemu-devel@nongnu.org; Wed, 26 Feb 2020 02:39:36 -0500 Received: by mail-wm1-x330.google.com with SMTP id a141so1056837wme.2 for ; Tue, 25 Feb 2020 23:39:36 -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=S8rlQzQx2BTIEiZ1sv279qV7IyK6QViRdYXPZhA7VgE=; b=fSD7nClc/i8ZjlwD0+V/q4PXpYDMaOLMmA2WeBceP9IYvx1lkocTnLtEWnvZM1LKrG WOZTss8OP1SiSiftsqR0GkAhZM0guX8eVLq6XXX2zeiZSXJNDbZ7ZJ2/AL4orJkvQNu9 B7EJV1b1q3My/IztsJXCc3RpBycyXCvUnt43phKym3uItWnIJTroA8GSX4wO9xoEiGj2 GCeTUw0O1Rzjgro0xWdwRLlrOaJohVsjA4wjBmOM84c8x+d60Cgjxog2Mxxb5gGknBIL Y7AaPJ+XUwtOvFCK47MiAJ5t3sziw+sEJTE8jH2JmCT8hag8IOY/RiJqORqy9edrVJJb 7ITQ== 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=S8rlQzQx2BTIEiZ1sv279qV7IyK6QViRdYXPZhA7VgE=; b=H4btwZ7buF2VI2fEORELc7iSYWdDn8W5nCxsjBo+fqp9s85VLFjcMhyEAyegQQr4H4 /IJpGID1quagCC3W2glqcytgzWP64k16lKNgHGXd37gtcU9qmkDKZTPfSCawAr/bQ5P5 LeZvZPS5hk7YBPfe638ZFzJS1xZtPJAh7zbE9W/hbnxMrU/HfuZjoRDojoeM39VIRo1c bRNF+nTV54Gakbel03Ph2PnIaRriCenPyIKHX9k+IKQAiaMoTxL6cNbOryIhRPi4b9sw 2SD6EHwzVBtQQ8xvVoB44E4KBx7r5TXzA8reKiAC5OM5J+qqLJE6nitagiOO/9zsoPyD l06w== X-Gm-Message-State: APjAAAVNZRh6J1JD+NomxcukodecPYVzkG4Ayh7E7kHFREAv0JdaBmkT WfRL/6CvL/qdApR4luaSLPjyZesCvkk= X-Received: by 2002:a1c:1f56:: with SMTP id f83mr3757321wmf.101.1582702775768; Tue, 25 Feb 2020 23:39:35 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 12sm1725979wmo.30.2020.02.25.23.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 23:39:31 -0800 (PST) Received: from zen.home.arpa (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 827971FF90; Wed, 26 Feb 2020 07:39:29 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 03/19] tests/rcutorture: better document locking of stats Date: Wed, 26 Feb 2020 07:39:13 +0000 Message-Id: <20200226073929.28237-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200226073929.28237-1-alex.bennee@linaro.org> References: <20200226073929.28237-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::330 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org 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é Message-Id: <20200225124710.14152-4-alex.bennee@linaro.org> -- 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];