From nobody Mon Feb 9 23:42:43 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 4F4AE1C3F01 for ; Tue, 24 Dec 2024 10:44:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735037085; cv=none; b=YwFX+TsTSairtSkD4IMDMxt92V2enOutDCT1AtEh8F/w06EKvzsVOhx4Wbd54c1ByfKbvrf3bV6xuEJmizT6X4JwcLJFzaJ8YpsppxkAdN5yc1MZ3dICsJr0j4eyBMq0ldouOneo0pUKOSkfd/lI8qMoAQygEy00BLs05WNv3eE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735037085; c=relaxed/simple; bh=qhgx69uA8IiIJxSynCovT2xN+mUPia675m5YqlCbHk4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VWF0QEhlhNQfOg/4sL4cJfrH2nzZGm8JAuFKSIrQQ+pZ4nysVjiPPEkeBpwKFE4sSM87BapbC/Mwl5ae2zrtc/7/HP9p1QARtFju3EYy9oEl930N9YV+sTdB/+prbALX3zK8u8vEnqWCLY8Pc2fEsWW7JKdWPdafp4SqG/Z1tzo= 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=Fj+jo9AR; arc=none smtp.client-ip=209.85.221.45 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="Fj+jo9AR" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-385eed29d17so2451047f8f.0 for ; Tue, 24 Dec 2024 02:44:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735037081; x=1735641881; 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=Fj+jo9AR56Ge6LtIX4cQQPclPJphfaJSE3CgAURjchgW4dgpbfMi7P0XJq7CBiGPpL Le5t6AfOLtBndvCCblsP9xceK4niIvaBXe2/MUEKiteNXewfNpRHrQXBpUJMeG0RckU+ 7GzxWekImDqRqo6XV/oPgjFEKCgKP0X5atxdHqHD2nHNBdEo3wvIV0LJ4HndjtCfzqxP bS/0vie2oblVpKXeQ7yrwqPLduKr7GEDwT03vdrK+XryenEUz2CCUpJF+dwZCxBVGC7G 57jYN07X6xROOgBOYdpsqQFc0OsZDKkMDX1Kthxj096V7nnb8djJh87RPY9p3QhA2OnE zGxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735037082; x=1735641882; 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=owiqi7UJbn8gZg3Vrlq8pjXLxxLx0T8eSsxRPq48vQnUbANpn2oNbrHqq6BH6tqXDn Exq6UmGDF6iL8c36yh8fdVqudu9PHdJ7g3Tbw3XPLDkLDgDrhBfEwv1+4Kzq9RXM+XU9 +xKpPkC9qEliV+jH60daIs6wqY17QBSIX2EUbeWaJfZ35tPM+DQVObEXwbKijiKk42al y1OXjodMolFZrWNDwPNiv+0tXDXHvBOLVmvKWoTdePJmDKIG9k37/O3zEqn1YM1qsNHl foy8CpOv7Cmvr2CCOVRSLvOuaXU1x6iFI1XESGO+dvpN42v0WhNC+0B+ai2bWMiW0HPb qqjA== X-Forwarded-Encrypted: i=1; AJvYcCVyt6G5IpFsJPwQ8p+7Bxip/3dc3Z2JYVbJ3cPMBjgwHWA1VQXsIT5Q7XO1ixeZW2/XsvXTGxgif7EAJm8=@vger.kernel.org X-Gm-Message-State: AOJu0YxBHj1jQIa7+DQqMLGBJE6y0Q/MIZEotcB89j+DpXQES1jhI0XE qP3GcrY+LsDE5aGeWedSktsSRB1c2uGueoLHj8cSflUR6AKzzSKRHAvJXJoS+Yg= X-Gm-Gg: ASbGnctCpk4Qk7V6YpLF3Vb7GkUGcaJw6fN50cV8VHo0MD6VTCVD0oYD15nhH4rYu1V 1cpWAW25Pkb+VU/kDaU0Mo2tDWw/UW7NKoRSSErV3tW/EHMj0N/8QvytTRnl0kGmyZsJVBmM81T HUAHWow1QC8hU3olcMZC/4P6bq9V4PWOMui/7yV6LZOLxlYADbpi1dv65DtCc0WAhxLToDROaKS 8GAocNwQC6hQXi4NepGp8t5GCjCG9+9f+xJCHW2oftkoYWk2jhzO0I= X-Google-Smtp-Source: AGHT+IEPwGkn3TrrCW7UYR3VV36eBnjzsw1wNAbjqFQScWTBytZf17+BoI5sSqfPq7qT3qahHgFAcw== X-Received: by 2002:a05:6000:184e:b0:385:ed1e:2105 with SMTP id ffacd0b85a97d-38a221f2f0cmr14225299f8f.26.1735037081570; Tue, 24 Dec 2024 02:44:41 -0800 (PST) Received: from pop-os.. ([145.224.66.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c847714sm13938184f8f.54.2024.12.24.02.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 02:44:41 -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 Cc: robh@kernel.org, James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , John Garry , Mike Leach , Leo Yan , Graham Woodward , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 2/5] perf tool: arm-spe: Pull out functions for aux buffer and tracking setup Date: Tue, 24 Dec 2024 10:44:09 +0000 Message-Id: <20241224104414.179365-3-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241224104414.179365-1-james.clark@linaro.org> References: <20241224104414.179365-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/u= til/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, s= truct perf_cpu_map *cpus) evsel__set_sample_bit(evsel, PHYS_ADDR); } =20 -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 =3D - container_of(itr, struct arm_spe_recording, itr); - struct evsel *evsel, *tmp; - struct perf_cpu_map *cpus =3D evlist->core.user_requested_cpus; bool privileged =3D perf_event_paranoid_check(-1); - struct evsel *tracking_evsel; - int err; - - sper->evlist =3D 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 =3D true; - } - } - - if (!opts->full_auxtrace) - return 0; =20 /* * we are in snapshot mode. @@ -330,6 +306,9 @@ static int arm_spe_recording_options(struct auxtrace_re= cord *itr, pr_err("Failed to calculate default snapshot size and/or AUX area traci= ng mmap pages\n"); return -EINVAL; } + + pr_debug2("%sx snapshot size: %zu\n", ARM_SPE_PMU_NAME, + opts->auxtrace_snapshot_size); } =20 /* 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, } } =20 - if (opts->auxtrace_snapshot_mode) - pr_debug2("%sx snapshot size: %zu\n", ARM_SPE_PMU_NAME, - opts->auxtrace_snapshot_size); + return 0; +} =20 - 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 =3D evlist->core.user_requested_cpus; =20 /* Add dummy event to keep tracking */ err =3D parse_event(evlist, "dummy:u"); @@ -388,6 +368,45 @@ static int arm_spe_recording_options(struct auxtrace_r= ecord *itr, return 0; } =20 +static int arm_spe_recording_options(struct auxtrace_record *itr, + struct evlist *evlist, + struct record_opts *opts) +{ + struct arm_spe_recording *sper =3D + container_of(itr, struct arm_spe_recording, itr); + struct evsel *evsel, *tmp; + struct perf_cpu_map *cpus =3D evlist->core.user_requested_cpus; + + int err; + + sper->evlist =3D 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 =3D 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 =3D 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 __ma= ybe_unused, struct record_opts *opts, const char *str) --=20 2.34.1