From patchwork Fri Oct 1 15:36:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1535368 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=RHbDDz3N; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HLZ465JNzz9t0J for ; Sat, 2 Oct 2021 01:37:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7E3A3857819 for ; Fri, 1 Oct 2021 15:37:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7E3A3857819 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633102643; bh=IFI5Z4x+Flt5v2I8/XDA+N9FzM/LGJzqJo4+YePbSng=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RHbDDz3NQYkXIERvcqSoc9kJmo3CXRrk+ioOxIRwU4mPAOWkoqkfT7qd3PFU136Rp 7HQDTSRhpU/u3FeHUfYpESe3cM1idJ66XAeycbrjxfKJmJDqo2BZSus8SQGD62EWCF wmipxxOX55F9vYLAxs7LpI6pxkTT/fI7Cwokn2+4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 959543857828 for ; Fri, 1 Oct 2021 15:36:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 959543857828 Received: by mail-pf1-x433.google.com with SMTP id g14so8294413pfm.1 for ; Fri, 01 Oct 2021 08:36:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IFI5Z4x+Flt5v2I8/XDA+N9FzM/LGJzqJo4+YePbSng=; b=cK3JQkb6AXBLb0lC6zcaXCCMZzfJ7fwjrSWQH1nn7k0ZqIPgkRhKzPRaDZ5SpYft10 EcbShZDfrN6H7VSSHx3iwiLNcdeVa/1m0uI2aeipfoMdGipeGMA0PItfnhSDWWo78gi/ 6sEpbC3i/29pYtIFVAhbElkxf3V+tzVQCeKcSv7hogBoI17k/O4jQGGA9V9xJbcmLVub enqVCg7tjHeEdWwxfRQ665AbJ/SO8uK4wMP7SzzNfZ6m/xzr5fbTcpfhOlJzwAhSgUhk lWdwMpeCBUIVQXeTZq/N6twDJgQB8/r0XXu8PB4x0Je1jMnIeca/Mg/PelNA0dntpF20 Fiog== X-Gm-Message-State: AOAM533QC7z1QZShKW7BtERPiBt86rXTYka6QwIpYi0HZbkT2I0fROWy eKu4upTqAmqYMU8rjaGnWJ1GOYmjttU= X-Google-Smtp-Source: ABdhPJwOESEGHBcm+KkxxtKRFnQKQc1K5iIc1FVaxhfTE5YMv8ieRBJ221Rugp2QGxup/UB5yLor9Q== X-Received: by 2002:a63:f145:: with SMTP id o5mr10444649pgk.273.1633102577081; Fri, 01 Oct 2021 08:36:17 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.58.39.6]) by smtp.gmail.com with ESMTPSA id 127sm6841142pfw.10.2021.10.01.08.36.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 08:36:16 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 5487CC0592 for ; Fri, 1 Oct 2021 08:36:15 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 4/4] Update c-c++-common/tsan/atomic_stack.c Date: Fri, 1 Oct 2021 08:36:15 -0700 Message-Id: <20211001153615.81857-5-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211001153615.81857-1-hjl.tools@gmail.com> References: <20211001153615.81857-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3032.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Gcc-patches" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Print out from __tsan_atomic32_fetch_add was removed by commit da7a5c09c86c3f639c63ce8843d6f21c915ae1c6 Author: Dmitry Vyukov Date: Wed Jul 28 16:57:39 2021 +0200 tsan: don't print __tsan_atomic* functions in report stacks Currently __tsan_atomic* functions do FuncEntry/Exit using caller PC and then use current PC (pointing to __tsan_atomic* itself) during memory access handling. As the result the top function in reports involving atomics is __tsan_atomic* and the next frame points to user code. Remove FuncEntry/Exit in atomic functions and use caller PC during memory access handling. This removes __tsan_atomic* from the top of report stacks, so that they point right to user code. The motivation for this is performance. Some atomic operations are very hot (mostly loads), so removing FuncEntry/Exit is beneficial. This also reduces thread trace consumption (1 event instead of 3). __tsan_atomic* at the top of the stack is not necessary and does not add any new information. We already say "atomic write of size 4", "__tsan_atomic32_store" does not add anything new. It also makes reports consistent between atomic and non-atomic accesses. For normal accesses we say "previous write" and point to user code; for atomics we say "previous atomic write" and now also point to user code. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D106966 * c-c++-common/tsan/atomic_stack.c: Don't expect print out from __tsan_atomic32_fetch_add. --- gcc/testsuite/c-c++-common/tsan/atomic_stack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/testsuite/c-c++-common/tsan/atomic_stack.c b/gcc/testsuite/c-c++-common/tsan/atomic_stack.c index 746afa7b466..09ac7c72245 100644 --- a/gcc/testsuite/c-c++-common/tsan/atomic_stack.c +++ b/gcc/testsuite/c-c++-common/tsan/atomic_stack.c @@ -31,5 +31,4 @@ int main() { /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */ /* { dg-output " Atomic write of size 4.*" } */ -/* { dg-output " #0 __tsan_atomic32_fetch_add.*" } */ -/* { dg-output " #1 Thread1.*" } */ +/* { dg-output " #0 Thread1.*" } */