Commit 3c21d7d8 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Arnaldo Carvalho de Melo

perf cs-etm: Move thread to traceid_queue

The thread field of structure cs_etm_queue is CPU dependent and as such
need to be part of the cs_etm_traceid_queue in order to support CPU-wide
trace scenarios.
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190524173508.29044-12-mathieu.poirier@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 66725593
...@@ -65,6 +65,7 @@ struct cs_etm_traceid_queue { ...@@ -65,6 +65,7 @@ struct cs_etm_traceid_queue {
u64 period_instructions; u64 period_instructions;
size_t last_branch_pos; size_t last_branch_pos;
union perf_event *event_buf; union perf_event *event_buf;
struct thread *thread;
struct branch_stack *last_branch; struct branch_stack *last_branch;
struct branch_stack *last_branch_rb; struct branch_stack *last_branch_rb;
struct cs_etm_packet *prev_packet; struct cs_etm_packet *prev_packet;
...@@ -74,7 +75,6 @@ struct cs_etm_traceid_queue { ...@@ -74,7 +75,6 @@ struct cs_etm_traceid_queue {
struct cs_etm_queue { struct cs_etm_queue {
struct cs_etm_auxtrace *etm; struct cs_etm_auxtrace *etm;
struct thread *thread;
struct cs_etm_decoder *decoder; struct cs_etm_decoder *decoder;
struct auxtrace_buffer *buffer; struct auxtrace_buffer *buffer;
unsigned int queue_nr; unsigned int queue_nr;
...@@ -415,7 +415,7 @@ static void cs_etm__free_queue(void *priv) ...@@ -415,7 +415,7 @@ static void cs_etm__free_queue(void *priv)
if (!etmq) if (!etmq)
return; return;
thread__zput(etmq->thread); thread__zput(etmq->traceid_queues->thread);
cs_etm_decoder__free(etmq->decoder); cs_etm_decoder__free(etmq->decoder);
zfree(&etmq->traceid_queues->event_buf); zfree(&etmq->traceid_queues->event_buf);
zfree(&etmq->traceid_queues->last_branch); zfree(&etmq->traceid_queues->last_branch);
...@@ -503,7 +503,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address, ...@@ -503,7 +503,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address,
machine = etmq->etm->machine; machine = etmq->etm->machine;
cpumode = cs_etm__cpu_mode(etmq, address); cpumode = cs_etm__cpu_mode(etmq, address);
thread = etmq->thread; thread = etmq->traceid_queues->thread;
if (!thread) { if (!thread) {
if (cpumode != PERF_RECORD_MISC_KERNEL) if (cpumode != PERF_RECORD_MISC_KERNEL)
return 0; return 0;
...@@ -819,18 +819,21 @@ cs_etm__get_trace(struct cs_etm_queue *etmq) ...@@ -819,18 +819,21 @@ cs_etm__get_trace(struct cs_etm_queue *etmq)
static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm, static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm,
struct auxtrace_queue *queue) struct auxtrace_queue *queue)
{ {
struct cs_etm_traceid_queue *tidq;
struct cs_etm_queue *etmq = queue->priv; struct cs_etm_queue *etmq = queue->priv;
tidq = cs_etm__etmq_get_traceid_queue(etmq, CS_ETM_PER_THREAD_TRACEID);
/* CPU-wide tracing isn't supported yet */ /* CPU-wide tracing isn't supported yet */
if (queue->tid == -1) if (queue->tid == -1)
return; return;
if ((!etmq->thread) && (etmq->tid != -1)) if ((!tidq->thread) && (etmq->tid != -1))
etmq->thread = machine__find_thread(etm->machine, -1, tidq->thread = machine__find_thread(etm->machine, -1,
etmq->tid); etmq->tid);
if (etmq->thread) if (tidq->thread)
etmq->pid = etmq->thread->pid_; etmq->pid = tidq->thread->pid_;
} }
static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq,
......
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