From patchwork Wed Jan 8 14:28:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13931026 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9DBC1FDE14 for ; Wed, 8 Jan 2025 14:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346617; cv=none; b=JR+B3sGyH+xcBCVs/ycus6Rp9dvkl46ktQ4+ZOCVmsBsLwOeSlz9ipHDYgk36bsfTVfgVHc8+ovvHUzUzlMa770gkUrnfIiAy1qjzARYwNvYRzBU/c1VseCY6YAR4zYc3I4ZaHfEhOMXE4EnBvYTPBIScXnCQiVtsMMqxAVTZ/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346617; c=relaxed/simple; bh=kPHLZrDNKrarvsG+2cdGymsw5D7aOVxFWnWlmvzi7lo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VyGTIkfecQYI4WPEzJ1uQHeg6VrgAFM+yXz+zCq9FChr9S2zlAdu03U7OKrDY3rFP4yODBSaLUCswUf5bRiSDtuYaXjyr/8g44DDJJmClVeRy8PcOg1izr5C4EgSd4xNnJDhDkLjCVyODHU6DDtvlgbmq4B7RPEiqqegHPtvt3g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=DoJQsvAS; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DoJQsvAS" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso122055035e9.2 for ; Wed, 08 Jan 2025 06:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736346613; x=1736951413; darn=vger.kernel.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=tGOb+QzXOCupJHbixt2wd4hm1wKT1vTFMOcKSfrV7BU=; b=DoJQsvASnWMFRujCq682Nv1wS1DakpBs+XLeZBVzZIOnO11iahneuNuz+LQQ0all5a M4vf1PCPhIk5gPA6rw/HxnK7qAWOSDHlAYzMWLPGqOmUIIM8u6DxMk+XBjInJVrfWeNp +OD/2BXrX2GLaCXfnE5DkCjgbF1ClEFMvwVhNR+gRlI+srrIYi3/s8ihFlHFbcq8h0Nx V7e9DGmSCQdEJ/XNJXH0AretZ2ExgW43MB8+cjduufxRbDB0LRFQs/PrvcU9YXY4WS5F yonCY01IskrQrOMH/2Sf5rf0XgWfQ6PHY/OiHoVleDIwF8jOOlvGgc1Qhj7mtcG38XuV p/1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736346613; x=1736951413; 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=tGOb+QzXOCupJHbixt2wd4hm1wKT1vTFMOcKSfrV7BU=; b=C6lNXSoAZFJXLozS8K1Ed3JLznO8phDGWqBZSGKg0DKSkr11zg89iSuLHsRrlOEO0K LAb46HeNy52tKeZ/prMfGe8czStNmkpJVPAp4oqXomYXvlCcHmo00fUgUywQ/tVJAh5b +ITr4dmtcV5Vuekmf3sfn2gA5g+PctBJQSTJn6M53NL2Q/zjqDsQxMkDANrlPD1CBzln XI6dTnikLzqXKAJrs77S+L5Wi1BeOWjP0UlzZ+0QdW/7ar5vvRcNdC3gcisxCt7sZR9I jVGwdN4VTSGQd7s/C0Qb/wWZ9DS6GhbCuGLqiTdO2FmvbJ0j/0blvqIKXF/STbSqmCoP FPPA== X-Forwarded-Encrypted: i=1; AJvYcCWZHp7djvSybrfFpGeCAysWZiE4WUZ01qbbL2mmw6QmGlsJBKmCsayMPxKagGOwnh3aqBo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywk/STpMJlgCY7R7Yy3MLvPZHllliOAWORK5MGoUEOvqyHJyvMS sxpqZCQxfxVeeE5uOe6MRyAzWLzCw+lcp6u4bVL1xDjiP9AIAMWB/2hIvDUM3ps= X-Gm-Gg: ASbGncsLXqXjeL/WM6uYEB0xQYJgkQwxwdc+j9ddKiVO0jQh4bDUzryfZKrq5Xc/RRw zQF6W/idpdwx2Za+G7Eq6G/gwFSh4mzVHmmKb6zXQ4QRLtqdXRjxabILg0enhHMEh6C2UnUHZ/X kxI1wvl8NZ8wOv+Mx7kE9V6h0Z7drX+jsirAVQSMAzlfldEHrwy43OS1bGEg6io8fk6V8Bhk0ah cT6qslEdBEFeUZ+urBYvDqGYnffcHtC/sUHoGwT+zfPCtPtK62w0Jxa X-Google-Smtp-Source: AGHT+IHN1A9cX6z/xhhtgrQjHkaDM0PpDq23z/ArfmpMTg/+JIa+MQk4qZUtvdK5AFfi/widPNwZ7g== X-Received: by 2002:a05:600c:1d07:b0:434:9934:575 with SMTP id 5b1f17b1804b1-436e26a8f4dmr28940535e9.16.1736346612923; Wed, 08 Jan 2025 06:30:12 -0800 (PST) Received: from pop-os.. ([145.224.90.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2ddccf4sm22836965e9.19.2025.01.08.06.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 06:30:12 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, irogers@google.com, yeoreum.yun@arm.com, will@kernel.org, mark.rutland@arm.com, namhyung@kernel.org, acme@kernel.org Cc: robh@kernel.org, James Clark , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , Michael Petlan , Veronika Molnarova , Athira Rajeev , Thomas Richter , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v3 1/5] perf: arm_spe: Add format option for discard mode Date: Wed, 8 Jan 2025 14:28:56 +0000 Message-Id: <20250108142904.401139-2-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250108142904.401139-1-james.clark@linaro.org> References: <20250108142904.401139-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index fd5b78732603..f5e6878db9d6 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -85,6 +85,7 @@ struct arm_spe_pmu { #define SPE_PMU_FEAT_LDS (1UL << 4) #define SPE_PMU_FEAT_ERND (1UL << 5) #define SPE_PMU_FEAT_INV_FILT_EVT (1UL << 6) +#define SPE_PMU_FEAT_DISCARD (1UL << 7) #define SPE_PMU_FEAT_DEV_PROBED (1UL << 63) u64 features; @@ -193,6 +194,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 +220,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,6 +233,7 @@ 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, }; @@ -238,6 +244,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 && !(spe_pmu->features & SPE_PMU_FEAT_DISCARD)) + return 0; + if (attr == &format_attr_inv_event_filter.attr && !(spe_pmu->features & SPE_PMU_FEAT_INV_FILT_EVT)) return 0; @@ -502,6 +511,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 +758,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) && + !(spe_pmu->features & SPE_PMU_FEAT_DISCARD)) + return -EOPNOTSUPP; + set_spe_event_has_cx(event); reg = arm_spe_event_to_pmscr(event); if (reg & (PMSCR_EL1_PA | PMSCR_EL1_PCT)) @@ -1027,6 +1046,9 @@ static void __arm_spe_pmu_dev_probe(void *info) if (FIELD_GET(PMSIDR_EL1_ERND, reg)) spe_pmu->features |= SPE_PMU_FEAT_ERND; + if (spe_pmu->pmsver >= ID_AA64DFR0_EL1_PMSVer_V1P2) + spe_pmu->features |= SPE_PMU_FEAT_DISCARD; + /* This field has a spaced out encoding, so just use a look-up */ fld = FIELD_GET(PMSIDR_EL1_INTERVAL, reg); switch (fld) { From patchwork Wed Jan 8 14:28:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13931027 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9D5C19CCEC for ; Wed, 8 Jan 2025 14:30:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346622; cv=none; b=iuyO/BIYa3fAZhYrR+HPjASjpP4x5U/CMptLwD9R1irjiPbrArxTgZx8Jm3lo/qhA3Wdk1jBxratglLhzko3999JOnBUon88EaZHdSG5DJW61R9EUzXL4as1lbZuEBoGxX9riBR1MqfmSriluJBeps3b7cM4hrwopYkGm/H1Um0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346622; c=relaxed/simple; bh=RerMUU2iJNRvAH+P/WRIzJRF2OXWh6S/x0SNAoX8N2I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R2GaocQBDqQkilw+b+kNk6HNhe7ylk7Vjm5o2VBXFDP+fZt4QwkCHIznxy5ybDJN74/ODXc4675VdFetJLXI0HNA+KJGsVtZdujY/Il94AFU8IaJsEgUCrh37RcreO2ylUPKDQh06xjkHeYiZy3c1BULVGV8jvkOxZpDhDXMnag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=kVr9y2vK; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kVr9y2vK" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-385e3621518so7934540f8f.1 for ; Wed, 08 Jan 2025 06:30:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736346618; x=1736951418; darn=vger.kernel.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=BwyNoR0SnuVGySQmrh3vEyVb1ET66P1aG6x3YnivKGw=; b=kVr9y2vK41azp1jjKs336EQXN972UOu3AWQ13mfDpeHY3IvN6Ix22adcGpiXweytkV wynI1DYIvAlqgZFsme/a60xCTk6ZXB59+iit+FjrSt8aJDXX10w+sljCBt+424T9VyeQ YlHHVSrSjRJqptNHkDvulh6IJYQ2Qas6xD5IK8pg2qHJW+BfxC4I+2qRGgV4d9oFpD9N FWaVmWr9WPvXvFLp7fTOVlgI21dE8cRAxnMT5wtzaNNgV/QCUfVNk/+uzquNOagjzfne 527k7s7BuvkMtdNf8HnqnqQWh2bTUq32B2w64ALXPsMD2NoSdu0J3aRuM/ajk1hyZBFw JUpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736346618; x=1736951418; 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=BwyNoR0SnuVGySQmrh3vEyVb1ET66P1aG6x3YnivKGw=; b=krE4s0TKdPN+SCdDmeb8D6uynH7zsmFtWO75F4ITSSRCLUsxBPIBhLh5QfalRb+Qlo Z2JncGAPfkubwuUd95g7ZYOJb8p6m1EAtqa4mIZCgFCOvUl+BQHwgjh+RNJ+wZzprxa6 A4Oc3M6uui+/PIVyqsHYNcEmh6dAceb/mRSyAS7jn9m8ALGDCpP9SD823ZjtgwlL8f6y bgx2vBALZkzxt28y+xdO1Z02eyS1u7le7r5i01cSBEAqqEAPKtEW0oumwYZn56H0TGdF Z2EEG7L42vvUjPNWrcqK3V6FjZCXseCC44IU8ExRLINbapbD6t+ssRgILRKWT+tYDHbp 7SQw== X-Forwarded-Encrypted: i=1; AJvYcCV2olJpBzjFvsterIkHdgDvr4FB6/C8Z5QE3N2KergVsBuIwBh86Me1/0a3c0tWcJZ7MWc=@vger.kernel.org X-Gm-Message-State: AOJu0YwK1kxoZq/mgG21jZSuPTZKxhfJr6gq6fYqsQiepnLAoEbuGIVw hQLypjpvCa9FUsqcL7BJcd/vaFWOEZbtQlLJ+EuNSwhQrr4LwPkHo14gwadDNJ0= X-Gm-Gg: ASbGncvxep0k2EUs/FCXLNXtj3nvLjRsk5pzqaAqH3tU0d9mIFn8Ox/z9i/nmz70TrX b0KcLyHzhefZ9jp91NyRx9MPMj6f0JXs/As5DWJbOjMLWLA4llRWiVHWBu6FjS5E3W947q81Wyk livASfwnJdjDPv2Wf4+vXhLo+DU7O8wjsEyA5pe6h6s1cp0yD+BZpUoA3zKMN9GdNOVeQH/3ZzR A2NRjFrZCo0cO52MyBAopW50z5jljsZIMK0lijiVtJyJK0RxhLf5bar X-Google-Smtp-Source: AGHT+IERlWXqo2ZT7VqdO/os7iGNqhnAktOupf4yL+hZB/qbP2byYeljw2KjaDqnGgNolCaFP0shlw== X-Received: by 2002:a05:6000:712:b0:388:da10:ff13 with SMTP id ffacd0b85a97d-38a87306e8bmr2608823f8f.21.1736346618097; Wed, 08 Jan 2025 06:30:18 -0800 (PST) Received: from pop-os.. ([145.224.90.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2ddccf4sm22836965e9.19.2025.01.08.06.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 06:30:17 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, irogers@google.com, yeoreum.yun@arm.com, will@kernel.org, mark.rutland@arm.com, namhyung@kernel.org, acme@kernel.org Cc: robh@kernel.org, James Clark , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , Veronika Molnarova , Michael Petlan , Athira Rajeev , Thomas Richter , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v3 2/5] perf docs: arm_spe: Document new discard mode Date: Wed, 8 Jan 2025 14:28:57 +0000 Message-Id: <20250108142904.401139-3-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250108142904.401139-1-james.clark@linaro.org> References: <20250108142904.401139-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document the flag along with PMU events to hint what it's used for and give an example with other useful options to get minimal output. Reviewed-by: Yeoreum Yun Signed-off-by: James Clark --- tools/perf/Documentation/perf-arm-spe.txt | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/perf/Documentation/perf-arm-spe.txt b/tools/perf/Documentation/perf-arm-spe.txt index de2b0b479249..37afade4f1b2 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,31 @@ Common errors Increase sampling interval (see above) +PMU events +~~~~~~~~~~ + +SPE has events that can be counted on core PMUs. These are prefixed with +SAMPLE_, for example SAMPLE_POP, SAMPLE_FEED, SAMPLE_COLLISION and +SAMPLE_FEED_BR. + +These events will only count when an SPE event is running on the same core that +the PMU event is opened on, otherwise they read as 0. There are various ways to +ensure that the PMU event and SPE event are scheduled together depending on the +way the event is opened. For example opening both events as per-process events +on the same process, although it's not guaranteed that the PMU event is enabled +first when context switching. For that reason it may be better to open the PMU +event as a systemwide event and then open SPE on the process of interest. + +Discard mode +~~~~~~~~~~~~ + +SPE related (SAMPLE_* etc) core 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 -------- From patchwork Wed Jan 8 14:28:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13931028 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C13E1FDE2C for ; Wed, 8 Jan 2025 14:30:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346627; cv=none; b=V0bQe+2XDHtakLUBycoqjvVHemueDJ9xe9wRekoskO725L6Y1PFJPrZPC+MwmxVatw3TmkfuoyeeRoz02XqMSUiTrKOA4jOmmUmIMXKc5+72o/kJ0mEgezogsblWrTLotI5p/uomKlUZL7O4Gcv298eiJ3+WPiq1rUAgtU/iL/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346627; c=relaxed/simple; bh=qhgx69uA8IiIJxSynCovT2xN+mUPia675m5YqlCbHk4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MKssRGqIYrtZmCZQ7q9tZPR/YhhBjWICPHJr5NVT56SZionqtPEJj0WdaXXjGbTXn6jblmRcl1NY3DQCjybrgV3UCPIVlUCGG2J3MDOOs7Mpimb2lE1QLRV2guvBDrdT1CqLGKmpPUTTidj0JMoKzJoVY/VxtfcvAZSkpJ0OGPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=KLuB+X6P; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KLuB+X6P" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-436326dcb1cso112956125e9.0 for ; Wed, 08 Jan 2025 06:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736346623; x=1736951423; darn=vger.kernel.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=I2Qn39K4UzsLsLGtfNH0/R87UIS/L19Vs2Fn7/eQxwo=; b=KLuB+X6PNmGVdUNQ92PNa8sJnhgbTpvEetAx7Uuz9qNfzt1IX1A552770aX87a8stv JURzlhODquroSUo4hPvwj1Tp+1kyPRPVJM/sH9U2kJ0wBBihAPCVExxgiL8cdlT0RgTw 6lpL5V1fXVNf5ICooSJ8mZ4lVfIuIm8BUB4poRvGiAhmdN6oQI9yLblBVH9jSW5/Co/i mpBJbuvSvEswLM2deozbw6qPdw5fSH5LU2B0KeAi/ZTXV63wjnggI5+nR2h/drNpwaqK Rn8gMjukv2AC2osAGM36324VtW3cnOZRn7N91Cf+0GARmJ3rvv9ohqev7L50RrIAAtvV qHVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736346623; x=1736951423; 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=I2Qn39K4UzsLsLGtfNH0/R87UIS/L19Vs2Fn7/eQxwo=; b=IHTLhAW83NeNGm6AvntxZxobSRT12PuISbPElfY1nTVFLDQodoeV+Ds29zSnWN9tDG 486KAiq9SLmtgl48k56hg7ZPPRLaF3bJ9axgY3XrlgV7R9MlJwxYW8oCC/DAhWHs6sDu S7Q5n9czY0G6xhrlBUjwMmiIIC9o+qohMr65N2sehVLktphVEAk1VH2l+P7KXoD3Cut4 vn8bnHr538uvRJ3hD7Mzhunr3nkkbBBGfSub4EoOFPqe9PjQzsuhFKllnVb2zW6LpoGu btsw/J5UhYR553nMkb7c2HlLiKbzq9dzXHStaL9bHYmtBbObXu++bdqHj7/vYW0Gxy9Q +uRg== X-Forwarded-Encrypted: i=1; AJvYcCUDa6icdIto/JaWCtdeNjvD/Nvw/gQXa4Tu1LhUl25OGPrHcOUxicDi3i+HR6p/RKXBcpk=@vger.kernel.org X-Gm-Message-State: AOJu0YzJmZQ48VmvztCZadesdRa+zkw7X/nUnV1k2X5hLUnAeR1J7IbJ z3qWJRFNhJXf85neFr1eysz8GO0RVgdbP2TTo2jT5hZ1uQofa4SeY3l3ZkiUWw8= X-Gm-Gg: ASbGncvR5CBiTAoQvPvYeY397gf271f2S5CAGcQ7rQeBlsiYPGeRuIzYPbbQECM4e+g WHRPgjSlDhc6mT5i65Oi8AFOY6/W9j9Joc58M0dAItMgTpHmnCWIYGltvOxlnnzKP92G7UZ6/G/ wKeAbLIF9e90y14LDz6H7rNZfiwruYmf/DxoMIa+yW+/mBQE/r/rtolm8q0f3N8qyuoA2HDDt+p NLHPtIVgBNUinC8CmUq98FlkKLn495hsLahNMWCRKlzytDPaYjJTPkV X-Google-Smtp-Source: AGHT+IHQgK8+Yd3JtaxOPOoCOGtnBLuVZ6/cDODvDBysXN7o1PBIvyAUjmPV1obXseFT3h2tmvjLfA== X-Received: by 2002:a05:600c:468a:b0:434:a968:89a3 with SMTP id 5b1f17b1804b1-436e26a78a4mr26241125e9.9.1736346623428; Wed, 08 Jan 2025 06:30:23 -0800 (PST) Received: from pop-os.. ([145.224.90.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2ddccf4sm22836965e9.19.2025.01.08.06.30.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 06:30:23 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, irogers@google.com, yeoreum.yun@arm.com, will@kernel.org, mark.rutland@arm.com, namhyung@kernel.org, acme@kernel.org Cc: robh@kernel.org, James Clark , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , Michael Petlan , Veronika Molnarova , Athira Rajeev , Thomas Richter , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v3 3/5] perf tool: arm-spe: Pull out functions for aux buffer and tracking setup Date: Wed, 8 Jan 2025 14:28:58 +0000 Message-Id: <20250108142904.401139-4-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250108142904.401139-1-james.clark@linaro.org> References: <20250108142904.401139-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 These won't be used in the next commit in discard mode, so put them in their own functions. No functional changes intended. Reviewed-by: Yeoreum Yun 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 Wed Jan 8 14:28:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13931029 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 547571FECBA for ; Wed, 8 Jan 2025 14:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346632; cv=none; b=JygunPv2mCX7Z0L0YwbxE6s/IL4zvonP7x/xolbl2IjLIKaGRL50pQniNC4TsT3aoAr5FWkAdg3X7w1DUFDzjwvwG/cNiq0xSumiD+Wvm6CyVzblAr71ahFaE2w8Hqn6iy6tQUpzql9YxdHxbNQaU+U5tP5ocnLrYKymTSxGxp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346632; c=relaxed/simple; bh=CzVsVOj5aHsPQBr+aXqDtSSnmkuppLx5203C1dQxOOw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i2ZWRlzZWF1CfUcN0K82CcAALHKAr5SsD7bzBYJE6W5BVuxFZSP+7P2j/9J5zYwmHKYTohA7iv7Rk8xtHkuJ2YZEF+LEAP8GuZLAQqfJsSB7VFTAgV/zTShfCfzJ55Nb5Cb93fuwhdHE4NFKcMaJRyAbMsF84526o2WQYvACsBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nhcEXKQu; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nhcEXKQu" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-38a25d4b9d4so6465451f8f.0 for ; Wed, 08 Jan 2025 06:30:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736346629; x=1736951429; darn=vger.kernel.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=wmWclsqjoRWfqPrE0WD8+jPpX9G+TTRqhb+EOtWuV1I=; b=nhcEXKQuRLML8xDCD4CRPPiPfMXV7gsgi4+dF+cuSh8DMHh+0WL4iVqPjsTSeuD0oH 4FP1WSMkCvGPCwOGfYO3/w60OT7+5vsI5DTK7cE+uh/D4F9aRRkj4V7E2ehFhfC116e8 DqUPtBciwNVEUIgBJF2/8KtGL5dJJ5Yh37pdTB0Hl5woDWNn7LvaDQ6VK3UFwrqbd8pq DUhp3FQkL73+7s6/UGCGOrM0ZD7qVN+PqFOGn9SVXy7N2+fDcFfuApwa1OAIwm4GDt6S VT/IQxPbnK6XMxyuP33z622HAbZnOLeSXeb2dloqDCbWng85QjGHADbfDoYzfoK8unZU j+nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736346629; x=1736951429; 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=wmWclsqjoRWfqPrE0WD8+jPpX9G+TTRqhb+EOtWuV1I=; b=qVR4/zwNfxoQwfj9ET8UuOu5ukviLJjKVQgjytnV7uNems7j0qF3sA81fM2GvRue5B WrADo8EKVzsib//A9yockPlw/bjgOPOJVUbLj86SBkAv+7PlV7TH/97/ryF1Fj7oW2SQ 8dlP78e2I1mkmxYHlEUBLgqfEd/PS38Jo7HaCWHr51zc6Qcy4pg+JNnBmCVAyOp8Kfb0 rvsHAYRjsRyKJvxFJov8F3x3RaqUCt5SjHkF1jA9eZSNsXsRebNw47viLYUXN/nG8xaj hAKYkaOxbsJF2O93ZSaQzyUVILaRtSG/1j62Dn9HrKee7epxRj72pOp1dxoV5aHq3lwE jGrQ== X-Forwarded-Encrypted: i=1; AJvYcCWyHnBzYd74Ty96ogmy5vy/IkdY5YOo8ap72vW5koOaDWdBRQZuJPWcLzJqMxTsT6K4NvI=@vger.kernel.org X-Gm-Message-State: AOJu0YzFFXrwVIScBmAU3KQt2epOo818wlFMZYJpUmnyQ2A2spx6PnN/ CQnwRjp8n+v0Csh9aAeoLTbWp+glD2OkzqL+lv72/rcDXSpm6+r0gv3suhYeRAg= X-Gm-Gg: ASbGncsSqErTJLZj6Cl+IzOlllcVVWMU8UssxmipZQaKxC1H+UcxRLrDUervPDwpV8R OgSYLNDcCDIoVAZV/UZ/vLdRi+AYulkjKUIda8wccyNAMs7OmXzFN5olDpZHvH5ZAceXuNpK9W+ bN4kHKbsnsMLbyA0F9t9XR+q+N5yP7LBx/UhXraCs/lvB7czNr4hkRXbRl+grvI3jjp8Rv2came z3WRFqCaRZM+S7o0sEADW2Z9Xy41kVGI1FL8uy7mP5NzsNbzcYJ5DaF X-Google-Smtp-Source: AGHT+IFpLlgT8rIizotjQJSiOIRTNt4ClYlj0TJvrmATLoOgZqttqZSvaAwtMedep20NBlyPDrMhRg== X-Received: by 2002:a5d:5848:0:b0:385:f7a3:fea6 with SMTP id ffacd0b85a97d-38a872da433mr2572275f8f.13.1736346628653; Wed, 08 Jan 2025 06:30:28 -0800 (PST) Received: from pop-os.. ([145.224.90.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2ddccf4sm22836965e9.19.2025.01.08.06.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 06:30:28 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, irogers@google.com, yeoreum.yun@arm.com, will@kernel.org, mark.rutland@arm.com, namhyung@kernel.org, acme@kernel.org Cc: robh@kernel.org, James Clark , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , Veronika Molnarova , Michael Petlan , Thomas Richter , Athira Rajeev , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v3 4/5] perf tool: arm-spe: Don't allocate buffer or tracking event in discard mode Date: Wed, 8 Jan 2025 14:28:59 +0000 Message-Id: <20250108142904.401139-5-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250108142904.401139-1-james.clark@linaro.org> References: <20250108142904.401139-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The buffer will never be written to so don't bother allocating it. The tracking event is also not required. Reviewed-by: Yeoreum Yun 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 Wed Jan 8 14:29:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13931030 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C40BD1FECBB for ; Wed, 8 Jan 2025 14:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346637; cv=none; b=ahA595/uEhnU+MCzLQbSAy02hXAMYKQZw+HV3oyBEnrQfF/v0j/zhh9GwbKuQ/R67cSTEYhZ3M3iQ/3dn5bSM+SHUAnqmNKEFhNR2Zv0/zDm0VNqsiu4Z2eC5+F3qLJTK/nLtN2ikYZFA9oJ4+vwvIvwmOAh32Zs5NSBQUyv0EA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736346637; c=relaxed/simple; bh=HJMe93LWOIndT8K0R5G7ezfVXY9GgrzNRpECoxcqcxA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kqfuFRS8QMkPhAeC8v1fmKCukzgezlzQZpfiy3pSUCZcQaPj3gSfG+mSzvwsV9EV1PUdSAJak8e5vKk++bEqhUvQ0hVdNQwvAp92BwojkkLKBPjXWDb2d9fnffMs2khW5UuOfFogZ5NTYd5jrRboB8/pODF77FCitlX1gfDp/00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sjGj4xth; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sjGj4xth" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-388cae9eb9fso8878413f8f.3 for ; Wed, 08 Jan 2025 06:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736346634; x=1736951434; darn=vger.kernel.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=r1j+BIbB70BfH6p+H3D0C/f2KwCH22I9fsAuqIEouAI=; b=sjGj4xthcnusiWMlxR/w5ooLBd6P+p2EOt6slHOKl8sr4r9wKcZAS2HSFE2LhQLb9s 44vqhRMcOm2iuw7wl4u/mUjrw2zP579mP7+ExMYHcS8ZNhFo86QQpXcKuSeOtHH0rQoe QseyF1dlvPLMZCneXBkcNwgHUCUFHCPmtfYC7nX69Jz9hA57jDHZPCOwT9xLt3uhzctL Xm7MRXGmgkBU0IDgRx6+45k4Ab9M5NCzqMgJIqHrjTNzvaXhmnoIMiUm09nwraBOl5o/ zDCoEuHG9w078mmoyQ/poLrt9V+5UwrdY/alyhpxr0RgF4g6+zN2IvHxhrNbasF5WpZh BhFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736346634; x=1736951434; 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=r1j+BIbB70BfH6p+H3D0C/f2KwCH22I9fsAuqIEouAI=; b=OdwaR6EMpAmyI5GLJCUufoUiZY3V7j473RQ0BxeUDpHDdbbq5ukITM9C4bIx1cEIOe tWiY963cRrtrc9aAli9hkZkXVIadztAGDRv7RvZkPOMMehCANB+hIdPL22jYkRlW41v7 mpT3X9MbW/hMg2+vu4Z1yPxeR8uVXUUOM1kPJH0euD4zdiySmAq1oCTsOoQvGOL/5k+b UXHc6ogPwmOtSPumsGZJ5Ty+zgX4rWCcw++Tb5R0FOLebb7Tr2mA4AMiImnX+zuyqaZQ 8PqGcfzpAsTsR4+j+ClQnUL457kQp3Cp147adlT3BiwfIpYmw2oClFxSgbokGR/iONTw Vn2w== X-Forwarded-Encrypted: i=1; AJvYcCUz39/PvhjxKJSuk/OqsLMOtpyL0guN7X2P2QvZnAtipnotoiabXb1VfGbnOBymZwzdz5k=@vger.kernel.org X-Gm-Message-State: AOJu0YzPyFfpQ4lCxqkgUQBHpQt+rJ3v50sfLx49IkAjkeLY7sXSgixj EhrElpVC69rvALZmO3nvidYSMSRb9zODdqu9TjyzKCh6kwVhd00Ko9Oqae+Ri1M= X-Gm-Gg: ASbGncsJX8rad/C6rIgt33zMGxMkiJpMfTKqYtWXV6S+U+5oditcdc1WpyhoLdclWSf zD6eEeMxCrjL3pGmg/TEtW8BTGVAQhr0PnDdNCJgGH+jduVi2oxhN9IsQnj+VJ/VrgSLXnSi7Y4 WXE7OJK83fjuy1yhCZutlN3GCPTg80FmSKP9RNBPpvZ4uWbfC5PTQgDzT8MycH/CP8GjM9zBmHE Dj7cGuCSTesCjym9mRwnfPAihk+OaICzeeLPWIPLAw5gBsx+XnswzFO X-Google-Smtp-Source: AGHT+IGPG2fbcdAWI2kWNuJul9oexF8hk5Ad1KOrWrlN7IkVYSCPH+BLbdTguMj87I9RIg+5zb7CeQ== X-Received: by 2002:a5d:47a3:0:b0:38a:4184:2510 with SMTP id ffacd0b85a97d-38a872db629mr2716682f8f.23.1736346634083; Wed, 08 Jan 2025 06:30:34 -0800 (PST) Received: from pop-os.. ([145.224.90.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2ddccf4sm22836965e9.19.2025.01.08.06.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 06:30:33 -0800 (PST) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, irogers@google.com, yeoreum.yun@arm.com, will@kernel.org, mark.rutland@arm.com, namhyung@kernel.org, acme@kernel.org Cc: robh@kernel.org, James Clark , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , Veronika Molnarova , Michael Petlan , Thomas Richter , Athira Rajeev , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v3 5/5] perf test: arm_spe: Add test for discard mode Date: Wed, 8 Jan 2025 14:29:00 +0000 Message-Id: <20250108142904.401139-6-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250108142904.401139-1-james.clark@linaro.org> References: <20250108142904.401139-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a test that checks that there were no AUX or AUXTRACE events recorded when discard mode is used. Reviewed-by: Yeoreum Yun 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