Re: [PATCH V1 09/23] perf auxtrace: Record whether an auxtrace mmap is needed

From: Ian Rogers
Date: Thu May 05 2022 - 19:29:18 EST


On Thu, May 5, 2022 at 9:57 AM Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote:
>
> Add a flag needs_auxtrace_mmap to record whether an auxtrace mmap is
> needed, in preparation for correctly determining whether or not an
> auxtrace mmap is needed.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>

Acked-by: Ian Rogers <irogers@xxxxxxxxxx>

Thanks,
Ian

> ---
> tools/perf/arch/arm/util/cs-etm.c | 1 +
> tools/perf/arch/arm64/util/arm-spe.c | 1 +
> tools/perf/arch/s390/util/auxtrace.c | 1 +
> tools/perf/arch/x86/util/intel-bts.c | 1 +
> tools/perf/arch/x86/util/intel-pt.c | 1 +
> tools/perf/util/evsel.h | 1 +
> 6 files changed, 6 insertions(+)
>
> diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
> index 11c71aa219f7..1b54638d53b0 100644
> --- a/tools/perf/arch/arm/util/cs-etm.c
> +++ b/tools/perf/arch/arm/util/cs-etm.c
> @@ -319,6 +319,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
> }
> evsel->core.attr.freq = 0;
> evsel->core.attr.sample_period = 1;
> + evsel->needs_auxtrace_mmap = true;
> cs_etm_evsel = evsel;
> opts->full_auxtrace = true;
> }
> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
> index e8b577d33e53..6f4db2ac5420 100644
> --- a/tools/perf/arch/arm64/util/arm-spe.c
> +++ b/tools/perf/arch/arm64/util/arm-spe.c
> @@ -160,6 +160,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
> }
> evsel->core.attr.freq = 0;
> evsel->core.attr.sample_period = arm_spe_pmu->default_config->sample_period;
> + evsel->needs_auxtrace_mmap = true;
> arm_spe_evsel = evsel;
> opts->full_auxtrace = true;
> }
> diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c
> index 0db5c58c98e8..5068baa3e092 100644
> --- a/tools/perf/arch/s390/util/auxtrace.c
> +++ b/tools/perf/arch/s390/util/auxtrace.c
> @@ -98,6 +98,7 @@ struct auxtrace_record *auxtrace_record__init(struct evlist *evlist,
> evlist__for_each_entry(evlist, pos) {
> if (pos->core.attr.config == PERF_EVENT_CPUM_SF_DIAG) {
> diagnose = 1;
> + pos->needs_auxtrace_mmap = true;
> break;
> }
> }
> diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
> index d68a0f48e41e..bcccfbade5c6 100644
> --- a/tools/perf/arch/x86/util/intel-bts.c
> +++ b/tools/perf/arch/x86/util/intel-bts.c
> @@ -129,6 +129,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr,
> }
> evsel->core.attr.freq = 0;
> evsel->core.attr.sample_period = 1;
> + evsel->needs_auxtrace_mmap = true;
> intel_bts_evsel = evsel;
> opts->full_auxtrace = true;
> }
> diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
> index 38ec2666ec12..2eaac4638aab 100644
> --- a/tools/perf/arch/x86/util/intel-pt.c
> +++ b/tools/perf/arch/x86/util/intel-pt.c
> @@ -649,6 +649,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
> evsel->core.attr.freq = 0;
> evsel->core.attr.sample_period = 1;
> evsel->no_aux_samples = true;
> + evsel->needs_auxtrace_mmap = true;
> intel_pt_evsel = evsel;
> opts->full_auxtrace = true;
> }
> diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
> index 45d674812239..544fbed98df1 100644
> --- a/tools/perf/util/evsel.h
> +++ b/tools/perf/util/evsel.h
> @@ -124,6 +124,7 @@ struct evsel {
> bool merged_stat;
> bool reset_group;
> bool errored;
> + bool needs_auxtrace_mmap;
> struct hashmap *per_pkg_mask;
> int err;
> struct {
> --
> 2.25.1
>