From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org,
suzuki.poulose@arm.com, mathieu.poirier@linaro.org,
darren@os.amperecomputing.com, scott@os.amperecomputing.com,
scclevenger@os.amperecomputing.com
Subject: Re: [PATCH V2] perf cs-etm: Add fix for coresight trace for any range of CPUs
Date: Fri, 28 Apr 2023 22:57:51 -0300 [thread overview]
Message-ID: <ZEx5n8MdwuV5JE2r@kernel.org> (raw)
In-Reply-To: <20230421055253.83912-1-gankulkarni@os.amperecomputing.com>
Em Thu, Apr 20, 2023 at 10:52:53PM -0700, Ganapatrao Kulkarni escreveu:
> The current implementation supports coresight trace decode for a range
> of CPUs, if the first CPU is CPU0.
>
> Perf report segfaults, if tried for sparse CPUs list and also for
> any range of CPUs(non zero first CPU).
>
> Adding a fix to perf report for any range of CPUs and for sparse list.
Can some ARM people please review this?
- Arnaldo
> Signed-off-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
> ---
>
> V2:
> Updated with review comments.
> Fixed for sparse list of CPUs also.
>
> V1:
> [1] https://lore.kernel.org/lkml/20230419172101.78638-1-gankulkarni@os.amperecomputing.com/
>
> tools/perf/util/cs-etm.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 8dd81ddd9e4e..2003717f5779 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -275,6 +275,25 @@ static int cs_etm__metadata_set_trace_id(u8 trace_chan_id, u64 *cpu_metadata)
> (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
> })
>
> +/*
> + * Get a metadata for a specific cpu from an array.
> + *
> + */
> +static u64 *get_cpu_data(struct cs_etm_auxtrace *etm, int cpu)
> +{
> + int i;
> + u64 *metadata = NULL;
> +
> + for (i = 0; i < etm->num_cpu; i++) {
> + if (etm->metadata[i][CS_ETM_CPU] == (u64)cpu) {
> + metadata = etm->metadata[i];
> + break;
> + }
> + }
> +
> + return metadata;
> +}
> +
> /*
> * Handle the PERF_RECORD_AUX_OUTPUT_HW_ID event.
> *
> @@ -344,8 +363,11 @@ static int cs_etm__process_aux_output_hw_id(struct perf_session *session,
> return 0;
> }
>
> + cpu_data = get_cpu_data(etm, cpu);
> + if (cpu_data == NULL)
> + return err;
> +
> /* not one we've seen before - lets map it */
> - cpu_data = etm->metadata[cpu];
> err = cs_etm__map_trace_id(trace_chan_id, cpu_data);
> if (err)
> return err;
> --
> 2.39.2
>
--
- Arnaldo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-29 1:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 5:52 [PATCH V2] perf cs-etm: Add fix for coresight trace for any range of CPUs Ganapatrao Kulkarni
2023-04-29 1:57 ` Arnaldo Carvalho de Melo [this message]
2023-05-03 13:31 ` Suzuki K Poulose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEx5n8MdwuV5JE2r@kernel.org \
--to=acme@kernel.org \
--cc=darren@os.amperecomputing.com \
--cc=gankulkarni@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=scclevenger@os.amperecomputing.com \
--cc=scott@os.amperecomputing.com \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).