Commit 77c123f5 authored by James Clark's avatar James Clark Committed by Arnaldo Carvalho de Melo

perf: cs-etm: Move traceid_list to each queue

The global list won't work for per-sink trace ID allocations, so put a
list in each queue where the IDs will be unique to that queue.

To keep the same behavior as before, for version 0 of the HW_ID packets,
copy all the HW_ID mappings into all queues.

This change doesn't effect the decoders, only trace ID lookups on the
Perf side. The decoders are still created with global mappings which
will be fixed in a later commit.
Reviewed-by: default avatarMike Leach <mike.leach@linaro.org>
Signed-off-by: default avatarJames Clark <james.clark@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.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: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
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>
Link: https://lore.kernel.org/r/20240722101202.26915-4-james.clark@linaro.orgSigned-off-by: default avatarJames Clark <james.clark@linaro.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 57880a79
...@@ -388,7 +388,8 @@ cs_etm_decoder__reset_timestamp(struct cs_etm_packet_queue *packet_queue) ...@@ -388,7 +388,8 @@ cs_etm_decoder__reset_timestamp(struct cs_etm_packet_queue *packet_queue)
} }
static ocsd_datapath_resp_t static ocsd_datapath_resp_t
cs_etm_decoder__buffer_packet(struct cs_etm_packet_queue *packet_queue, cs_etm_decoder__buffer_packet(struct cs_etm_queue *etmq,
struct cs_etm_packet_queue *packet_queue,
const u8 trace_chan_id, const u8 trace_chan_id,
enum cs_etm_sample_type sample_type) enum cs_etm_sample_type sample_type)
{ {
...@@ -398,7 +399,7 @@ cs_etm_decoder__buffer_packet(struct cs_etm_packet_queue *packet_queue, ...@@ -398,7 +399,7 @@ cs_etm_decoder__buffer_packet(struct cs_etm_packet_queue *packet_queue,
if (packet_queue->packet_count >= CS_ETM_PACKET_MAX_BUFFER - 1) if (packet_queue->packet_count >= CS_ETM_PACKET_MAX_BUFFER - 1)
return OCSD_RESP_FATAL_SYS_ERR; return OCSD_RESP_FATAL_SYS_ERR;
if (cs_etm__get_cpu(trace_chan_id, &cpu) < 0) if (cs_etm__get_cpu(etmq, trace_chan_id, &cpu) < 0)
return OCSD_RESP_FATAL_SYS_ERR; return OCSD_RESP_FATAL_SYS_ERR;
et = packet_queue->tail; et = packet_queue->tail;
...@@ -436,7 +437,7 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq, ...@@ -436,7 +437,7 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq,
int ret = 0; int ret = 0;
struct cs_etm_packet *packet; struct cs_etm_packet *packet;
ret = cs_etm_decoder__buffer_packet(packet_queue, trace_chan_id, ret = cs_etm_decoder__buffer_packet(etmq, packet_queue, trace_chan_id,
CS_ETM_RANGE); CS_ETM_RANGE);
if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT) if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT)
return ret; return ret;
...@@ -496,7 +497,8 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq, ...@@ -496,7 +497,8 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq,
} }
static ocsd_datapath_resp_t static ocsd_datapath_resp_t
cs_etm_decoder__buffer_discontinuity(struct cs_etm_packet_queue *queue, cs_etm_decoder__buffer_discontinuity(struct cs_etm_queue *etmq,
struct cs_etm_packet_queue *queue,
const uint8_t trace_chan_id) const uint8_t trace_chan_id)
{ {
/* /*
...@@ -504,18 +506,19 @@ cs_etm_decoder__buffer_discontinuity(struct cs_etm_packet_queue *queue, ...@@ -504,18 +506,19 @@ cs_etm_decoder__buffer_discontinuity(struct cs_etm_packet_queue *queue,
* reset time statistics. * reset time statistics.
*/ */
cs_etm_decoder__reset_timestamp(queue); cs_etm_decoder__reset_timestamp(queue);
return cs_etm_decoder__buffer_packet(queue, trace_chan_id, return cs_etm_decoder__buffer_packet(etmq, queue, trace_chan_id,
CS_ETM_DISCONTINUITY); CS_ETM_DISCONTINUITY);
} }
static ocsd_datapath_resp_t static ocsd_datapath_resp_t
cs_etm_decoder__buffer_exception(struct cs_etm_packet_queue *queue, cs_etm_decoder__buffer_exception(struct cs_etm_queue *etmq,
struct cs_etm_packet_queue *queue,
const ocsd_generic_trace_elem *elem, const ocsd_generic_trace_elem *elem,
const uint8_t trace_chan_id) const uint8_t trace_chan_id)
{ int ret = 0; { int ret = 0;
struct cs_etm_packet *packet; struct cs_etm_packet *packet;
ret = cs_etm_decoder__buffer_packet(queue, trace_chan_id, ret = cs_etm_decoder__buffer_packet(etmq, queue, trace_chan_id,
CS_ETM_EXCEPTION); CS_ETM_EXCEPTION);
if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT) if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT)
return ret; return ret;
...@@ -527,10 +530,11 @@ cs_etm_decoder__buffer_exception(struct cs_etm_packet_queue *queue, ...@@ -527,10 +530,11 @@ cs_etm_decoder__buffer_exception(struct cs_etm_packet_queue *queue,
} }
static ocsd_datapath_resp_t static ocsd_datapath_resp_t
cs_etm_decoder__buffer_exception_ret(struct cs_etm_packet_queue *queue, cs_etm_decoder__buffer_exception_ret(struct cs_etm_queue *etmq,
struct cs_etm_packet_queue *queue,
const uint8_t trace_chan_id) const uint8_t trace_chan_id)
{ {
return cs_etm_decoder__buffer_packet(queue, trace_chan_id, return cs_etm_decoder__buffer_packet(etmq, queue, trace_chan_id,
CS_ETM_EXCEPTION_RET); CS_ETM_EXCEPTION_RET);
} }
...@@ -599,7 +603,7 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( ...@@ -599,7 +603,7 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
case OCSD_GEN_TRC_ELEM_EO_TRACE: case OCSD_GEN_TRC_ELEM_EO_TRACE:
case OCSD_GEN_TRC_ELEM_NO_SYNC: case OCSD_GEN_TRC_ELEM_NO_SYNC:
case OCSD_GEN_TRC_ELEM_TRACE_ON: case OCSD_GEN_TRC_ELEM_TRACE_ON:
resp = cs_etm_decoder__buffer_discontinuity(packet_queue, resp = cs_etm_decoder__buffer_discontinuity(etmq, packet_queue,
trace_chan_id); trace_chan_id);
break; break;
case OCSD_GEN_TRC_ELEM_INSTR_RANGE: case OCSD_GEN_TRC_ELEM_INSTR_RANGE:
...@@ -607,11 +611,11 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( ...@@ -607,11 +611,11 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
trace_chan_id); trace_chan_id);
break; break;
case OCSD_GEN_TRC_ELEM_EXCEPTION: case OCSD_GEN_TRC_ELEM_EXCEPTION:
resp = cs_etm_decoder__buffer_exception(packet_queue, elem, resp = cs_etm_decoder__buffer_exception(etmq, packet_queue, elem,
trace_chan_id); trace_chan_id);
break; break;
case OCSD_GEN_TRC_ELEM_EXCEPTION_RET: case OCSD_GEN_TRC_ELEM_EXCEPTION_RET:
resp = cs_etm_decoder__buffer_exception_ret(packet_queue, resp = cs_etm_decoder__buffer_exception_ret(etmq, packet_queue,
trace_chan_id); trace_chan_id);
break; break;
case OCSD_GEN_TRC_ELEM_TIMESTAMP: case OCSD_GEN_TRC_ELEM_TIMESTAMP:
......
This diff is collapsed.
...@@ -252,7 +252,7 @@ enum cs_etm_pid_fmt { ...@@ -252,7 +252,7 @@ enum cs_etm_pid_fmt {
#ifdef HAVE_CSTRACE_SUPPORT #ifdef HAVE_CSTRACE_SUPPORT
#include <opencsd/ocsd_if_types.h> #include <opencsd/ocsd_if_types.h>
int cs_etm__get_cpu(u8 trace_chan_id, int *cpu); int cs_etm__get_cpu(struct cs_etm_queue *etmq, u8 trace_chan_id, int *cpu);
enum cs_etm_pid_fmt cs_etm__get_pid_fmt(struct cs_etm_queue *etmq); enum cs_etm_pid_fmt cs_etm__get_pid_fmt(struct cs_etm_queue *etmq);
int cs_etm__etmq_set_tid_el(struct cs_etm_queue *etmq, pid_t tid, int cs_etm__etmq_set_tid_el(struct cs_etm_queue *etmq, pid_t tid,
u8 trace_chan_id, ocsd_ex_level el); u8 trace_chan_id, ocsd_ex_level el);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment