[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210111131205.GB222747@leoy-ThinkPad-X240s>
Date: Mon, 11 Jan 2021 21:12:05 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Suzuki K Poulose <suzuki.poulose@....com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Mike Leach <mike.leach@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Daniel Kiss <Daniel.Kiss@....com>,
Denis Nikitin <denik@...omium.org>, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 4/7] perf cs-etm: Add PID format into metadata
On Mon, Jan 11, 2021 at 09:45:12AM +0000, Suzuki Kuruppassery Poulose wrote:
> Hi Leo,
>
> On 1/9/21 7:44 AM, Leo Yan wrote:
> > It's possible for CoreSight to trace PID in either CONTEXTIDR_EL1 or
> > CONTEXTIDR_EL2, the PID format info is used to distinguish the PID
> > is traced in which register.
> >
> > This patch saves PID format into the metadata when record.
>
> The patch looks good to me. One minor suggestion below
>
> >
> > Signed-off-by: Leo Yan <leo.yan@...aro.org>
> > ---
> > tools/perf/arch/arm/util/cs-etm.c | 21 +++++++++++++++++++++
> > tools/perf/util/cs-etm.c | 2 ++
> > tools/perf/util/cs-etm.h | 2 ++
> > 3 files changed, 25 insertions(+)
> >
> > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
> > index fad7b6e13ccc..ee78df3b1b07 100644
> > --- a/tools/perf/arch/arm/util/cs-etm.c
> > +++ b/tools/perf/arch/arm/util/cs-etm.c
> > @@ -613,6 +613,7 @@ static void cs_etm_get_metadata(int cpu, u32 *offset,
> > struct cs_etm_recording *ptr =
> > container_of(itr, struct cs_etm_recording, itr);
> > struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu;
> > + u64 pid_fmt;
> > /* first see what kind of tracer this cpu is affined to */
> > if (cs_etm_is_etmv4(itr, cpu)) {
> > @@ -641,6 +642,16 @@ static void cs_etm_get_metadata(int cpu, u32 *offset,
> > metadata_etmv4_ro
> > [CS_ETMV4_TRCAUTHSTATUS]);
> > + /*
> > + * The PID format will be used when decode the trace data;
> > + * based on it the decoder will make decision for setting
> > + * sample's PID as context_id or VMID.
> > + */
> > + pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid");
> > + if (!pid_fmt)
> > + pid_fmt = 1ULL << ETM_OPT_CTXTID;
> > + info->priv[*offset + CS_ETMV4_PID_FMT] = pid_fmt;
> > +
>
> Given we do this same step twice here in this function and also in patch 2.
> I am wondering if this could be made into a small helper function ?
>
> static u64 cs_etm_pmu_format_pid(cs_etm_pm)
> {
> pid_fmt = perf_pmu__format_bits(&cs_etm_pmu->format, "pid");
> /*
> * An older kernel doesn't expose this, so fall back to using
> * CTXTID.
> */
> if (!pid_fmt)
> pid_fmt = 1ULL << ETM_OPT_CTXTID;
> return pid_fmt;
> }
Agreed; will follow up this suggestion.
Thanks,
Leo
Powered by blists - more mailing lists