From patchwork Wed Jun 2 10:30:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12293703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1C7DC47083 for ; Wed, 2 Jun 2021 10:34:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84D3F61001 for ; Wed, 2 Jun 2021 10:34:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84D3F61001 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vcADEd7eoO88VQ4b27adnpPdKdAivNQ3BTCxFflxblU=; b=Lepg+Neu4oySy9 qbaECPrXJrOInGHiqSOJhapSkBwj373cUNgPeSGFCB20viFh0kQlP04ZDdSDPBU1zKkJi9hAosbjO 3WMSgpG/dEhed3JKpJU7tQjsz99AfFx/wHOYQ/n8CSvaCqfena5JtjEDRfwyCqMw2brKTxEE45D6Y 1TuQj/KnZzqEbDV5IqY4arVhwVD3r58dblMR92w3dhWrKS2oSTzr8X0qk/Wuw2W5bKt8cVblShOqj lxMa5dgHN3w5I73mbz5Zm65VYMm8VVxf/ssAJvXgYnGzYmj6HFKEYv42fSj5UyWAqm9DGISjIw2TH pI2CulHN7XOjjZexDDKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loOBK-003M6n-E0; Wed, 02 Jun 2021 10:33:02 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loO90-003L50-LQ for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 10:30:40 +0000 Received: by mail-pf1-x429.google.com with SMTP id k15so1823979pfp.6 for ; Wed, 02 Jun 2021 03:30:38 -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=0SAzHmAT4S261rPuHMSSnq0NUaRVlh+m0eXDWd0+8YM=; b=f5uETbSu0slGWjnOwVuhzwPC2PeWII4nuiVKyGsySkKsiOlhCZVuLFaAmWRtGZ60sB YbIERc223XE3G01FEVHlcbj3rvS7//wS5itbOp97GGEsx0Kyr8ZGCk39CmYYLITMGLpV nCl7zxU+QNBhlW7OdD4Ys4A0pphOOYxKQf7Daxdc2Np8SYp5xnGCPYuv/ZeYfLVqrk5E xfkgOQyGpeaObgBXApw6mLViAj3nsLAy1d1FHBsJRJd9jA63q3/+MUjcJjQLPmtx5JaP Fz2fXM9j5S6jradPxmeQal2Ny+kaG8pUiHNyocTcrPYv9AjaZkNtix4iGYxkWLYyb8X2 pnaA== 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:mime-version:content-transfer-encoding; bh=0SAzHmAT4S261rPuHMSSnq0NUaRVlh+m0eXDWd0+8YM=; b=PBD6jNSzm4w5X8ALJRJ+pvEQSP6oma15roytqaCBqqpUa+0kYQEFUBKS9KaCixcBuG IHcb3fyHZN6lwOC87eJwCoNE1LzDK1V7dnXofUtGDTeTu6YqKP7z/WtQNpz0JTs2rnIl Hs5i7pIJ0G5vILwn6tIWsQob5q3pPLV9tEOxmOrhVUKioRp00sNP/XYqYD9cZT8UJjOw eExzSLfFghkbiXqbifBZLgXFGP95JEnpw1oM1pkiVBkIT4zENKkVkrJM0c2JY1yeQdlD 1XCo1KSbYKUKJ/IcMw5p1WoLLzgewy1/othyRBkNXBhmtH9cdUcjimr3Gw2fBLt3KSyb 8JaQ== X-Gm-Message-State: AOAM530CM9WCPPmU6+r3pfAZP8Dz7j9lBFlafcvqljllUUjnD48oBJ1A SoQ3fXKgpdDPndzx3S45JkvUbg== X-Google-Smtp-Source: ABdhPJzfEEAZBOb+E52o6ECvVa+XAO+vxjOcpz63OhpG4yHtgnos+M5nlRF7RsaNERHXQVqG6bWx8Q== X-Received: by 2002:a62:7587:0:b029:2e9:a997:1449 with SMTP id q129-20020a6275870000b02902e9a9971449mr20698327pfc.57.1622629837509; Wed, 02 Jun 2021 03:30:37 -0700 (PDT) Received: from localhost (ec2-18-167-84-74.ap-east-1.compute.amazonaws.com. [18.167.84.74]) by smtp.gmail.com with ESMTPSA id r10sm18379761pga.48.2021.06.02.03.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 03:30:37 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , x86@kernel.org, "H. Peter Anvin" , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Adrian Hunter , Andi Kleen , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v2 7/8] perf auxtrace: Use WRITE_ONCE() for updating aux_tail Date: Wed, 2 Jun 2021 18:30:06 +0800 Message-Id: <20210602103007.184993-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210602103007.184993-1-leo.yan@linaro.org> References: <20210602103007.184993-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_033038_711871_46DEB175 X-CRM114-Status: GOOD ( 14.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use WRITE_ONCE() for updating aux_tail, so can avoid unexpected memory behaviour. Signed-off-by: Leo Yan Acked-by: Adrian Hunter Acked-by: Peter Zijlstra (Intel) --- tools/perf/util/auxtrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index e625bc76cdde..abc4282f5272 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -458,7 +458,7 @@ static inline void auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail) /* Ensure all reads are done before we write the tail out */ smp_mb(); - pc->aux_tail = tail; + WRITE_ONCE(pc->aux_tail, tail); } int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,