From patchwork Tue Dec 17 11:56:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13911681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 73566E7717F for ; Tue, 17 Dec 2024 11:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LmEIgAdG7I77Lmy/EJIbJ6DkTA3vVYUkhkE5mP+SPGE=; b=itUw3x1OMWWnceYWALH1gGsabE duHTV4HPxfVP06XgS15qikCZPHrMQMbPC2kzIdkwLomJcT1tebxJh5O6jK2ivO2QBqxzG/51JyJua yLoz8CMakZOJjdTBPwq81oVPtxQ8OICK2MavDfACL8lahQHGuZE52amU7WTvJps0JhNssgDqxFHUL f0hdeIF9SlhNqGsKM1lj0I0Mwac3g3mBYSq95k6u1tnISQjG/mByvgi97rnT0W6fmbiOQeGNO5HXM zst01AUtsOGD+WluRqdM7YztF2T4GG3rVNapbgxuuWeAdi50vj7zaAhP/WiY/a3EuH0+8Wjr/OZ1y cpe0+X5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNWDi-0000000DKBi-47qd; Tue, 17 Dec 2024 11:58:34 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNWBe-0000000DJhO-3jsu for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 11:56:28 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43624b2d453so57566095e9.2 for ; Tue, 17 Dec 2024 03:56:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734436585; x=1735041385; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LmEIgAdG7I77Lmy/EJIbJ6DkTA3vVYUkhkE5mP+SPGE=; b=BploJmyEboY0ZViHEtZ3TtIYM2RHE+qxz6i6OMECu/EfVqKKsqg5VT0IT0z4LJ0VDv 9SY8NRHO1AlaevLUnrpE6HMuBiHLXwGkbkLt+2eVteEFZnpDiPyAjm9Q04Eba/QPWzvs 0F+ezVrqLFM3gNaLZt5yuGp+dlItzA7IPyP0KgCeOXD1LOHh8P+SISedhIEpKqP5kUro 7gSdr0SK++edEK3Wn8X2AAk6/Z9FcFJrzjBs9wrg4kgZu1aZy3DfEl69A/PR/ssadxWa hgmhEk/GB1vWOJQxXrOPnH1PX8LAX82OMDjhS1APADMyQ+MrhKtWEtIt+5pqL/l48O3H 3nfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734436585; x=1735041385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LmEIgAdG7I77Lmy/EJIbJ6DkTA3vVYUkhkE5mP+SPGE=; b=uijPIW8cElwlTNWWSIbVW7oO94REzU7vNhErIjMth2EHrI0rySvnFh3kBH3H9Sb8z7 GrtYn0PgeIa/3eQUbNw4PkWrzsY3mmj2p6rFwhwzIMCUQA3LGZPk3x8gRPDohbT4CyBt YKgRpg+tktueIxi7iFFSjIeGsuMq0irrRsr1uQnue/0Il21tOperPWIQzuSfBPFNsJL3 j5YHVBW8/yQw7RpT6J3zyqfryC18LvnOc+e0mMFUYpdKYZZ2E8x5LrKpo2XcyU8t1aWE K2zly5SfJPGs6MHzJbmRdG2ErD+nXg20lbnjBmeFsjRSyF+ugOYJ4ZXL+bKJy3DumLep 6I2Q== X-Gm-Message-State: AOJu0YzYvGZYi5hfSA5qJoY66nHy8vpaKAkeirr4OIO7RFz3UHFPJGxU lwyiTIaN9qWODnPHjITZoObItei7dVLDn3XXBB57l+3WXJhVtRC86l174GBaXZmLf8GvH9uF7PK 8 X-Gm-Gg: ASbGncvPzMFBF4GYqzrVicRYLuAK8n5F7F8zGIjl8SEVxmQp4xo5DWOmkW5iHKFm6E3 thl8y8GNe1xu1VHaD4rc7eLpjolR/Z8PWAmdTOzQzNSi/diEkPaBMBh50pTk6ccw5bPBE5IkKxB S8Bc0ULt3pgH9nb/n4mHhQIoteBO3AZLDWm1DdUok7jgQbwnTnf+gmYcsn7HRd6Ng0zEkPGV1u1 +0H3GwGzhfVu9nCptNjnpe5aNA7RsiY4V9/FxBnJUQcohLapXo2Obug X-Google-Smtp-Source: AGHT+IGNJedMudEIFVaDxE+oFB3UvniCIpMWZQiyQUFW16zagcfc+ek6kUelO/SpR4GWuh2tlAEkwA== X-Received: by 2002:a05:600c:364b:b0:436:18d0:aa6e with SMTP id 5b1f17b1804b1-4362aa1b077mr127025825e9.5.1734436585066; Tue, 17 Dec 2024 03:56:25 -0800 (PST) Received: from pop-os.. ([145.224.66.247]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436360159aasm114935825e9.6.2024.12.17.03.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 03:56:24 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Cc: James Clark , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 1/5] perf: arm_spe: Add format option for discard mode Date: Tue, 17 Dec 2024 11:56:04 +0000 Message-Id: <20241217115610.371755-2-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217115610.371755-1-james.clark@linaro.org> References: <20241217115610.371755-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241217_035626_930528_667BE467 X-CRM114-Status: GOOD ( 19.25 ) 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 FEAT_SPEv1p2 (optional from Armv8.6) adds a discard mode that allows all SPE data to be discarded rather than written to memory. Add a format bit for this mode. If the mode isn't supported, the format bit isn't published and attempts to use it will result in -EOPNOTSUPP. Allocating an aux buffer is still allowed even though it won't be written to so that old tools continue to work, but updated tools can choose to skip this step. Signed-off-by: James Clark --- drivers/perf/arm_spe_pmu.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index fd5b78732603..9aaf3f98e6f5 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -193,6 +193,9 @@ static const struct attribute_group arm_spe_pmu_cap_group = { #define ATTR_CFG_FLD_store_filter_CFG config /* PMSFCR_EL1.ST */ #define ATTR_CFG_FLD_store_filter_LO 34 #define ATTR_CFG_FLD_store_filter_HI 34 +#define ATTR_CFG_FLD_discard_CFG config /* PMBLIMITR_EL1.FM = DISCARD */ +#define ATTR_CFG_FLD_discard_LO 35 +#define ATTR_CFG_FLD_discard_HI 35 #define ATTR_CFG_FLD_event_filter_CFG config1 /* PMSEVFR_EL1 */ #define ATTR_CFG_FLD_event_filter_LO 0 @@ -216,6 +219,7 @@ GEN_PMU_FORMAT_ATTR(store_filter); GEN_PMU_FORMAT_ATTR(event_filter); GEN_PMU_FORMAT_ATTR(inv_event_filter); GEN_PMU_FORMAT_ATTR(min_latency); +GEN_PMU_FORMAT_ATTR(discard); static struct attribute *arm_spe_pmu_formats_attr[] = { &format_attr_ts_enable.attr, @@ -228,9 +232,15 @@ static struct attribute *arm_spe_pmu_formats_attr[] = { &format_attr_event_filter.attr, &format_attr_inv_event_filter.attr, &format_attr_min_latency.attr, + &format_attr_discard.attr, NULL, }; +static bool discard_unsupported(struct arm_spe_pmu *spe_pmu) +{ + return spe_pmu->pmsver < ID_AA64DFR0_EL1_PMSVer_V1P2; +} + static umode_t arm_spe_pmu_format_attr_is_visible(struct kobject *kobj, struct attribute *attr, int unused) @@ -238,6 +248,9 @@ static umode_t arm_spe_pmu_format_attr_is_visible(struct kobject *kobj, struct device *dev = kobj_to_dev(kobj); struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev); + if (attr == &format_attr_discard.attr && discard_unsupported(spe_pmu)) + return 0; + if (attr == &format_attr_inv_event_filter.attr && !(spe_pmu->features & SPE_PMU_FEAT_INV_FILT_EVT)) return 0; @@ -502,6 +515,12 @@ static void arm_spe_perf_aux_output_begin(struct perf_output_handle *handle, u64 base, limit; struct arm_spe_pmu_buf *buf; + if (ATTR_CFG_GET_FLD(&event->attr, discard)) { + limit = FIELD_PREP(PMBLIMITR_EL1_FM, PMBLIMITR_EL1_FM_DISCARD); + limit |= PMBLIMITR_EL1_E; + goto out_write_limit; + } + /* Start a new aux session */ buf = perf_aux_output_begin(handle, event); if (!buf) { @@ -743,6 +762,10 @@ static int arm_spe_pmu_event_init(struct perf_event *event) !(spe_pmu->features & SPE_PMU_FEAT_FILT_LAT)) return -EOPNOTSUPP; + if (ATTR_CFG_GET_FLD(&event->attr, discard) && + discard_unsupported(spe_pmu)) + return -EOPNOTSUPP; + set_spe_event_has_cx(event); reg = arm_spe_event_to_pmscr(event); if (reg & (PMSCR_EL1_PA | PMSCR_EL1_PCT)) From patchwork Tue Dec 17 11:56:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13911688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E42A2E77184 for ; Tue, 17 Dec 2024 11:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1Swt8An6cH0UytiEm5BcU77Mv2Ddjr7IJCM9GFGK4Ig=; b=c33oOALQMzgRgqvjoyl1UtwdSV jBRvuzS5Hhp+06u1v6DIZQMl7SGPyJWYDvGgnBSLmCmQLSH12sv+AlFKMLtTwt0L2TeaicS9UNbjv XgOJnv4TXZeUttANIePsOBJ7/j2odngqiBkp/DnK/cbt/DBuzQIp79zNrKU5mUTDTzyxQcgP4RVZ5 DpvtoLanYsZauzDuF9uk5SA50bU7OJnHtRtS/vCTeaOqnE57PPsVkwhHF73AtTufhtzw53r8YQDVi 8go2AFaDcYjPmqvzhF7d+I6JG5vn1NGMdA8HrBaw4hsiiPqkh+uWUs94uztSKvntLwd19WxeQNZND 7zCuhPjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNWEm-0000000DKSv-2Tga; Tue, 17 Dec 2024 11:59:40 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNWBi-0000000DJiv-1YiE for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 11:56:31 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43625c4a50dso36004785e9.0 for ; Tue, 17 Dec 2024 03:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734436589; x=1735041389; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1Swt8An6cH0UytiEm5BcU77Mv2Ddjr7IJCM9GFGK4Ig=; b=gB5aRSpO5WNIB6jamHPK5SBkROfe7JOWn8DXyLgnw+CaWOMBKrgQQzcwXjU7F82Ykn TAGH2HOW9Y/ayjqx8Wv7FoC1dnc69PSpys4yAYyqZOgrPuOZka/0djfH9R1FvRGX2ZMj 6SBiYTMVFvgeSUUUI5WPBy9wAGOt0KOJMRDI+/Z9XcsgH2yvuLOOQBlojFoDNdgGf7Y+ Qe7pu/v1najQg3CvvKXWbRqkWHsPxSyKDhxUci54ZZufCbHb6FZ1CdKUWO0Bz34m/3l6 QW+5JWgHFpa9gVegdtvWqP2hDIefZq5gnB57kexnUVWQkG7FXMVnkpQlAW/0K+97IpM1 XwLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734436589; x=1735041389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Swt8An6cH0UytiEm5BcU77Mv2Ddjr7IJCM9GFGK4Ig=; b=EYBqqMhDWxQSrra4LF7tkxaWOANS+cOfR+02Csy/Ip/m/MX+IYS0puieYIsmdGXqJ4 UiVK4M2MK4M4YsxWZuVTYgH/b7ZN44WMCd/d9tdu7pX0kmAiq6MYUULLl4btpseciA3w I4qvOWLTgYIzL6MJ9I4do6s8/Pq7Uw3kZO55XBb83xGiYvi27sEKEUhrESCb03O4ekX9 eGVwv4EzT3fgXh2UOaaiKRfcvRvqAtNIOXodzI3sjoYLrW76bmxAu6uT5hoBZaRVzT6W v/e6FBCqYc9tKgXxwd0N4VIusum3TjS/kxWB2LoMi1CDPqwgpE7KebmazFCSAoPIZekm jPYA== X-Gm-Message-State: AOJu0YzZ9PlHwPcYjMcC5eFNbRSxXtNDUl2X+EpWB3NVzI0cQ41RMk5b IPkosr5B0YytnhwjSDdLUDiMMwqIOKe8KVpbFTd7oiCFcCdx3uTjqZJKtfbk9hcEyb3HDC1GhjX I X-Gm-Gg: ASbGncvLlmmh9lKG08GQSUrotlp6Y+vNarzxGL47v2wlKcuZrLK6wxyeNf27o+Wct3g 7XW8YJr2laxLBU3S4xPV5Vxd6lEHaFvhlEo+Nk3TZzOTu+OhAHkjuNlezW1tsToCslDCPukkqlr H07a8oLMO0tXefdhQZCoQMZqJVrYRMC9cmwga2eNEgFi8O+TKW/tjRdpJhoXg0Q74IhlagwdRBB NFzSpZfuM/ZeY22KpTRDPk/uHZ7J9MFjhYEHxzEDbaPu9oHVrYT6qGC X-Google-Smtp-Source: AGHT+IHYPBPQkQDRXyVGehPAmC7A1dmxHnikbhEhvzazvTv4q/sZtDwu0z2Pco+deD3aSmH2xXPBEw== X-Received: by 2002:a05:6000:1f82:b0:385:ed16:cac with SMTP id ffacd0b85a97d-3889ad33ff4mr10801795f8f.56.1734436589050; Tue, 17 Dec 2024 03:56:29 -0800 (PST) Received: from pop-os.. ([145.224.66.247]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436360159aasm114935825e9.6.2024.12.17.03.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 03:56:28 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Cc: James Clark , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 2/5] perf tool: arm-spe: Pull out functions for aux buffer and tracking setup Date: Tue, 17 Dec 2024 11:56:05 +0000 Message-Id: <20241217115610.371755-3-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217115610.371755-1-james.clark@linaro.org> References: <20241217115610.371755-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241217_035630_422423_AFA3AD94 X-CRM114-Status: GOOD ( 17.23 ) 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 These won't be used in the next commit in discard mode, so put them in their own functions. No functional changes intended. Signed-off-by: James Clark --- tools/perf/arch/arm64/util/arm-spe.c | 83 +++++++++++++++++----------- 1 file changed, 51 insertions(+), 32 deletions(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 22b19dcc6beb..1b543855f206 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -274,33 +274,9 @@ static void arm_spe_setup_evsel(struct evsel *evsel, struct perf_cpu_map *cpus) evsel__set_sample_bit(evsel, PHYS_ADDR); } -static int arm_spe_recording_options(struct auxtrace_record *itr, - struct evlist *evlist, - struct record_opts *opts) +static int arm_spe_setup_aux_buffer(struct record_opts *opts) { - struct arm_spe_recording *sper = - container_of(itr, struct arm_spe_recording, itr); - struct evsel *evsel, *tmp; - struct perf_cpu_map *cpus = evlist->core.user_requested_cpus; bool privileged = perf_event_paranoid_check(-1); - struct evsel *tracking_evsel; - int err; - - sper->evlist = evlist; - - evlist__for_each_entry(evlist, evsel) { - if (evsel__is_aux_event(evsel)) { - if (!strstarts(evsel->pmu->name, ARM_SPE_PMU_NAME)) { - pr_err("Found unexpected auxtrace event: %s\n", - evsel->pmu->name); - return -EINVAL; - } - opts->full_auxtrace = true; - } - } - - if (!opts->full_auxtrace) - return 0; /* * we are in snapshot mode. @@ -330,6 +306,9 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, pr_err("Failed to calculate default snapshot size and/or AUX area tracing mmap pages\n"); return -EINVAL; } + + pr_debug2("%sx snapshot size: %zu\n", ARM_SPE_PMU_NAME, + opts->auxtrace_snapshot_size); } /* We are in full trace mode but '-m,xyz' wasn't specified */ @@ -355,14 +334,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, } } - if (opts->auxtrace_snapshot_mode) - pr_debug2("%sx snapshot size: %zu\n", ARM_SPE_PMU_NAME, - opts->auxtrace_snapshot_size); + return 0; +} - evlist__for_each_entry_safe(evlist, tmp, evsel) { - if (evsel__is_aux_event(evsel)) - arm_spe_setup_evsel(evsel, cpus); - } +static int arm_spe_setup_tracking_event(struct evlist *evlist, + struct record_opts *opts) +{ + int err; + struct evsel *tracking_evsel; + struct perf_cpu_map *cpus = evlist->core.user_requested_cpus; /* Add dummy event to keep tracking */ err = parse_event(evlist, "dummy:u"); @@ -388,6 +368,45 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, return 0; } +static int arm_spe_recording_options(struct auxtrace_record *itr, + struct evlist *evlist, + struct record_opts *opts) +{ + struct arm_spe_recording *sper = + container_of(itr, struct arm_spe_recording, itr); + struct evsel *evsel, *tmp; + struct perf_cpu_map *cpus = evlist->core.user_requested_cpus; + + int err; + + sper->evlist = evlist; + + evlist__for_each_entry(evlist, evsel) { + if (evsel__is_aux_event(evsel)) { + if (!strstarts(evsel->pmu->name, ARM_SPE_PMU_NAME)) { + pr_err("Found unexpected auxtrace event: %s\n", + evsel->pmu->name); + return -EINVAL; + } + opts->full_auxtrace = true; + } + } + + if (!opts->full_auxtrace) + return 0; + + evlist__for_each_entry_safe(evlist, tmp, evsel) { + if (evsel__is_aux_event(evsel)) + arm_spe_setup_evsel(evsel, cpus); + } + + err = arm_spe_setup_aux_buffer(opts); + if (err) + return err; + + return arm_spe_setup_tracking_event(evlist, opts); +} + static int arm_spe_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused, struct record_opts *opts, const char *str) From patchwork Tue Dec 17 11:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13911689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8DFADE7717F for ; Tue, 17 Dec 2024 12:00:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=52uSj8E/aVB15WhaSRtD8CBQxo0ybh/UWrgjS+bPGCI=; b=pG0jXMlJUgmRMmZtO7z4jFPz2d pxsglqXBknmnAIV7qdVjraIjSi5mlZgsA4Bkr43fJBD85/6Kx9g8JSyY2g+RGvPwrEXYP7zUpR3Ca cN8OGUPuDjrqWkwQiEywolXx4xEnbKffjbPwQ0Ed+PUVgAqY4kL5NtJVWH4gL46Cyh4naNJ6QmL0s UHKJZcP5PHT9HGVgYuV7NgGhcw07VkKJvu8CFIe6X9Cz9Zl4VgD6PFkFuE6QxCwYG0COBztsRQjzy pAq3YtnB3WvxaCue/Gu2JB1238+MJwhnL5meS8+82oqVHMKUzXGc5Co0RjsA2XQeKXpFUln8ro/+P Aru8I8cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNWFq-0000000DKiU-0uDM; Tue, 17 Dec 2024 12:00:46 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNWBm-0000000DJkN-3GIX for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 11:56:35 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-434e3953b65so36359315e9.1 for ; Tue, 17 Dec 2024 03:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734436593; x=1735041393; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=52uSj8E/aVB15WhaSRtD8CBQxo0ybh/UWrgjS+bPGCI=; b=tbBqZ5za4aEw+OjtekjCXsJPilaGvHfMIIlmSCgXCYeMigAX1YujZa6DDM8UKjdrgW mI/rSRDQxwEVQ+WjIVByeT9xoznFDQHL6UgXAYlXSAiKuq3UYUu5BGgZnIO+puJy/2Ks QSz+oKNUmR9VxKV4NOhw0bgx7fuVb5zbZdCgiACNPRVqTmei6bCAaIFGFtBvGNAn0Sok iSd5OvBvcnMfjTyXZecoIHRPTV1qeRF+yZw1Q9YpmfdX93hbH6TGB98SphIJSXI/HnHX v5X6Gx/sHzGmofe7P3DpYfVVGIbkRgepM5nqQX1/2WuQF3/gE1dXyZkpjGQADLDtylSa In2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734436593; x=1735041393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=52uSj8E/aVB15WhaSRtD8CBQxo0ybh/UWrgjS+bPGCI=; b=ogI3lEI8X1Z2OCNVm2KnyAsY+yKa1QfC5PVy6ZcG2IbpHy7LcJPr98im2iLEM4Ctya 1DLzGU5kxeUtd7gB1W/xZQcTonLEZeLh3iSFnG1Ben5Bd2L5fDtkdYCjLZVvdIKXOJ36 M46fKZM4QDkYLYGqV+wxxf2bezn4ekTY42b3COKIRBaQkUWDsLtBzApRcSMD7KRfAiJz 2fGR+VZQ2/TZv8+G+w0D+2/uRo4TPcxBm7KUYZwy9ogHmFRVaaFr5N8TuXsqNuP0FQy2 YoaA9UHlBJ4JimN/dmG57aSrbrm2/uOtIXL2cj8qg0tUrnXY324iwsfS44RmCLorc6ev Q6GQ== X-Gm-Message-State: AOJu0Yye420JG414yQOBpY4b04j7N6TghmtmzZ/Fv3L4PTvsPMFuW4JV hDfu8LP36cMsISP8AXs3i4NAD+2Cilnt4nXmRJrS6Mp6DUGT7HYHz0Xuze8023dPGZVfP1QvOge C X-Gm-Gg: ASbGncvskNEQqe4vJEaPhOyEoPCKokpbt3Ox9YnsfBdUUjRpK5mHuQbce5LxvpqU7qd i40T2crmQpTYshL7RASWVjpbrByL+F24fs+T6U+n0vS9JAVS9EkXPNhbSemytHvvTUtD4b8tTT+ v6Jj7HCz9x6RoZXkhKtVtYAXLdA4wEEDnvvtEKzbVHX/z1X8nGHTQa3qnXKP0HplXS34Urlsw7Q +V5tgYGKUFPk00zKUzdEFlCQAOEUjj92SG6DJISpxh9id2NWWz70Zdm X-Google-Smtp-Source: AGHT+IH2s5qUAf+fpkuqgPU2+mVf7/GWHrtm3hb2i29uW1limYKT3R5Wn/YlSCwzGGbUSzG/NCKU+A== X-Received: by 2002:a05:600c:b95:b0:434:9c1b:b36a with SMTP id 5b1f17b1804b1-4362aa2e539mr159531685e9.13.1734436593037; Tue, 17 Dec 2024 03:56:33 -0800 (PST) Received: from pop-os.. ([145.224.66.247]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436360159aasm114935825e9.6.2024.12.17.03.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 03:56:32 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Cc: James Clark , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 3/5] perf tool: arm-spe: Don't allocate buffer or tracking event in discard mode Date: Tue, 17 Dec 2024 11:56:06 +0000 Message-Id: <20241217115610.371755-4-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217115610.371755-1-james.clark@linaro.org> References: <20241217115610.371755-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241217_035634_821617_CE005A3B X-CRM114-Status: GOOD ( 14.25 ) 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 buffer will never be written to so don't bother allocating it. The tracking event is also not required. Signed-off-by: James Clark --- tools/perf/arch/arm64/util/arm-spe.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 1b543855f206..4301181b8e45 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c @@ -376,7 +376,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, container_of(itr, struct arm_spe_recording, itr); struct evsel *evsel, *tmp; struct perf_cpu_map *cpus = evlist->core.user_requested_cpus; - + bool discard = false; int err; sper->evlist = evlist; @@ -396,10 +396,17 @@ static int arm_spe_recording_options(struct auxtrace_record *itr, return 0; evlist__for_each_entry_safe(evlist, tmp, evsel) { - if (evsel__is_aux_event(evsel)) + if (evsel__is_aux_event(evsel)) { arm_spe_setup_evsel(evsel, cpus); + if (evsel->core.attr.config & + perf_pmu__format_bits(evsel->pmu, "discard")) + discard = true; + } } + if (discard) + return 0; + err = arm_spe_setup_aux_buffer(opts); if (err) return err; From patchwork Tue Dec 17 11:56:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13911690 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 42649E7717F for ; Tue, 17 Dec 2024 12:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jwqWh99mkwgFG4i731gC0ut6m4bysgrlep8nFs6msoA=; b=0UbvWuhTaLq/IEgvY0g/IUCAl+ x/06f6ZRaFJEyZxPm7McJVGaMy65bgfJ8oaPqEofaMZaKrhtMHLwd6I8PiV8mtzTTWiI4LLSSjuIs o9kREt3C0NQfJQpJAczkR0D6NwSo/MryMbHHPpzUSzQZZbhs4ZEQMUtllWSnmZw5mAOQ3UOG3i3HI leB6g/Sp2ezrmE9nPwFWweAkfTLT9rCx58H9UhEZVoHUnCk0JWXvaF2+vphET+XbM4U6mZA64Nhi7 OonCbQcamaGYEtaoXXTJgO0UbVJJLBw44rrhHRVwoQPYXdb45JwndiWfLdEogLaF9B/v6oXnYKf8U f21ZRsVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNWGt-0000000DKtT-3WK5; Tue, 17 Dec 2024 12:01:51 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNWBq-0000000DJlg-2Agi for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 11:56:39 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-43635796b48so20317215e9.0 for ; Tue, 17 Dec 2024 03:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734436597; x=1735041397; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jwqWh99mkwgFG4i731gC0ut6m4bysgrlep8nFs6msoA=; b=CDGCekjcQvZBBWDc3Sr/8yediuDJ8EAxjV2H7+nTIyuqlwcuVjZhKpccciGpqlQa4R iYtCbll49Iq7uYgLCemREQa+n1SVsMLkCkHSwwZ4EbSG8QrcCqW0flOrGsGnxb1tFSja miCS1HRPLBnpFP83zPF3qDKtR1IZcgntgHIu5lwdzuxKuigG1cBcKN7Bg5Z0Cub3Muqm 4siRe8IZoTJGB+kc3Pe6KlKgGw4/3SJSgLNducMj8Ij/ZD7jQpFbGrLz7y09v3X5riK+ 58GSbQs9kKesh2NlTwtMk46wNE2jPQ5poHa0yK2olPKV7igEpGXQxZawbYP19yUCHt+i QHng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734436597; x=1735041397; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jwqWh99mkwgFG4i731gC0ut6m4bysgrlep8nFs6msoA=; b=EXbnYWT+NlK1o1UHPgQzxULKKqvMIYP+4hn5ENSESqw9ZDwxA3XqzG0IFwsyLFrwFO 9/AAaf9S/P5ECFhwKCTaEFY44OC28XACcGBCRdQtNKkJq/MX37bvt83GXtVFzH5TETS8 h+TFTNgyOSikdw08ykOduVmp2SBawF2dGafUCwBf9vFCkcCZKoOnHt8R92eF7kd7m/3y rpjKisQ9TQNpMCpTBdiBbGLGn120wk8h2NneNWKS+WkYHJY4m388SGFwhqTNMxQMvzyb tE+UsVyaWI3V03Upjt65RjXWP3/dT5m1WJyoYW50Q1WTqwvEGRIElUi+HBDEuIC12xky 5COg== X-Gm-Message-State: AOJu0YwSR9fbHBgWdilwxpbE/8mbvYOyEONAsk2tEQuug38gTlxidJWT lXNd31oCcEGv5VN/zgEkSBR8cB4rld8tRsFsVkYqYoYNtHdPw3UcSQfiZCKVvnroqEUj013M0XR G X-Gm-Gg: ASbGncvqQP/5fpTLoJ2/DkfIjggVHrEdI6phvG8uKX5sDCbnkxwpRhEhi/ZHi0Nt8HU Ka9MZWCuKpMirGVt4Wn2BasFT1RiV4ZgGWpe2sgZ0JxAthIU2gg7SeRBCOxakZJbdRXTmHtr3Xq IT6+WQbzQ9GfQqbHusTxBAOyxvjamwCrzxbg4XQGpfzGqGDdotnM53CeUkfeAE6x8Q0n+78hXP1 CaPm3kTPY3w6FJcmqSlUNzk5P0wQUvqHmewUvgqGiBQAbWd2YrxcggO X-Google-Smtp-Source: AGHT+IGwdSY4bxXI25oDz+FWewMmRHe9+KuuRiSPfZFzGZSjSm8Hi3QlFSfDLHoAEpYFbRs2avKTiw== X-Received: by 2002:a05:600c:3b22:b0:434:fa73:a906 with SMTP id 5b1f17b1804b1-4364814eefdmr23438715e9.4.1734436597154; Tue, 17 Dec 2024 03:56:37 -0800 (PST) Received: from pop-os.. ([145.224.66.247]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436360159aasm114935825e9.6.2024.12.17.03.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 03:56:36 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Cc: James Clark , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 4/5] perf test: arm_spe: Add test for discard mode Date: Tue, 17 Dec 2024 11:56:07 +0000 Message-Id: <20241217115610.371755-5-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217115610.371755-1-james.clark@linaro.org> References: <20241217115610.371755-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241217_035638_557021_BC0B4A05 X-CRM114-Status: GOOD ( 13.20 ) 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 Add a test that checks that there were no AUX or AUXTRACE events recorded when discard mode is used. Signed-off-by: James Clark --- tools/perf/tests/shell/test_arm_spe.sh | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh index 3258368634f7..a69aab70dd8a 100755 --- a/tools/perf/tests/shell/test_arm_spe.sh +++ b/tools/perf/tests/shell/test_arm_spe.sh @@ -107,7 +107,37 @@ arm_spe_system_wide_test() { arm_spe_report "SPE system-wide testing" $err } +arm_spe_discard_test() { + echo "SPE discard mode" + + for f in /sys/bus/event_source/devices/arm_spe_*; do + if [ -e "$f/format/discard" ]; then + cpu=$(cut -c -1 "$f/cpumask") + break + fi + done + + if [ -z $cpu ]; then + arm_spe_report "SPE discard mode not present" 2 + return + fi + + # Test can use wildcard SPE instance and Perf will only open the event + # on instances that have that format flag. But make sure the target + # runs on an instance with discard mode otherwise we're not testing + # anything. + perf record -o ${perfdata} -e arm_spe/discard/ -N -B --no-bpf-event \ + -- taskset --cpu-list $cpu true + + if perf report -i ${perfdata} --stats | grep 'AUX events\|AUXTRACE events'; then + arm_spe_report "SPE discard mode found unexpected data" 1 + else + arm_spe_report "SPE discard mode" 0 + fi +} + arm_spe_snapshot_test arm_spe_system_wide_test +arm_spe_discard_test exit $glb_err From patchwork Tue Dec 17 11:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13911691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CC577E7717F for ; Tue, 17 Dec 2024 12:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bFM1q7jsB7Su3lAVmgr0rlaLhCHhfoFOEst7jXnFLG4=; b=S/M43D3vJdvppFmemccOL73Vwc bysvPfe4x6kvYgbkJMD2ifIxV37Q4BxXJE/FgZKiZdAIqTnry/jI+IMiQzJHomIJLL9gUY5iVcFqG zb5bUFyGUoZ3EAm+2tGGsN4LvrC++JvCBN+lPrCoXIdnBAg/P4LHEmCYKN+AreiqdJqQOZehpIDZd vZLC1ckorx3iRjUGH0cOlJXLy39PdZ3Z4BWjQti/cB0sbaD0Yt5pda5NQtQKRabqkteMsWCp13lGZ XE96VVppWI6Y1pcyQC1cCEtBT11WKDIIJUyhvN025qGykbTPpVRuJYuAWoIFXmAa0Kt4PAQxrtgjP SMd3NQEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNWHw-0000000DKzz-1v3J; Tue, 17 Dec 2024 12:02:56 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNWBu-0000000DJn8-2egu for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 11:56:44 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso32288755e9.1 for ; Tue, 17 Dec 2024 03:56:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734436601; x=1735041401; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bFM1q7jsB7Su3lAVmgr0rlaLhCHhfoFOEst7jXnFLG4=; b=rJWdsFX+W5TvWwCjKhtGPxX5jyL5S/gu0OPTQ2Vk2jk+SoxWwHfXB+mN3dKYXGhmUj QseDzcnHgztl/ES+AiPFallMrQN2XJ3jgKwooGCJFQ/2EGNBCXhcQ+iYEFOjxGoJF5xR Iwq4p8P5P0beJjXYjf53AvrNw9R7bRZRtbXnIfNbONe4MTti9ItprubtS0sTIb//cqdq 1n5ybSaDPWFEc3rou50sNj5Tqyvdk0oRWsS3E4na5M0+bl/ISmstRcy0NmqXtZcqkgTC nBrMyofk//eD4PFMaKUm/EmU12iSVYAdS1hcS8NkZ+vnmbTPsMf+UlmkrWEq11SipXOK Gqpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734436601; x=1735041401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bFM1q7jsB7Su3lAVmgr0rlaLhCHhfoFOEst7jXnFLG4=; b=fH/jm5Kg8leoxmgrUvuvkIOKeE7xyUZOFAXrCmpgZmceipXqemOXt6qs/gmnNzc1G0 Sn6lxgZnEP6h8MBNOTJ1Y0Crg/X295RYBY9/7WUHkOrZ1oOrOZBN/l1EB/E49LSpOJ3d 3FqVp23oUUi7JssogOhvGOT7QriQCUcC+ghbQmePUw5c3pZfWpcmIS/+MsdClMNoxVeM rszw1yDVf56OFG4EyUVo5kB4Sh7iWIPVl9GPY+xsy+txRJGokoMMlMWy8xlX+D2KzxpZ Dm1hZkqB7zpjrvLPrNY4SJX0z+idbACk8H7qD28nYxx8QxdEJlmVRqvD7ReCoWAvPgGe GWYg== X-Gm-Message-State: AOJu0Yz9BEJb/pq2bcVwP8YqhpfV1MGZiK5ZcJBkAgJgCpA6q+pcUX+t DZi7Asa6XFjT4Afa2FcMcXhbgb7wNMItCi1ZwIPfN5/iLEuR3GbUf82MLY3FbDnjYZwBd/7i1ND t X-Gm-Gg: ASbGncupMH1Pw12dWe4bhfVPVOPjvnBGVnvcU7yaYh0oteKcbYgNRlKHxoyexHi/5pv 2p+foiofWOove1qAnIFgWkiPKX5P8o1VlxrGd379VTE6xD1qz6gazD0RcAGAXPmeSA1KcbVJqA+ ylY3FbbDtMW052yGE55E8OoXMWQ/y7OxhVBYY+LnGaTr7xP7y3zg3ZxJq7NfuG5YGz503AJOZne Uuc//6ZJ9MIYAqEv8KC2tWvblBfyoyh7th75CeFDkmcmhw3E5wFyjDA X-Google-Smtp-Source: AGHT+IGHK04q5y+mpaaNrdicK1T9ozCfgAnXqS1cmz3u3H1E5qAKa1r9yR6aB/fLQM8NPU3JxtkxJw== X-Received: by 2002:a05:600c:3516:b0:436:1b77:b5aa with SMTP id 5b1f17b1804b1-4364815c7d6mr27745645e9.8.1734436601097; Tue, 17 Dec 2024 03:56:41 -0800 (PST) Received: from pop-os.. ([145.224.66.247]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436360159aasm114935825e9.6.2024.12.17.03.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 03:56:40 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Cc: James Clark , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 5/5] perf docs: arm_spe: Document new discard mode Date: Tue, 17 Dec 2024 11:56:08 +0000 Message-Id: <20241217115610.371755-6-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241217115610.371755-1-james.clark@linaro.org> References: <20241217115610.371755-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241217_035642_665244_C7E5590B X-CRM114-Status: GOOD ( 12.98 ) 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 Document the flag, hint what it's used for and give an example with other useful options to get minimal output. Signed-off-by: James Clark --- tools/perf/Documentation/perf-arm-spe.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/perf/Documentation/perf-arm-spe.txt b/tools/perf/Documentation/perf-arm-spe.txt index de2b0b479249..588eead438bc 100644 --- a/tools/perf/Documentation/perf-arm-spe.txt +++ b/tools/perf/Documentation/perf-arm-spe.txt @@ -150,6 +150,7 @@ arm_spe/load_filter=1,min_latency=10/' pct_enable=1 - collect physical timestamp instead of virtual timestamp (PMSCR.PCT) - requires privilege store_filter=1 - collect stores only (PMSFCR.ST) ts_enable=1 - enable timestamping with value of generic timer (PMSCR.TS) + discard=1 - enable SPE PMU events but don't collect sample data - see 'Discard mode' (PMBLIMITR.FM = DISCARD) +++*+++ Latency is the total latency from the point at which sampling started on that instruction, rather than only the execution latency. @@ -220,6 +221,16 @@ Common errors Increase sampling interval (see above) +Discard mode +~~~~~~~~~~~~ + +SPE PMU events can be used without the overhead of collecting sample data if +discard mode is supported (optional from Armv8.6). First run a system wide SPE +session (or on the core of interest) using options to minimize output. Then run +perf stat: + + perf record -e arm_spe/discard/ -a -N -B --no-bpf-event -o - > /dev/null & + perf stat -e SAMPLE_FEED_LD SEE ALSO --------