From patchwork Fri May 22 16:07:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 187183 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp2650592ilb; Fri, 22 May 2020 09:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWzevONuHU8f8+h5ruxeqt7FrVCw3fx+vG9omSRXoW6fYjvy42SEOAdTjJ+qeEX656/7SM X-Received: by 2002:aed:257c:: with SMTP id w57mr16456255qtc.208.1590164610229; Fri, 22 May 2020 09:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590164610; cv=none; d=google.com; s=arc-20160816; b=HgwwJYw8wm+1C+ft692MtC2QBLLXHtYbpcq60OhBHt/qyL8LI7RMRkCKAGRtjxM+wL D2LNtAjYsHozIVpjyZNZW8T8S3iF9IJOFot2DjIJ1ELh/g2jFRKEXQ4doJGhbbh+eeDj qIktBxy3Uhfb64fh7xrAMeL+rs8XFgb4ATd8UdSxDNEMsR6x4nbHYhrT0g15CY6v+ohS BT+9//RjCFQ592vdj9/fm+8CqdaxC+gxchwo/EBR92gfSS2YrafYLQLse5Q90nEb5hcc mD0OErTGNZ+AZLQwXq/8IIVvWGPbjyIoutFqKSQ8G1FJ2Ak2hiBWVRoq1surjI5Xm/us d4rw== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=sRbh5iLhIJgul14kcDJeTEj/XcHGk+PMKpVRoyVth+g=; b=bX5PSkd2hVbfPNHYT2gemi8P6TrIAVtD3Nb0phkEj+ox34eiFmAfvVdLuHNFtIGrjm jrBhOGpXGu8WZZnnmkVeQLP2NwIXdzKtQmHnMTnnArv6Pz6vJitiMvHaOhFGCeJuv/Kh hXBf3UgcgE4X51zXiR9Wf+dD439AmFo8Hh7mHuum+wMkIqZKlOO+4OqC/cfrWHASN3sm pVwEoGSE7kUuK2sJ3esWSpMNV/gWmSMe5yzUB0JMWOsHSuzl1inDMvXgE1iUY+/0lqKQ NqECM3ov85pyx/A4cdbrF7KOzgODp5/zWvDq/bGrp5kmyHotbofS+JNyTC2acwFFFagl XSew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PIBtX2Kg; 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 a123si1472624qkg.111.2020.05.22.09.23.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 May 2020 09:23:30 -0700 (PDT) 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=PIBtX2Kg; 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]:49388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcASH-0000ls-NS for patch@linaro.org; Fri, 22 May 2020 12:23:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcAKb-0003Jr-Bb for qemu-devel@nongnu.org; Fri, 22 May 2020 12:15:33 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:39705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcAKZ-0006GR-8s for qemu-devel@nongnu.org; Fri, 22 May 2020 12:15:32 -0400 Received: by mail-pg1-x543.google.com with SMTP id w20so179973pga.6 for ; Fri, 22 May 2020 09:15:30 -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; bh=sRbh5iLhIJgul14kcDJeTEj/XcHGk+PMKpVRoyVth+g=; b=PIBtX2KghCulSwqtE4E+2lMTUvnCtv2kFXVft1HT72ud2AiuiPjQeh+WoHEYj3wduP JUyXBazeEzx3DN9vJqFwIWgjNYXGoMKSd0q7AEbJ4zzklyLFgpoIApc538pW3WwSiwKG V1ED0lM1E6tpCe6h3h7gbgq2JQsibfTItSglZ9xxd0w9PKrQzNZNSlSwr4O5wPm307Bq G9Ca5NAx4+fWYon/N772t4WKnG2POFkg1krJ5gqcfW8zUBdN0wQ7Olq669k0GUGxugCa /W0dEkFBM9FJ979mgOVEvZ+x4k69qR6E4YitFAK5YQIUoJiR1OQrwYWHWl3gr2HGh1b0 /Wjw== 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; bh=sRbh5iLhIJgul14kcDJeTEj/XcHGk+PMKpVRoyVth+g=; b=HQe6mmFIXto2DqBirHzB/PDbBTYSuvMOEPExOaysh2JqvqAPqsIPYPtleqwWcdKmDw FxbZmmcEdDcesNRrx5t366DoCBzCCjaRB0l0RqTz40703auoxJnaCWidbhQEiK3aJAas llg59O7swA52XgT9gSBHQ/LbcfVueVrM/S9nLRJmAyBEqfwZXUF8bS05TV4z81OzsqrN vnNxYg2JyEzf2HXqhFbvcBHfhfp4Z7TCd5d2EG+5Jo/2KkFr8BsIUi9R7FdX3+dFZrBD vmNgUOGnAUFf5KxdEiOKrhSqh6RqgogBoDawxTuRGxY9HlZMYLTIqt7q0GBtSPS8a5pn jWeQ== X-Gm-Message-State: AOAM533SUf4xBtd2XlRkWUzL6lFakoNJ0UlsF1Ufxthik+1tb/4qEIs4 ryMWHQGb4fnhYgCS5RWc3z68RkvSZtmYBw== X-Received: by 2002:a05:6a00:46:: with SMTP id i6mr4755152pfk.146.1590164129705; Fri, 22 May 2020 09:15:29 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:f1d9:5fce:c451:d2e2]) by smtp.gmail.com with ESMTPSA id y75sm7255428pfb.212.2020.05.22.09.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 09:15:29 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH 15/19] qht: Fix tsan warnings. Date: Fri, 22 May 2020 12:07:51 -0400 Message-Id: <20200522160755.886-16-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200522160755.886-1-robert.foley@linaro.org> References: <20200522160755.886-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=robert.foley@linaro.org; helo=mail-pg1-x543.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For example: WARNING: ThreadSanitizer: data race (pid=23406) Atomic read of size 4 at 0x7b100003e3c8 by thread T7: #0 __tsan_atomic32_load (qemu-system-aarch64+0x39a36c) #1 qht_do_lookup util/qht.c:495:17 (qemu-system-aarch64+0xd82f7a) #2 qht_lookup_custom util/qht.c:539:11 (qemu-system-aarch64+0xd82f7a) Previous write of size 8 at 0x7b100003e3c8 by thread T6 (mutexes: write M166769147697783108, write M995435858420506688): #0 posix_memalign (qemu-system-aarch64+0x350dd1) #1 qemu_try_memalign util/oslib-posix.c:189:11 (qemu-system-aarch64+0xd59317) #2 qemu_memalign util/oslib-posix.c:205:27 (qemu-system-aarch64+0xd5943e) #3 qht_insert__locked util/qht.c:583:9 (qemu-system-aarch64+0xd837c5) Signed-off-by: Robert Foley --- util/qht.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/util/qht.c b/util/qht.c index 67e5d5b916..739a53ced0 100644 --- a/util/qht.c +++ b/util/qht.c @@ -69,6 +69,7 @@ #include "qemu/qht.h" #include "qemu/atomic.h" #include "qemu/rcu.h" +#include "qemu/tsan.h" //#define QHT_DEBUG @@ -580,10 +581,12 @@ static void *qht_insert__locked(const struct qht *ht, struct qht_map *map, b = b->next; } while (b); + TSAN_ANNOTATE_IGNORE_WRITES_BEGIN(); b = qemu_memalign(QHT_BUCKET_ALIGN, sizeof(*b)); memset(b, 0, sizeof(*b)); new = b; i = 0; + TSAN_ANNOTATE_IGNORE_WRITES_END(); atomic_inc(&map->n_added_buckets); if (unlikely(qht_map_needs_resize(map)) && needs_resize) { *needs_resize = true;