Received: from eggs.gnu.org ([2001:4830:134:3::10]:34345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYTg-00045F-Us for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:58:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsYTg-00088g-3A for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:58:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsYTf-00087x-Tu for qemu-devel@nongnu.org; Fri, 07 Oct 2016 12:58:32 -0400 From: Paolo Bonzini Date: Fri, 7 Oct 2016 18:57:39 +0200 Message-Id: <1475859483-32234-16-git-send-email-pbonzini@redhat.com> In-Reply-To: <1475859483-32234-1-git-send-email-pbonzini@redhat.com> References: <1475859483-32234-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 15/39] qom/cpu: atomically clear the tb_jmp_cache List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= From: Alex Benn=C3=A9e The ThreadSanitizer rightly complains that something initialised with a normal access is later updated and read atomically. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20160930213106.20186-8-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- qom/cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 =3D CPU_GET_CLASS(cpu); + int i; =20 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 =3D 1; cpu->exception_index =3D -1; cpu->crash_occurred =3D false; - memset(cpu->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *)); + + for (i =3D 0; i < TB_JMP_CACHE_SIZE; ++i) { + atomic_set(&cpu->tb_jmp_cache[i], NULL); + } } =20 static bool cpu_common_has_work(CPUState *cs) --=20 2.7.4