From patchwork Wed Jun 2 10:29:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12293689 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=-12.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 A3C23C4708F for ; Wed, 2 Jun 2021 10:32:22 +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 6CF8961001 for ; Wed, 2 Jun 2021 10:32:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CF8961001 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: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:In-Reply-To:References: List-Owner; bh=0iMHNHju6eibJjs3Yd/yYu8/UZVc53/K9rJ9gnj28Os=; b=3HCwd1qIdWnC1Z i439NWnJgCGlzgL77p13dY0UFzLDv3dpPEzZZCID26IMLGtQaCK7DS0LBcK1tZSt+/eu2ovgQ3X83 ecgCVCdfaCSL6P3fHLQzw7o8KdP8/U61+kQNw0wI5+TI3nU8jFEvSwQ4baus3B2dAiheXXt/uz4/p GU1KoKgipNYVFVTwNZx3iOFdcL5M589OtwCPOsGz/9UGYC/TY9CH0auuitrfWS0dEqJ5ILob0HpsB wXrIxWL3g1q29/otgbU+oxZLuOTe+aTiu6a3cHJo5DChmWky2vtwUTFbxF9M5Eu4rmSa5Tr+MK477 t1BHT4H7yjPZv7iKC2gA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loO8n-003KyC-DO; Wed, 02 Jun 2021 10:30:25 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loO8e-003KuZ-LE for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 10:30:22 +0000 Received: by mail-pl1-x633.google.com with SMTP id e1so860381pld.13 for ; Wed, 02 Jun 2021 03:30:16 -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:mime-version :content-transfer-encoding; bh=orFPAiLjT/TAscUeulOFNpz0N4+/FzjmvGEiheJyemc=; b=CfSl7oh/E89fzWzOWN6rxS7VywjKuPgxegQFL/6aij7rHSk3GnslJv9+GgMZdvNiVO J8+S5CwfdSox/zeoLFWzo75pgfWY0Sfl9/OIMxMInHnf8laWqv+X3mGWQIgQPE8TMpMW CIGU2Vmh57hR0/NlbOG0P+rmvWZ1YrEaJK8nAlX5T35lgzvnkhcKnp4VPVciWTRLMxD3 H2hgzLpUBj0wooLg0aPzr1wlSO6R1Mx3MubPJlA2SNLbqDc9b6jTpwEF1aHZA67LME6p xOcgbAC9feDCfj1NdaDao4k5y9o35PEJtqqyk+OPcEpBRaQTHVDa2dAx3w7WXsw0DEGD lNGg== 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:mime-version :content-transfer-encoding; bh=orFPAiLjT/TAscUeulOFNpz0N4+/FzjmvGEiheJyemc=; b=eb2fQbwFOhlayT0eOoXirqgXA9KRp48dcXL/96B9/V0RHztkJcfd4/QzBH5tiXBa8o wS9RO7cB2Ap6bo1/ktxyqM8+586qyW5zFKWSwtlg6OjwcCXJLEFmZKfYbJHmlagNgR4l VXIrH+2SCcRUC5VT+TnQwlQNSJr8CqvhhWMwjy755Hvf9oZygII4u+nqdPI9n5ObSii/ OlLvtoLZV7f5Yll4dp6DJSfFHkX07DAUsyHeljxIVXN9um14RSnNxVLgJB2juApozVNf DXQClfmq54Wb4Nv9MUE8R6kbSKPPSPzfpIdq+Qd4H88nZzuqF28ILKdSuSCzHJbJADqB IMnw== X-Gm-Message-State: AOAM533Qmcvi/8Ioi/dhuAiUeJMzvQR55ObJPAnwLZ235LcaeakA7tjv iS5xkW4iJQtO57ARM8dnK8qLsQ== X-Google-Smtp-Source: ABdhPJz+UfKUHNBsKrx5b1awAHIiQVkHkRyYDEPH3BFTFogJWWjo/G6fYkl4CNcHTzlQU2fiU7lkhg== X-Received: by 2002:a17:902:b10a:b029:f9:a0d:14a5 with SMTP id q10-20020a170902b10ab02900f90a0d14a5mr30455865plr.44.1622629815343; Wed, 02 Jun 2021 03:30:15 -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 gg22sm4521060pjb.17.2021.06.02.03.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 03:30:14 -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 0/8] perf: Refine barriers for AUX ring buffer Date: Wed, 2 Jun 2021 18:29:59 +0800 Message-Id: <20210602103007.184993-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_033016_720536_01295AFC X-CRM114-Status: GOOD ( 15.48 ) 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 Based on the discussion [1], this patch series is to refine the memory barriers for AUX ring buffer. Patches 01 ~ 04 to address the barriers usage in the kernel. The first patch is to make clear comment for how to use the barriers between the data store and aux_head store, this asks the driver to make sure the data is visible. Patches 02 ~ 04 is to refine the drivers for barriers after the data store. Patches 05 ~ 07 is to fix and clean up the memory barries in perf tool for AUX ring buffer. Since the 64-bit value's atomicity is not promised on 32-bit perf, the last patch is to report error and let perf to directly exit for this case. Have testes the patches on Arm64 Juno platform. [1] https://lore.kernel.org/patchwork/patch/1431867/ Leo Yan (8): perf/ring_buffer: Add comment for barriers on AUX ring buffer coresight: tmc-etr: Add barrier after updating AUX ring buffer coresight: tmc-etf: Add comment for store ordering perf/x86: Add barrier after updating bts perf auxtrace: Change to use SMP memory barriers perf auxtrace: Drop legacy __sync functions perf auxtrace: Use WRITE_ONCE() for updating aux_tail perf record: Directly bail out for compat case arch/x86/events/intel/bts.c | 3 +++ .../hwtracing/coresight/coresight-tmc-etf.c | 6 +++++ .../hwtracing/coresight/coresight-tmc-etr.c | 8 ++++++ kernel/events/ring_buffer.c | 9 +++++++ tools/perf/builtin-record.c | 17 ++++++++++++ tools/perf/util/auxtrace.h | 27 +++---------------- 6 files changed, 47 insertions(+), 23 deletions(-)