Skip to content

Commit 23a65c5

Browse files
james-c-linaroacmel
authored andcommitted
perf tools arm-spe: Pull out functions for aux buffer and tracking setup
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 <[email protected]> Signed-off-by: James Clark <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Graham Woodward <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rob Herring <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Veronika Molnarova <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent ac0ac75 commit 23a65c5

File tree

1 file changed

+51
-32
lines changed

1 file changed

+51
-32
lines changed

tools/perf/arch/arm64/util/arm-spe.c

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -274,33 +274,9 @@ static void arm_spe_setup_evsel(struct evsel *evsel, struct perf_cpu_map *cpus)
274274
evsel__set_sample_bit(evsel, PHYS_ADDR);
275275
}
276276

277-
static int arm_spe_recording_options(struct auxtrace_record *itr,
278-
struct evlist *evlist,
279-
struct record_opts *opts)
277+
static int arm_spe_setup_aux_buffer(struct record_opts *opts)
280278
{
281-
struct arm_spe_recording *sper =
282-
container_of(itr, struct arm_spe_recording, itr);
283-
struct evsel *evsel, *tmp;
284-
struct perf_cpu_map *cpus = evlist->core.user_requested_cpus;
285279
bool privileged = perf_event_paranoid_check(-1);
286-
struct evsel *tracking_evsel;
287-
int err;
288-
289-
sper->evlist = evlist;
290-
291-
evlist__for_each_entry(evlist, evsel) {
292-
if (evsel__is_aux_event(evsel)) {
293-
if (!strstarts(evsel->pmu->name, ARM_SPE_PMU_NAME)) {
294-
pr_err("Found unexpected auxtrace event: %s\n",
295-
evsel->pmu->name);
296-
return -EINVAL;
297-
}
298-
opts->full_auxtrace = true;
299-
}
300-
}
301-
302-
if (!opts->full_auxtrace)
303-
return 0;
304280

305281
/*
306282
* we are in snapshot mode.
@@ -330,6 +306,9 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
330306
pr_err("Failed to calculate default snapshot size and/or AUX area tracing mmap pages\n");
331307
return -EINVAL;
332308
}
309+
310+
pr_debug2("%sx snapshot size: %zu\n", ARM_SPE_PMU_NAME,
311+
opts->auxtrace_snapshot_size);
333312
}
334313

335314
/* 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,
355334
}
356335
}
357336

358-
if (opts->auxtrace_snapshot_mode)
359-
pr_debug2("%sx snapshot size: %zu\n", ARM_SPE_PMU_NAME,
360-
opts->auxtrace_snapshot_size);
337+
return 0;
338+
}
361339

362-
evlist__for_each_entry_safe(evlist, tmp, evsel) {
363-
if (evsel__is_aux_event(evsel))
364-
arm_spe_setup_evsel(evsel, cpus);
365-
}
340+
static int arm_spe_setup_tracking_event(struct evlist *evlist,
341+
struct record_opts *opts)
342+
{
343+
int err;
344+
struct evsel *tracking_evsel;
345+
struct perf_cpu_map *cpus = evlist->core.user_requested_cpus;
366346

367347
/* Add dummy event to keep tracking */
368348
err = parse_event(evlist, "dummy:u");
@@ -388,6 +368,45 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
388368
return 0;
389369
}
390370

371+
static int arm_spe_recording_options(struct auxtrace_record *itr,
372+
struct evlist *evlist,
373+
struct record_opts *opts)
374+
{
375+
struct arm_spe_recording *sper =
376+
container_of(itr, struct arm_spe_recording, itr);
377+
struct evsel *evsel, *tmp;
378+
struct perf_cpu_map *cpus = evlist->core.user_requested_cpus;
379+
380+
int err;
381+
382+
sper->evlist = evlist;
383+
384+
evlist__for_each_entry(evlist, evsel) {
385+
if (evsel__is_aux_event(evsel)) {
386+
if (!strstarts(evsel->pmu->name, ARM_SPE_PMU_NAME)) {
387+
pr_err("Found unexpected auxtrace event: %s\n",
388+
evsel->pmu->name);
389+
return -EINVAL;
390+
}
391+
opts->full_auxtrace = true;
392+
}
393+
}
394+
395+
if (!opts->full_auxtrace)
396+
return 0;
397+
398+
evlist__for_each_entry_safe(evlist, tmp, evsel) {
399+
if (evsel__is_aux_event(evsel))
400+
arm_spe_setup_evsel(evsel, cpus);
401+
}
402+
403+
err = arm_spe_setup_aux_buffer(opts);
404+
if (err)
405+
return err;
406+
407+
return arm_spe_setup_tracking_event(evlist, opts);
408+
}
409+
391410
static int arm_spe_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused,
392411
struct record_opts *opts,
393412
const char *str)

0 commit comments

Comments
 (0)