Commit 4f5b3713 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Arnaldo Carvalho de Melo

perf cs-etm: Cleaning up function cs_etm__alloc_queue()

Function cs_etm__alloc_queue() should only be concerned with the allocation
of memory for the etmq and accompanying decoder.  Everything else should
be done in the calling function.
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki K Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190212171618.25355-9-mathieu.poirier@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e4aa592d
...@@ -405,8 +405,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address, ...@@ -405,8 +405,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address,
return len; return len;
} }
static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm, static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm)
unsigned int queue_nr)
{ {
struct cs_etm_decoder_params d_params; struct cs_etm_decoder_params d_params;
struct cs_etm_trace_params *t_params = NULL; struct cs_etm_trace_params *t_params = NULL;
...@@ -444,12 +443,6 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm, ...@@ -444,12 +443,6 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
if (!etmq->event_buf) if (!etmq->event_buf)
goto out_free; goto out_free;
etmq->etm = etm;
etmq->queue_nr = queue_nr;
etmq->pid = -1;
etmq->tid = -1;
etmq->cpu = -1;
/* Use metadata to fill in trace parameters for trace decoder */ /* Use metadata to fill in trace parameters for trace decoder */
t_params = zalloc(sizeof(*t_params) * etm->num_cpu); t_params = zalloc(sizeof(*t_params) * etm->num_cpu);
...@@ -479,10 +472,6 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm, ...@@ -479,10 +472,6 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
goto out_free_decoder; goto out_free_decoder;
zfree(&t_params); zfree(&t_params);
etmq->offset = 0;
etmq->period_instructions = 0;
return etmq; return etmq;
out_free_decoder: out_free_decoder:
...@@ -503,24 +492,30 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm, ...@@ -503,24 +492,30 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,
struct auxtrace_queue *queue, struct auxtrace_queue *queue,
unsigned int queue_nr) unsigned int queue_nr)
{ {
int ret = 0;
struct cs_etm_queue *etmq = queue->priv; struct cs_etm_queue *etmq = queue->priv;
if (list_empty(&queue->head) || etmq) if (list_empty(&queue->head) || etmq)
return 0; goto out;
etmq = cs_etm__alloc_queue(etm, queue_nr); etmq = cs_etm__alloc_queue(etm);
if (!etmq) if (!etmq) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
queue->priv = etmq; queue->priv = etmq;
etmq->etm = etm;
if (queue->cpu != -1) etmq->queue_nr = queue_nr;
etmq->cpu = queue->cpu; etmq->cpu = queue->cpu;
etmq->tid = queue->tid; etmq->tid = queue->tid;
etmq->pid = -1;
etmq->offset = 0;
etmq->period_instructions = 0;
return 0; out:
return ret;
} }
static int cs_etm__setup_queues(struct cs_etm_auxtrace *etm) static int cs_etm__setup_queues(struct cs_etm_auxtrace *etm)
......
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