Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf cs-etm: Don't test full_auxtrace because it's always set

There is no path in cs-etm where this isn't true so it doesn't need to
be tested. Also re-order the beginning of cs_etm_recording_options() so
that nothing is done until the early exit is passed.

Signed-off-by: James Clark <james.clark@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Denis Nikitin <denik@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yang Shi <shy828301@gmail.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230424134748.228137-4-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

James Clark and committed by
Arnaldo Carvalho de Melo
3963d84b 6593f019

+24 -30
+24 -30
tools/perf/arch/arm/util/cs-etm.c
··· 319 319 bool privileged = perf_event_paranoid_check(-1); 320 320 int err = 0; 321 321 322 - ptr->evlist = evlist; 323 - ptr->snapshot_mode = opts->auxtrace_snapshot_mode; 324 - 325 - if (!record_opts__no_switch_events(opts) && 326 - perf_can_record_switch_events()) 327 - opts->record_switch_events = true; 328 - 329 322 evlist__for_each_entry(evlist, evsel) { 330 323 if (evsel->core.attr.type == cs_etm_pmu->type) { 331 324 if (cs_etm_evsel) { ··· 326 333 CORESIGHT_ETM_PMU_NAME); 327 334 return -EINVAL; 328 335 } 329 - evsel->core.attr.freq = 0; 330 - evsel->core.attr.sample_period = 1; 331 - evsel->needs_auxtrace_mmap = true; 332 336 cs_etm_evsel = evsel; 333 - opts->full_auxtrace = true; 334 337 } 335 338 } 336 339 337 340 /* no need to continue if at least one event of interest was found */ 338 341 if (!cs_etm_evsel) 339 342 return 0; 343 + 344 + ptr->evlist = evlist; 345 + ptr->snapshot_mode = opts->auxtrace_snapshot_mode; 346 + 347 + if (!record_opts__no_switch_events(opts) && 348 + perf_can_record_switch_events()) 349 + opts->record_switch_events = true; 350 + 351 + cs_etm_evsel->core.attr.freq = 0; 352 + cs_etm_evsel->core.attr.sample_period = 1; 353 + cs_etm_evsel->needs_auxtrace_mmap = true; 354 + opts->full_auxtrace = true; 340 355 341 356 ret = cs_etm_set_sink_attr(cs_etm_pmu, cs_etm_evsel); 342 357 if (ret) ··· 415 414 } 416 415 } 417 416 418 - /* We are in full trace mode but '-m,xyz' wasn't specified */ 419 - if (opts->full_auxtrace && !opts->auxtrace_mmap_pages) { 417 + /* Buffer sizes weren't specified with '-m,xyz' so give some defaults */ 418 + if (!opts->auxtrace_mmap_pages) { 420 419 if (privileged) { 421 420 opts->auxtrace_mmap_pages = MiB(4) / page_size; 422 421 } else { ··· 424 423 if (opts->mmap_pages == UINT_MAX) 425 424 opts->mmap_pages = KiB(256) / page_size; 426 425 } 427 - 428 426 } 429 427 430 428 if (opts->auxtrace_snapshot_mode) ··· 454 454 } 455 455 456 456 /* Add dummy event to keep tracking */ 457 - if (opts->full_auxtrace) { 458 - struct evsel *tracking_evsel; 457 + err = parse_event(evlist, "dummy:u"); 458 + if (err) 459 + goto out; 460 + evsel = evlist__last(evlist); 461 + evlist__set_tracking_event(evlist, evsel); 462 + evsel->core.attr.freq = 0; 463 + evsel->core.attr.sample_period = 1; 459 464 460 - err = parse_event(evlist, "dummy:u"); 461 - if (err) 462 - goto out; 463 - 464 - tracking_evsel = evlist__last(evlist); 465 - evlist__set_tracking_event(evlist, tracking_evsel); 466 - 467 - tracking_evsel->core.attr.freq = 0; 468 - tracking_evsel->core.attr.sample_period = 1; 469 - 470 - /* In per-cpu case, always need the time of mmap events etc */ 471 - if (!perf_cpu_map__empty(cpus)) 472 - evsel__set_sample_bit(tracking_evsel, TIME); 473 - } 465 + /* In per-cpu case, always need the time of mmap events etc */ 466 + if (!perf_cpu_map__empty(cpus)) 467 + evsel__set_sample_bit(evsel, TIME); 474 468 475 469 out: 476 470 return err;