From patchwork Wed Jun 2 10:30:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12293699 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 8B109C47083 for ; Wed, 2 Jun 2021 10:33:58 +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 53BCD61001 for ; Wed, 2 Jun 2021 10:33:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53BCD61001 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=1DyPtByzlBhIy7KAlWkM6lLMufn1z4TqF+pb++aHPsI=; b=RM0OaEaFsWZ8Pg nAuRCOujawPQsnTeYwU5XQQN9nDCLbgpYeIeLlmPuRj4pTVn9BzPKRXu6tESi3xXmFXGYcskFacWi JjNdVmRZ4HyZwS2jI6cbR726Ff7UUX6CDmCJhCFPhGz6xbVKy4ys8fiDgyLNXM1kbzToPZ9x1Uhb1 dv9preC/OlUa7NxJuxy7lgptVM9Wi9quV55MUiX4f++sHh1itB88H3NuvTOqZKVncQ/xDQk9Ic6QG blnjqC3BZJiTIjQWoqPyPHbFRFMmR2qdTFZCLOfQ76gPWVK3oX3+11o5csbR9FV6ZK5/8IcZHAtO5 xqIfjt/qfuKN+D4Ft27A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loOAF-003LeI-Up; Wed, 02 Jun 2021 10:31:56 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loO8u-003L2V-Pc for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 10:30:38 +0000 Received: by mail-pg1-x533.google.com with SMTP id i5so1911253pgm.0 for ; Wed, 02 Jun 2021 03:30:32 -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=WZdXkeLXyTRCRBlV6ZkvwSxOi71Ng+ItJPqjFI54Mcg=; b=Z3sB+5zdNXr9kef5JA3bJvYP76xDiTOty/eJXFB532T92HsbDk7gItssLcLF5a+Okv DRLOrn43EY1kdU1/LchPW2gzDwUvBULq3wHLgA2d+huNDCSOW5BOnFEfY/+os56y11aX rXEdqD5bI1hPOr7cu5P7uCRP67zfCHm0xxmaIXH3md4KFb9EDuvM6upqbbtw2DWjc/+V ZpdMWlGpHm9FJDb0D7TutJxr8CzO8iwi4Hzq1A+u2+SJMti1ch5We3G2fjdnzNjV1A4+ aa4jPTK5jbAq2gdWcArgQFFCyQFQJvzpSy60LSq47C48o1c5NQSFtQ9qrYHbHxgWwkk7 t0aw== 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=WZdXkeLXyTRCRBlV6ZkvwSxOi71Ng+ItJPqjFI54Mcg=; b=DcF4iZaU4QTjAsrqEY2H/MwCfdHf2yr1Rqh12mZEJZR+zfd6exKTFgk3yXFl+ymUEZ mkd0B3kIFfZ79MuKmYTqCFERItyowlrHkANvq3Q5osVA5eKvqb1Eq1Na5yWd3KfvhNUo KUocqS4/Izl3wQPgXCH5E4ZOT5U8Y6epxjyX8lVPc112TLpHlG9JITV6GLGHoJHrADFV +mU9rAjKHx3GbMYdZdzVuJMxXdbTe9JqOoPtQBT1U4eV3fov3+upqAkxTjVjGKiIixFo dQ85moVH1ewXPm4oMClCUqwj3siVak77OuFSYIoCRfiUQT8C8sqD6fxIAEXVZ9YvIuaX khGw== X-Gm-Message-State: AOAM533P/dgrKyJ+wGP+tVTxTMRI3qhS0RVIbEU5N8zuU5Ecsh0rAELc NGVnGappCTSB/GO/+y+DewUKrg== X-Google-Smtp-Source: ABdhPJyzXB1PcQNWg3aQfHpUUQxqS7K4lMUmeNIvTRxqevGy++Vn5qNRvTHr+W+TDzT0S9K2D8xe3Q== X-Received: by 2002:a63:471f:: with SMTP id u31mr33399072pga.85.1622629831701; Wed, 02 Jun 2021 03:30:31 -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 o24sm16697046pgl.55.2021.06.02.03.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 03:30:31 -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 5/8] perf auxtrace: Change to use SMP memory barriers Date: Wed, 2 Jun 2021 18:30:04 +0800 Message-Id: <20210602103007.184993-6-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_033032_881361_74729B2D X-CRM114-Status: GOOD ( 15.82 ) 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 The kernel and the userspace tool can access the AUX ring buffer head and tail from different CPUs, thus SMP class of barriers are required on SMP system. This patch changes to use SMP barriers to replace mb() and rmb() barriers. Signed-off-by: Leo Yan Acked-by: Adrian Hunter Acked-by: Peter Zijlstra (Intel) --- tools/perf/util/auxtrace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index a4fbb33b7245..42b7ef811bde 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -444,7 +444,7 @@ static inline u64 auxtrace_mmap__read_snapshot_head(struct auxtrace_mmap *mm) u64 head = READ_ONCE(pc->aux_head); /* Ensure all reads are done after we read the head */ - rmb(); + smp_rmb(); return head; } @@ -458,7 +458,7 @@ static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm) #endif /* Ensure all reads are done after we read the head */ - rmb(); + smp_rmb(); return head; } @@ -470,7 +470,7 @@ static inline void auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail) #endif /* Ensure all reads are done before we write the tail out */ - mb(); + smp_mb(); #if BITS_PER_LONG == 64 || !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT) pc->aux_tail = tail; #else