Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf cs-etm: Modularize auxtrace_buffer fetch function

Making the auxtrace_buffer fetch function modular so that it can be
called from different decoding context (timeless vs. non-timeless),
avoiding to repeat code.

No change in functionality is introduced by this patch.

Signed-off-by: Mathieu 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-14-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Mathieu Poirier and committed by
Arnaldo Carvalho de Melo
8224531c 3fa0e83e

+29 -12
+29 -12
tools/perf/util/cs-etm.c
··· 1152 1152 1153 1153 return 0; 1154 1154 } 1155 + /* 1156 + * cs_etm__get_data_block: Fetch a block from the auxtrace_buffer queue 1157 + * if need be. 1158 + * Returns: < 0 if error 1159 + * = 0 if no more auxtrace_buffer to read 1160 + * > 0 if the current buffer isn't empty yet 1161 + */ 1162 + static int cs_etm__get_data_block(struct cs_etm_queue *etmq) 1163 + { 1164 + int ret; 1165 + 1166 + if (!etmq->buf_len) { 1167 + ret = cs_etm__get_trace(etmq); 1168 + if (ret <= 0) 1169 + return ret; 1170 + /* 1171 + * We cannot assume consecutive blocks in the data file 1172 + * are contiguous, reset the decoder to force re-sync. 1173 + */ 1174 + ret = cs_etm_decoder__reset(etmq->decoder); 1175 + if (ret) 1176 + return ret; 1177 + } 1178 + 1179 + return etmq->buf_len; 1180 + } 1155 1181 1156 1182 static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, 1157 1183 struct cs_etm_packet *packet, ··· 1617 1591 1618 1592 /* Go through each buffer in the queue and decode them one by one */ 1619 1593 while (1) { 1620 - if (!etmq->buf_len) { 1621 - err = cs_etm__get_trace(etmq); 1622 - if (err <= 0) 1623 - return err; 1624 - /* 1625 - * We cannot assume consecutive blocks in the data file 1626 - * are contiguous, reset the decoder to force re-sync. 1627 - */ 1628 - err = cs_etm_decoder__reset(etmq->decoder); 1629 - if (err != 0) 1630 - return err; 1631 - } 1594 + err = cs_etm__get_data_block(etmq); 1595 + if (err <= 0) 1596 + return err; 1632 1597 1633 1598 /* Run trace decoder until buffer consumed or end of trace */ 1634 1599 do {