Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp791536pxb; Fri, 22 Apr 2022 11:13:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1NpZVb2CzIWmYRrsDl0TK0EdKNQVytfJ0UrrpnwsinP8rUjoWP1BwJDEKxwJIGPhUsYae X-Received: by 2002:a17:903:1206:b0:151:7d67:2924 with SMTP id l6-20020a170903120600b001517d672924mr5785783plh.45.1650651185543; Fri, 22 Apr 2022 11:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650651185; cv=none; d=google.com; s=arc-20160816; b=NYJGOyFcAzB/NMcax1OL8AH49iZ2gkf/qOac6W/jJRPgX6pf5mlagAbmYqxttFr6bf mSseVmit0Ffka90bUISn/a08+UTw1bY4P0k71hclKZNzzUJpWUwZlrGBV36RzlOfD7TY LFg36hKRzghraZ/UI/q/hG5JdEHkmkuhZT3oj2Uw0KaG3c0DSI9gVyuyHI5dXcYHhYV4 5zTkbQP7xMX9+IGlw7zM9x1BvfRZFY1G6tDoUnEllItVOL0mgGUD4leDamak08W8Ezm0 klqyYa2XlfrTjf8glQcx9pDuVeWPZJNp0Tfofe/I3Dv6Xt3b7hGMVFy012Ko55A1iYIW T5pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ElVuPXVKeTqQ8poOC8TbFsIITI2XOc/zMnezR5qhEeY=; b=aLYx+/Ae9vS/wwpHBGxGsYZgKztny5Mjuq29t3b95Xd/KxanHtfcIzqAzlgysFQrOE hPlQvacdCho1urJLLc+7W5i0iJ8xVwDwTzGa4IyqC9Lg8Jx9Us5WB+6b5zNvvvD0P2pa mc77nUhRO5jaVA0jBxaaFC96fnwq376fmFces/bZSlCXFrn33OkzSMeUQ0Zhfgm2Cmrk v2/Q760b+qXX0u8lBkUgLTHqvD7UmiYox1ZN9MDxG+HstNkci5hSfRTuI/nDaUK7raPD d8YwF6GDmPTlfDY8JPJRd4WQsEhu6KqAOuXvNI39NQimMxwvoQwfUHDQf6iQ31k6RaFb 2Rrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g5-20020a056a001a0500b004fb2ca5f6fcsi9079208pfv.26.2022.04.22.11.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:13:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CC1D6F99D1; Fri, 22 Apr 2022 10:48:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382374AbiDUQzb (ORCPT + 99 others); Thu, 21 Apr 2022 12:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357961AbiDUQzS (ORCPT ); Thu, 21 Apr 2022 12:55:18 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1DA0549C82; Thu, 21 Apr 2022 09:52:28 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CAB861576; Thu, 21 Apr 2022 09:52:27 -0700 (PDT) Received: from ip-10-252-15-9.eu-west-1.compute.internal (unknown [10.252.15.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F16203F73B; Thu, 21 Apr 2022 09:52:24 -0700 (PDT) From: Timothy Hayes To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org Cc: Timothy Hayes , John Garry , Will Deacon , Mathieu Poirier , Leo Yan , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses Date: Thu, 21 Apr 2022 17:52:04 +0100 Message-Id: <20220421165205.117662-3-timothy.hayes@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421165205.117662-1-timothy.hayes@arm.com> References: <20220421165205.117662-1-timothy.hayes@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch corrects a bug whereby SPE collection is invoked with pa_enable=1 but synthesized events fail to show physical addresses. Signed-off-by: Timothy Hayes --- tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++ tools/perf/util/arm-spe.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index af4d63af8072..e8b577d33e53 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, bool privileged = perf_event_paranoid_check(-1); struct evsel *tracking_evsel; int err; + u64 bit; sper->evlist = evlist; @@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, */ evsel__set_sample_bit(arm_spe_evsel, DATA_SRC); + /* + * The PHYS_ADDR flag does not affect the driver behaviour, it is used to + * inform that the resulting output's SPE samples contain physical addresses + * where applicable. + */ + bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable"); + if (arm_spe_evsel->core.attr.config & bit) + evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR); + /* Add dummy event to keep tracking */ err = parse_events(evlist, "dummy:u", NULL); if (err) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 151cc38a171c..1a80151baed9 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session) memset(&attr, 0, sizeof(struct perf_event_attr)); attr.size = sizeof(struct perf_event_attr); attr.type = PERF_TYPE_HARDWARE; - attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK; + attr.sample_type = evsel->core.attr.sample_type & + (PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR); attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR; -- 2.25.1