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: 13911675 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 B2EEC1F12FC for ; Tue, 17 Dec 2024 11:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436591; cv=none; b=VudxhOqS98l6/qBzDL8TQU3+LP2737bd/6KNKjnyo7y5F5FoYXqAKu45PNvOCxGlrAlYwWnfNV/zAdPdLLyPbBbt7UlFWI9vhCLydq5jYGWK2kFg3nW4OI8BK/HgbckrhxbzIlZJrPoU8cs2V9ok8XIln5lBojT/oskW6DcL6jM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436591; c=relaxed/simple; bh=t6W362mVGL6hjIcJ6Gq1mX6T3k5VXFAyf1XwkSuGV6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YXTvJrUzNlhFzLErUbqlPDV2j+Hgf2M6rcPpzzqx8TBsvGfEEKuqZuN+KdLanGvtavKoI+JvwXus32OUxkF0A/BAmLUcOSXI/AbzNj/Rr4VvRhCDNdmTK64F7cn192/N7kCIfElLmZlMTnEpckTR9lk8c5gHFtY50D9WbdkSLSc= 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=aBYz4VSa; arc=none smtp.client-ip=209.85.128.47 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="aBYz4VSa" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4361f796586so57553205e9.3 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=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=LmEIgAdG7I77Lmy/EJIbJ6DkTA3vVYUkhkE5mP+SPGE=; b=aBYz4VSaqV6AFEWhCvGR8ncYZZG5J+YD/KMgoP2UHPNkwwEu7j1l83zYi+08infi29 PRzYK7oOsZVfqro3EmRn4ZGVyueyC1jLahtR7i8b4Lzx5MDTzvJJV7e/I7y861YPne0R o+bEQlfAGo74U7paJ3AQIadqCv12g95NVRHuM3wO8wFTLG3q5P+Ir8ipeYFNDEh3eRdK n2biadKRnYsUmNQ3ihI35ej48uvKibzVUHTqCAYPK/Nk0jflI8I4vNXU0dl+eg1ft0FG MSy7ao3OO9XBcI760mEI7U/IeZUGmHD2oEJuU8kotWOaqrsg4HVFF2RLmpk78A9i7bE3 kRXQ== 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=Bx3YDadnK7pg/cAI5uJtLB6JOj1zGb+kV61uDMQLFADLmvRX8b29wMTB/Epx9jRm8g LiTlSgQXwrF+Q36iBMkRhv/9Onmcaa4bbHWhvgWxZUyVS8B9vT5f4B+SAa52zG0IcdRG pPi81btAE5Zg40TzmU4I+XRBTvs4ArVmKU28e/1tsFWVa1szcYOeKHuDqeA6NRer7ysn Dhgv4Sik9KYjICmfqxpA63A1KQafe+2ZKI7aCcZTev5kVTE8wdBFFnZHdK22i1WD83Nz XsdRRS2GQdz34oFpDXnZtVmE8bqNxqPN3UsEerzD/sZH1kCn6iIEv9boqBUUWwAtqoMN WtIw== X-Forwarded-Encrypted: i=1; AJvYcCVgUpta6zH+tIAwX4UlXHw8c1TTrQbQvKs171dqhdczaxotV4xjGn3PzneWwVCTA7kXl18=@vger.kernel.org X-Gm-Message-State: AOJu0YwF4Wc9P9fmyxgPmmlEcRZ8i32tEvdUhoQ76m69Umw44XkXnuXp 1LtA+GEdFDLso87NUFcBricsg1SDxsRRcuM6VRPfY1nKICMu/sxONwX47P+UeKQ= X-Gm-Gg: ASbGncvyjixDcH3wE8YkiEbeFifi4bBN+jLODDSVvbLvH4DGDnleCRL7UYocdPdJxxh CSyErShZ+/+lcWB62IMvtbA22Z7hwuGAr1ssZICwAxWyDaR9FLEsmP/KF0qAvvH3DCfchiv0Ydp c+jXgcLCzr7xFTvBpZQdMb5hK8Cvpd31WyDY/yILidGuCI8b6xZTc9bX6SuoSyOuLSRo+iAsrTv gCv9qBiVOGhG9P9aYIYZQ0o01DXDZQ4iy/OE7wh1hTWZlZTSdrxhBac 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> 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 | 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: 13911676 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 A27241F2390 for ; Tue, 17 Dec 2024 11:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436592; cv=none; b=C3yS79QwOUEuI29Q6Z5gC/ItJIYQMM+RAIYWq7+7UBeA5lkgWKu2g0LNDz2ipkZtWQCubhvD3mU/yyHG0AcLBQaAHaghg+gdJs/b5IzAULi5W4zD47vXlhHBdYAjOsp8M4Oot8JNufLjfXuWbqJE51CNE3C9SvHXnHaVPSh6JgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436592; c=relaxed/simple; bh=tpnlelcMbJ7A8lxnHi41TMdRMlFf/pMqWGQuvroX664=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=W/4ek9JEj8YBauewc2Ep9pwxXSp1UsoFgKPQW4P1ew7xU/ivtZRUDLuwDqN0sy0PJNETJn9Nj1Lw9J2+LE5GRxI/pOhHf9nKszYAyg1LwJrVxb/zA9TswY0vCa+UweAZvVl4cd1l0zURpyjYe97ALYAjo4btivt6KT1YMnP9L8I= 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=a6QTUKrY; arc=none smtp.client-ip=209.85.221.51 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="a6QTUKrY" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-385e06af753so2720457f8f.2 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=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=1Swt8An6cH0UytiEm5BcU77Mv2Ddjr7IJCM9GFGK4Ig=; b=a6QTUKrYjFhtafekqJdaynKjbNhAAMY7O2v41wmwEQydeLW4sXdiVSBGWCMUBtHuy/ pUaBE/NaN14J46TANmNMFzB/lJhG3vpWQbNCZZESmmPhSYdEKWXWzKPZU9E2tVQa8di5 sla3CkmbrPdK+TDRlKbgVD8sFPgxZ7ObBY7OHwuKQ+5gYMO1DHNjRhZnYtSzZS2Au8rY 0lCDgxnuafM/RnbSIRS7VCXW6la4MuhoRhU7ncrzATeQuur/ZfEX1mfH9fmEWk2FdJgI +i7hkkIPWLbeoTKV7Y3iEPcVzsrjh1OX+ZxgVf/O51K3fITcPRrtImrqGyWaBPy4aRoO kRkQ== 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=CqpNkZjPcS3bwJYQrVZI7kNuhifOv44YNyqpXQyFLQC0t3acQuByRE4t5MQQjqtrWD XTIQfFEMStgie8d6WJeR1FIo6enmcPUbjAFeFenE7bDhGIm0BsX9+HyaN8mYPxIyVNnH SeWBpvpIUnXhW/v0xEVS417pYrVnKD90Eh85ymgXvsul5MMIGB6RA6HffGydoN3r615w FnQjKOLRvUrniezSdt6laPIp6ZXUTIJxvR4ZEtrIzWQjYL93VV92UlE9pZ786DHQ+761 JWZmZHB9Y6fzG/Kq/NSTkKpl+d5InA/gR/JApS9p9BIqd21Esk4E7AvVCsgZRtk3L88R +Lpg== X-Forwarded-Encrypted: i=1; AJvYcCXMM4RXQQvn+kSngogxK4q5Z7SMqozSgdyweEdQ3FvyfhZwFHsd8SVZVhfG+8t5KPpVhck=@vger.kernel.org X-Gm-Message-State: AOJu0YwXF0dE6YURUVRwEsSr2rpS0mX3KTDbDOV9PwR/0XBTF5CCoJxe kgPxyVkxSZ/AN38gFn3Wa/eCIPo62pOwmuEDk2Ccu7ADveyS+OnCTgkFiDUts6Y= X-Gm-Gg: ASbGnctPxn6HuKvtExZqNAhuiSH44l9OdZPNKAGLy209nxxV8JBQYi3J5RIEB97YYzj GYzO4ttq8bMGpfwPZW0Ne91ytSU+2gNNCCYX1dxvoyblo22Vz7jszgQ1ai6E5QKFKDCMcELpq3a PtQadLaea3RcNk1ATPQfGSegWvutxWXPBOj/Xep7Fv4XKI0U2eHw6PaBs6L/zbOGhUV28Bj32/3 mars0TFlpzJ/LVDDmG6l8VZw4JYlEC+TuoNBASial+oBnLB4OVYoZvI 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> 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. 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: 13911677 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 9EC4A1F37DE for ; Tue, 17 Dec 2024 11:56:34 +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=1734436596; cv=none; b=Tmm7+jkvM9rP/1fH2mad6Sh2n1iiauwvdVKVtdJ847F4vb+RgsfhyBMR9e/g5eBT9tFp8aXB1s/RSMsdHjBQAbjlOaphozlvrPmP+XvGjjQCnItV9Qxr0aPNQ8wtPIzbxlR538CzCPamJMWMg9ztOHS9HXMYvFihfyLXgmA5Mw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436596; c=relaxed/simple; bh=EXhJJH3GTtw0Pc2COLLlPSCssK0z09b5q0z1Po3tSGs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cyAyNeqpMq8cVMsAaDGw++HVHUwaxO35ghTJVA0QzKOf8/tjp8BtSNwoxqU0zkBKdd+T/DD2ID3uGNc4/mWscG+f3blwdKhAFVjWOoWgJOP5I5gSlBY0n1NlZKqwZ0n83GDaka0d61NJd9zS7j75Q4Vxo7DzRj15uvFIknelogI= 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=A2/WpRPy; 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="A2/WpRPy" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-43625c4a50dso36005345e9.0 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=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=52uSj8E/aVB15WhaSRtD8CBQxo0ybh/UWrgjS+bPGCI=; b=A2/WpRPy+ASNIgFlgSyQbT+bufsa7Op61vm4V/XpNAp0LTeiXKNxLxu2jouc/FbYkZ oDbg51WJEWVqKsqq6/GHX1SLNgK0aN5dh/g8T801tSMCHgjPFaWJpu2JBGrRpy2uZy29 xr7bQdluI4Mag7hQ+vSKrvAP2llNX3k1rgE7exEcB7G5CuMZ8peOzEN11QnAiPZyiOOk BnFjTkKANCG3sjLr7rOyKZfn/k0m/X8h6aplZJw/oi7FxkanhL3vEFXIp0eBh4OmG8Z8 IiXUXyIVkOhtQG+8oAME1ETFaaemi7sdNjp2fghmr6BKlpWMOOUAlgSgz8x3cBLnsxb5 O9Tg== 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=qY0kraAZZvzzpqyEC5fVl3Vif7IflZ432D5rIg9iJQV7k5VItmHje1wjUdgEDSrqxt djTFCSnph7i44oy3tHXVIvvhheFgRoZIiTfbP2VVNi9V96S9/R9dYhiV6WcfGtggBI6+ VbgjZPsewzcP4aDyiKzExYyetLND6v+ZCnMOCXdIFGXf81oYNx8vb5uAMAeHZdD6e1Oi FIegwS/h/8q6BWkCtBTqcmJI/liN5D0Y/SElWEMD8U3RzpvwOc29Cr7E095u9sWnGv6q JbCgE0CXN8j7acrbeUfDtV5ptxWCQsd6gQnUinajDc31P6/PfhMtjuw+WXxCu3W3mj/5 nx4g== X-Forwarded-Encrypted: i=1; AJvYcCWg8/nsmhmFQbv4dosSqnN9j/JaJOcDiUvsPHc95qFjY6wLb0lOT0KOpdGovdib32CLNBc=@vger.kernel.org X-Gm-Message-State: AOJu0YwiheCxRmIisdacz+wdV3Ew8O1S3wh7QqcXBlUaUCA6gLA/KvVN aiUkqG+BwRZ7u6OYDcJr3T8viu5G/HzmtaagCrAxGUyJvew9/oqnoQNBIVy5qeU= X-Gm-Gg: ASbGncsUDPMrLdSFxh9mfiqgKIDoValB33NsQuVRHkc1Cwt2w6G2mBaxEQQwx9KLCLp L6mLz4ToZa98Uaz6T8IdQb8xRjthWI1ZvKPVK+wMjAvrX4h6xGGoxRuoBeflcd6kLBAvZgdBH/O mLY5uP1p9oDo6jqOiloNqRAezIGtkyexic6J12Ou3L+9cc6LxspnKPETJfvhoBo/ey4ZX0QCN0X rruoccUhBziZ0afRO01NoU3r+UdEKn/uyaql3fcojB55OMnl3OoN97R 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> 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. 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: 13911678 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 A00E61F3D56 for ; Tue, 17 Dec 2024 11:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436600; cv=none; b=o44P8ll45tfyeUnjcuLuRfXgUwYM8Zl2TqXJ24ktxI9p4WeNZjuSOG76+7kcehuFOpf56pYqTMWxH1WYiZ2dfiwh5mIp9KoJRIo8S4YFDiA4Jc+LDOsYMipVMTpigL6u9qddCoCdxZK5Don5T/+3D5SpsAWSh8SaUGm5OvjAiUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436600; c=relaxed/simple; bh=uz/cOheGCgnwGt6ic1N6Vuscq6Gm3oMspfGnxKGBRG0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uVnOPI50Q6tJkpCkPt0tk1TZ3TTv5EAK77Gt7bvrknDuTe6RcJ6o1C3WM6AnlsyRLU7f1KRilg7Tt2nBb/SUgZX63c3NU7jws3kMirMiRl+LNz0RY0qzD5voP9/Tr/OzuFLJmXGD8+5C3KzsP/RlShqXh3F8eYeoSbOtme6LkkU= 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=CPC/ActJ; arc=none smtp.client-ip=209.85.128.48 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="CPC/ActJ" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso32288365e9.1 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=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=jwqWh99mkwgFG4i731gC0ut6m4bysgrlep8nFs6msoA=; b=CPC/ActJOpYZ+JDgY+WdKiEYlPAtj6pCGNhMRC9v4rm+p9UUs63iqwTgy9cYRJb46j dELYdiQJo0rnQNy0RnJU/GuFbWaCuViGAAOdptsjVUwZCaI4JytuT5QuL56d3/hTBUXE qWFKB3p03f9Atcp3UuJ0h9GQ/5n69xUei8cKJOk+ktsZv6f897UyxBK5LvYgljqmwsbu OBLziQ3VukHKvtTb86VCr4rh7ui8bHIQ7/nSUeRewkmbkwyOFUr8wTOR8eJp5azI0M2I erfte0MFWU/Ic7OAsukuADoNRXIbpciuZ7Dr1QnqEDUaENpLyxstnFg29TOCnzL6yxTX gSFw== 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=erzCCUSrtbqybQh3phlTpL843tDQZnR3MkzNBxPmp3FWnxI11T3p8Lxtcjd8yj7D6R nzHLDh8v+L6RNenkXN6nAt24+8Lba3AvVAQlTXZTR1tjO3I1s5H9TIDpR2UXm1Iuf3hr wvuNUN7Kov2iGqILrkA2KOxMjnJ1Q12qfLh8n0qfBylxSyKJgihDMjtjlLTHLExX0MiS oqJ2JXBuIRGhMcoDNnntkW7BztqiY4iWLugzLHYF36CMDA2PvfuW1aNs9fjeRL9DClXh /ZXEyLa2cRNTaYWFL7trgTnEO620VbuxRPMJnMk/C3cnXLtwKMjp2X1a8wIWYzc1j5kN MIqA== X-Forwarded-Encrypted: i=1; AJvYcCVxSfx+NKgfNAJ7I3wzqdlHcRx/B329ZsLUPbLRaEuvcZm28FXagiEZBjQDW8GBV43zPZ4=@vger.kernel.org X-Gm-Message-State: AOJu0YyQJWUiuC0gJoVeF5BEf2Y7rd7IaKYerppi6OmgnfBJ7XAcn24k vehuF1FbAtci5RgbBtOEO6bm72UPmJRurg7Y7FiHeCWdt8GeempUC/eS4Pr/P0Q= X-Gm-Gg: ASbGnctJdH7RXRCL5SCDDBa50ZCEUm5koHviioGcKicdD9+hbVC2ufPb0sOBxZFQw4t pMy3rWc1U3E/6OL4zhHOMj+xZQ7hn5iaU0W/miRwu6mfQ0R51uHeHszg5if2uRwpeWYkYcJ8npc pheYHCmP5rZ+CUEMJQf5v/jRdlHGMgQ/Ku63a7BTQuu9FoRdZD8vb9oauCy8SCJ3r9odTQiOKdH hZY7UXkmCPWi/gUKrUqlETdMzuiaC6ixEOaMrxjJ6kBR5BhCGMi8Tzg 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> 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. 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: 13911679 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 B7A401F4289 for ; Tue, 17 Dec 2024 11:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436604; cv=none; b=HMfn3wXMs2cVRgDsD6oftFTBoHl4+WN2/t2Qjld23NSZ4LFOLF24AxpbmDHneC/2KcrJaNBJL9dwPAHeRv60JRagSwHmkmHPqYS9Team4g7IyR2aHmSFjov0UKuCVY4Rl5bN90vAJ0ThxMi3tVO/wi2phPfUFjFK4pWK8uNE0Uc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734436604; c=relaxed/simple; bh=fyI0/dhbkFxqKd8iWh2Jzy9mpwkSrgNFZ+i9alPd06w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Jg5xfIBmwcf2IUo/o5gJ/fE1SKX5HHFjEGaFHJdg1qDkAGN4hZRqVG0XNosxUBsDK/kNuxN//DC2rjFnvj70HqbdiVWhV8tRtA7Rs2xjuuGh0knPE70yMGuqGGuG28SwbyKR/FOOLII1B2yZISk4U2mVg0pAuGYy4fDl0+agCpI= 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=WmrD2b/b; arc=none smtp.client-ip=209.85.128.49 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="WmrD2b/b" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso32288775e9.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=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=bFM1q7jsB7Su3lAVmgr0rlaLhCHhfoFOEst7jXnFLG4=; b=WmrD2b/ble34C9MwCDKzGxVg0vFLBUyrDuJVfLLw1rqm1qyUXqWiR4eOZbNAk1BNVb w4Jfgt14YAEDSRgePSBFuicKaAgUGvmJ9KwAjmlzoZcAyaMCeTIcWsakq8DZKghJYTTH RdTK+wh+fy0FLBLE1CNgxbjk/MuMoXFuOBFn+mGQMYKWiW1kkYesLDjNUohiIRRv42L3 tEBnBEcZhdBHqtYPB2CqdsAuXKhNiySB36/XPUBHQ89xX+TnS84awpFdq5CEcJlr6M+X jGSfOJdqpWl7+gNYy60d/+FvDsWF+ezjMtjKNRe8YzoCgnw5JWBID5d1O+20jG16Uw+B YZQQ== 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=N7EuKvVF4Ta6lIyfAp6vZVNfPMbH5n2PRxdlusEFuSe4aLRzH6EzoHOaWe8XJeov6y m1BPFMeH12Cp8eVddUe5WtNH7cCi96N+vkqt5MqSLHLTM9H9q87/Hf425LsV9jT0RlOQ cjCljgG9X4GFGdYcVoqZUksTbWTMbCBx9W3SkjN1TkyC9UDe4WLmw8/RQjDCjBvQnSCU 03JUcq8xSNqd0qjmA9n5vliXIFvZXIEtQBgg8vNfk8FmBINv0jKDB6tNitkNs6jSJzKn TeexCwCET8U/KcVjUloGgm2Jx2bxe2JsHpad6c/xONWcOgl3sAjdciM4H2Z82h4u+bBu 9Q0Q== X-Forwarded-Encrypted: i=1; AJvYcCVb+pP1iNed77zDVGpimI8Nt21ADyDGqqRm9Te3gtQBOesND6dADIYPumTqZ/1Zh0LaOfs=@vger.kernel.org X-Gm-Message-State: AOJu0YxsTQFUG/uun1qhI83KXx2C7xfZkXirMpkR16iHUm09XQ1Ji2hD /iWbNAJcrHD/d2xQZ9C+42n1Uji0KkPEw362NyOvRF0GI+AU41pai2KfpAch/ps= X-Gm-Gg: ASbGnctcay1M0xW6PoCFvu9cV+97iHzBg21fj0iCwZMbtUBFzrFIUdRHnS15BdMWhb5 P3UfGgfJQY4PGT5W/EaDbwVWY8IUhMwGXQ6sD+d8kutHj76Y1mdV5feYEx7rTfjsm9cyEGEupf8 1qHpaZIGAH3/2Ne0G7+E6ktGd4pK+VzOtzChVIyiDUyB5TilElQOpTcO3l4Xn0j5+m1fLgwZvct sO6A9TI1gpmip766PRmxFvYFO8qWW/jJF3LnuhSktjSUdxlVF2MdyNa 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> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --------