From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Mike Leach <mike.leach@linaro.org>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: mathieu.poirier@linaro.org, peterz@infradead.org,
mingo@redhat.com, acme@kernel.org,
linux-perf-users@vger.kernel.org, leo.yan@linaro.org,
quic_jinlmao@quicinc.com
Subject: Re: [PATCH v2 12/13] coresight: events: PERF_RECORD_AUX_OUTPUT_HW_ID used for Trace ID
Date: Wed, 20 Jul 2022 10:30:14 +0100 [thread overview]
Message-ID: <312bce37-8201-e0a7-0122-77ec1ebef556@arm.com> (raw)
In-Reply-To: <20220704081149.16797-13-mike.leach@linaro.org>
On 04/07/2022 09:11, Mike Leach wrote:
> Use the perf_report_aux_output_id() call to output the CoreSight trace ID
> and associated CPU as a PERF_RECORD_AUX_OUTPUT_HW_ID record in the
> perf.data file.
>
> Signed-off-by: Mike Leach <mike.leach@linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-etm-perf.c | 10 ++++++++++
> include/linux/coresight-pmu.h | 14 ++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
> index ad3fdc07c60b..531f5d42272b 100644
> --- a/drivers/hwtracing/coresight/coresight-etm-perf.c
> +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
> @@ -4,6 +4,7 @@
> * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
> */
>
> +#include <linux/bitfield.h>
> #include <linux/coresight.h>
> #include <linux/coresight-pmu.h>
> #include <linux/cpumask.h>
> @@ -437,6 +438,7 @@ static void etm_event_start(struct perf_event *event, int flags)
> struct perf_output_handle *handle = &ctxt->handle;
> struct coresight_device *sink, *csdev = per_cpu(csdev_src, cpu);
> struct list_head *path;
> + u64 hw_id;
>
> if (!csdev)
> goto fail;
> @@ -482,6 +484,11 @@ static void etm_event_start(struct perf_event *event, int flags)
> if (source_ops(csdev)->enable(csdev, event, CS_MODE_PERF))
> goto fail_disable_path;
>
> + /* output cpu / trace ID in perf record */
> + hw_id = FIELD_PREP(CS_AUX_HW_ID_VERSION_MASK, CS_AUX_HW_ID_CURR_VERSION) |
> + FIELD_PREP(CS_AUX_HW_ID_TRACE_ID_MASK, coresight_trace_id_get_cpu_id(cpu));
> + perf_report_aux_output_id(event, hw_id);
> +
> out:
> /* Tell the perf core the event is alive */
> event->hw.state = 0;
> @@ -600,6 +607,9 @@ static void etm_event_stop(struct perf_event *event, int mode)
>
> /* Disabling the path make its elements available to other sessions */
> coresight_disable_path(path);
> +
> + /* release the trace ID we read on event start */
> + coresight_trace_id_put_cpu_id(cpu);
> }
>
> static int etm_event_add(struct perf_event *event, int mode)
> diff --git a/include/linux/coresight-pmu.h b/include/linux/coresight-pmu.h
> index 9f7ee380266b..5572d0e10822 100644
> --- a/include/linux/coresight-pmu.h
> +++ b/include/linux/coresight-pmu.h
> @@ -7,6 +7,8 @@
> #ifndef _LINUX_CORESIGHT_PMU_H
> #define _LINUX_CORESIGHT_PMU_H
>
> +#include <linux/bits.h>
> +
> #define CORESIGHT_ETM_PMU_NAME "cs_etm"
>
> /*
> @@ -38,4 +40,16 @@
> #define ETM4_CFG_BIT_RETSTK 12
> #define ETM4_CFG_BIT_VMID_OPT 15
>
> +/*
> + * Interpretation of the PERF_RECORD_AUX_OUTPUT_HW_ID payload.
> + * Used to associate a CPU with the CoreSight Trace ID.
> + * [63:16] - unused SBZ
> + * [15:08] - Trace ID
> + * [07:00] - Version
Could we please re-arrange the fields, such that it is easier to
comprehend the TraceID looking at the raw trace dump ? Also to
accommodate the future changes.
e.g,
[15:00] - Trace ID /* For future expansion, if at all */
[59:16] - RES0
[63:60] - Trace_ID_Version
I think we *might* (not sure yet) end up adding "sinkid" when we have
sink specific allocation, so that we can associate the HW_ID of an event
to the "AUXTRACE" record (i.e., trace buffer).
So if we need to do that we could:
[15:00] - Trace ID /* For future expansion, if at all */
[47:16] - Trace Pool ID( == 0 if global, == sink_id if sink based)
[59:48] - RES0
[63:60] - Trace_ID_Version == 1
Or we could adopt the above straight away.
Thoughts ?
Suzuki
> + */
> +#define CS_AUX_HW_ID_VERSION_MASK GENMASK_ULL(7, 0)
> +#define CS_AUX_HW_ID_TRACE_ID_MASK GENMASK_ULL(15, 8)
> +
> +#define CS_AUX_HW_ID_CURR_VERSION 0
> +
> #endif
next prev parent reply other threads:[~2022-07-20 9:30 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 8:11 [PATCH v2 00/13] coresight: Add new API to allocate trace source ID values Mike Leach
2022-07-04 8:11 ` [PATCH v2 01/13] coresight: trace-id: Add API to dynamically assign Trace " Mike Leach
2022-07-19 17:30 ` Suzuki K Poulose
2022-08-09 16:11 ` Mike Leach
2022-07-04 8:11 ` [PATCH v2 02/13] coresight: trace-id: update CoreSight core to use Trace ID API Mike Leach
2022-07-19 17:36 ` Suzuki K Poulose
2022-07-04 8:11 ` [PATCH v2 03/13] coresight: stm: Update STM driver " Mike Leach
2022-07-19 17:51 ` Suzuki K Poulose
2022-07-04 8:11 ` [PATCH v2 04/13] coresight: etm4x: Update ETM4 " Mike Leach
2022-07-19 21:41 ` Suzuki K Poulose
2022-07-04 8:11 ` [PATCH v2 05/13] coresight: etm3x: Update ETM3 " Mike Leach
2022-07-19 21:45 ` Suzuki K Poulose
2022-07-04 8:11 ` [PATCH v2 06/13] coresight: etmX.X: stm: Remove unused legacy source Trace ID ops Mike Leach
2022-07-19 21:47 ` Suzuki K Poulose
2022-07-04 8:11 ` [PATCH v2 07/13] coresight: perf: traceid: Add perf notifiers for Trace ID Mike Leach
2022-07-19 21:49 ` Suzuki K Poulose
2022-07-04 8:11 ` [PATCH v2 08/13] perf: cs-etm: Move mapping of Trace ID and cpu into helper function Mike Leach
2022-07-19 14:54 ` James Clark
2022-07-20 10:22 ` Mike Leach
2022-07-20 12:57 ` James Clark
2022-07-20 16:19 ` Arnaldo Carvalho de Melo
2022-07-04 8:11 ` [PATCH v2 09/13] perf: cs-etm: Update record event to use new Trace ID protocol Mike Leach
2022-07-20 14:41 ` James Clark
2022-08-09 16:13 ` Mike Leach
2022-08-09 16:19 ` Arnaldo Carvalho de Melo
2022-08-23 9:11 ` James Clark
2022-07-04 8:11 ` [PATCH v2 10/13] kernel: events: Export perf_report_aux_output_id() Mike Leach
2022-07-19 21:50 ` Suzuki K Poulose
2022-07-04 8:11 ` [PATCH v2 11/13] perf: cs-etm: Handle PERF_RECORD_AUX_OUTPUT_HW_ID packet Mike Leach
2022-07-20 16:07 ` James Clark
2022-07-21 12:38 ` Mike Leach
2022-07-22 9:30 ` James Clark
2022-07-04 8:11 ` [PATCH v2 12/13] coresight: events: PERF_RECORD_AUX_OUTPUT_HW_ID used for Trace ID Mike Leach
2022-07-20 9:30 ` Suzuki K Poulose [this message]
2022-07-20 10:53 ` Mike Leach
2022-07-04 8:11 ` [PATCH v2 13/13] coresight: trace-id: Add debug & test macros to Trace ID allocation Mike Leach
2022-07-20 9:41 ` Suzuki K Poulose
2022-07-21 10:27 ` [PATCH v2 00/13] coresight: Add new API to allocate trace source ID values James Clark
2022-07-21 13:54 ` Mike Leach
2022-07-22 12:10 ` James Clark
2022-07-25 8:19 ` Mike Leach
2022-07-26 13:53 ` James Clark
2022-07-26 14:57 ` Mike Leach
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=312bce37-8201-e0a7-0122-77ec1ebef556@arm.com \
--to=suzuki.poulose@arm.com \
--cc=acme@kernel.org \
--cc=coresight@lists.linaro.org \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=quic_jinlmao@quicinc.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
all inboxes | Powered by JetHome®