From patchwork Fri Sep 30 21:30:58 2016 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: 77185 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp516318qgf; Fri, 30 Sep 2016 14:42:42 -0700 (PDT) X-Received: by 10.200.34.150 with SMTP id f22mr9608832qta.141.1475271761998; Fri, 30 Sep 2016 14:42:41 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l95si4542176qte.110.2016.09.30.14.42.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 30 Sep 2016 14:42:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bq5Zp-0007ln-HK for patch@linaro.org; Fri, 30 Sep 2016 17:42:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bq5Ow-0006Sk-Si for qemu-devel@nongnu.org; Fri, 30 Sep 2016 17:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bq5Ov-0006Yf-V5 for qemu-devel@nongnu.org; Fri, 30 Sep 2016 17:31:26 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:34820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bq5Ov-0006YN-Oh for qemu-devel@nongnu.org; Fri, 30 Sep 2016 17:31:25 -0400 Received: by mail-wm0-x22b.google.com with SMTP id f193so7520364wmg.0 for ; Fri, 30 Sep 2016 14:31:25 -0700 (PDT) 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=U90Yi1q9WTM7kcd4J3TxZahPdzUNOw5zNp0DApxqeQQ=; b=GCJdzzflEoGLviRpr29wEGkw43ZYi+xxB80yXqAib1njTi42vUHjk2N1zRzF24hE/z S9DDtr2mbHAxsNzrAVMBAR6Vikrn+MYlYxPJF5flPY9rBYWeA96YzD8mIsSR0UYxgSAz 3K4wkxP0SxD0drDRa1iy+pLaf2lN9exiZ7Ip8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U90Yi1q9WTM7kcd4J3TxZahPdzUNOw5zNp0DApxqeQQ=; b=dVcztIr3Q4VTY1/x387kVu1z61ukqaitobHbxZI0tdRI8S/+pErFd9HtDM3hJiGXci a1fcML+kxNY4v0+qvZXfpWYKIdN7T57U9JFOanNVL54qBXegGellA9mrMRGuMIyKOTTq /rtZUzNmOKaYHVcCJjp9qbMA9ec+d6N5WW2x4Wc6/NcX6uirsw2lD0Y3Q95jybyLJfJA gPQ5yUGCSMXmzH+xSrfcWzvNEpt4iD/6Dz7D+yItAQg4ctEIlHyJ3IZCm7Chx5/joEwA V6J6KXzaNqW7aiMeuRCuxxxG+IJXObbWnEWkDT3IML9cQ9qmxUm9tri0JWusCsgn7+CC qGlw== X-Gm-Message-State: AA6/9Rk/BrpopuoVht6jIVEl9x1yyZiGuY7aZXVU7hSL67WJJexiYXZaElm3QWuw+A3wnwGc X-Received: by 10.28.92.71 with SMTP id q68mr5383940wmb.85.1475271085045; Fri, 30 Sep 2016 14:31:25 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n28sm6065332wmi.2.2016.09.30.14.31.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Sep 2016 14:31:23 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id EE7853E042B; Fri, 30 Sep 2016 22:31:17 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org, pbonzini@redhat.com Date: Fri, 30 Sep 2016 22:30:58 +0100 Message-Id: <20160930213106.20186-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160930213106.20186-1-alex.bennee@linaro.org> References: <20160930213106.20186-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22b Subject: [Qemu-devel] [PATCH v3 07/15] qom/cpu: atomically clear the tb_jmp_cache 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: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, claudio.fontana@huawei.com, nikunj@linux.vnet.ibm.com, jan.kiszka@siemens.com, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, serge.fdrv@gmail.com, bobby.prani@gmail.com, rth@twiddle.net, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The ThreadSanitizer rightly complains that something initialised with a normal access is later updated and read atomically. Signed-off-by: Alex Bennée --- qom/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.9.3 diff --git a/qom/cpu.c b/qom/cpu.c index 484c493..ef905da 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -253,6 +253,7 @@ void cpu_reset(CPUState *cpu) static void cpu_common_reset(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + int i; if (qemu_loglevel_mask(CPU_LOG_RESET)) { qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index); @@ -268,7 +269,10 @@ static void cpu_common_reset(CPUState *cpu) cpu->can_do_io = 1; cpu->exception_index = -1; cpu->crash_occurred = false; - memset(cpu->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *)); + + for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) { + atomic_set(&cpu->tb_jmp_cache[i], NULL); + } } static bool cpu_common_has_work(CPUState *cs)