From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id f+4cKI7HbWQ6mxIAWB0awg (envelope-from ) for ; Wed, 24 May 2023 04:15:10 -0400 Received: by simark.ca (Postfix, from userid 112) id 921871E11E; Wed, 24 May 2023 04:15:10 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=lists.lttng.org header.i=@lists.lttng.org header.a=rsa-sha256 header.s=default header.b=L9exoNTH; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 51CD41E0D6 for ; Wed, 24 May 2023 04:15:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1684916108; bh=B/NVeDQpy+ocj983K17EdhO2PZxULh1TaGMH+hFfC4U=; h=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=L9exoNTHA9rBc4wWMq862+nm/Cm2YIkRXQ/wa5TEI6LS8THWCCnBRkV4fum6bAg1+ uuNOEB+uo11hJlHi3IypoPVqmDE8jDaOybL8+QV4Du29vciMrcZKYvMFPlzxMV15OY 6IRvYKKI42ceAxNwWqL5pT5xzOHyTaGOwTQV4JxZmzmgYZdPgYqX1uL5qevJpdo9nz DVU/Syhh9GcXDwiNQ34GfvJ3HbRXnphZllYpIJ1xsQKCgwENSmIUBfa7Wjb9GVOtA7 XH2CxeEjVgvlfQx9xrb5kFLfIWANW5TGhOD9BsBme77EBifYjBKYGYpm6dOqCjcJir hQHausg5zGcqw== Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4QR3rr53WPz1HXY; Wed, 24 May 2023 04:15:08 -0400 (EDT) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lists.lttng.org (Postfix) with ESMTPS id 4QR3rp6N0lz1HPZ for ; Wed, 24 May 2023 04:15:06 -0400 (EDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f14865fcc0so1146e87.0 for ; Wed, 24 May 2023 01:15:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684916105; x=1687508105; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cDBuuvCVPotqfG3IRbIc5/pr9WBHLxSpdlqlGMXV/4w=; b=d0jA0QL0+2uTtvNdkAuvff7Qzn4lUbdsGhMY5dU1gATernKxgLs/kMMAxrVZ5zYIx8 9NOcCWuw/QO7gPFClEjyF+OZVP38mvkYBkoQ66DCTOYLsc//75Q3Ed+ZkKbIFKUwnN5C cnDLvG0K5tdOc/jcBrBDJsmnBSbTsK38NuEIt624xtVHRNON0SuRz7dNW19EZzuetkZP CoxXLAPerK/HUQyjKCw3m3R2G7yXtopehQrVN2C83r7aZmM0qC0zpgMKP48czaRTmCps kHFdRMuFhgJi1UwI0PvUXelCumvUCWzlCvx39ftLN+AcKOr4UprlNFjo5QOtmEQa1TH6 X6kg== X-Gm-Message-State: AC+VfDzKbIHks0Ggssc1c+ToTZ5tQGDIbQ6winZNHQUkdnf3O0htNw7N mPG8Gr8XPxPPF3ww42f5PmwrfomE7WZ759G8xEMlLg== X-Google-Smtp-Source: ACHHUZ4ctLjvJAR1EZMBsiLWghxJPGJDCA/MGDn/xXrdpTEhsZnn5yt5S1L2zClcgbiDEok6pXo7X7pvVQHbSfZLRVY= X-Received: by 2002:ac2:5f1c:0:b0:4f3:a7c6:590e with SMTP id 28-20020ac25f1c000000b004f3a7c6590emr51852lfq.7.1684916105003; Wed, 24 May 2023 01:15:05 -0700 (PDT) MIME-Version: 1.0 References: <20230515201718.9809-1-odion@efficios.com> <874jocl1lf.fsf@laura> <87ttwbj9uz.fsf@laura> <87v8gj11ak.fsf@laura> In-Reply-To: <87v8gj11ak.fsf@laura> Date: Wed, 24 May 2023 10:14:51 +0200 Message-ID: To: Olivier Dion , tsan-users Subject: Re: [lttng-dev] [PATCH 00/11] Add support for TSAN to liburcu X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Dmitry Vyukov via lttng-dev Reply-To: Dmitry Vyukov Cc: lttng-dev@lists.lttng.org, "Paul E. McKenney" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" On Tue, 23 May 2023 at 18:05, Olivier Dion wrote: > > Hi Dmitry, > > We do have a new issue and we think it might be a limitation from TSAN. > > Find attached a test program that we believe is correct. You can > compile it with `gcc -fsanitize=thread test.c -pthread'. > > > TSAN flags a race condition between the atomic store relaxed at line 36 > and the free at line 81. > > We can solve the issue by replacing the atomic store relaxed with a > atomic store release. However, the preceding atomic exchange with > sequential consistency already acts as an implicit release (in term of > memory barrier) for the following store, making the release semantic > redundant. > > We've found an alternative to fix this by ignoring the thread during the > relaxed store (line 39). However, what we would like is to annotate the > memory stored (line 45). > > My theory (I don't know the internal of TSAN much) is that TSAN thinks > for some reason that the atomic store relaxed happen at the same epoch > as the free, resulting in a false positive. If so, m I don't this this is true in the C/C++ memory model: "the preceding atomic exchange with sequential consistency already acts as an implicit release (in term of memory barrier) for the following store". std::atomic_thread_fence does affect all preceding/subsequent operations, but an atomic memory operation only affects ordering on that variable, it doesn't also serve as a standalone memory fence. _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev