5.15-stable review patch. If anyone has any objections, please let me know. ------------------ This reverts commit df034692b739f56c3b7d49687816f0c6b8e70113. Signed-off-by: Sasha Levin --- tools/perf/util/cs-etm.c | 46 +++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 20492e58792d6..be5a2e2d226d8 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -1089,7 +1089,8 @@ cs_etm__get_trace(struct cs_etm_queue *etmq) etmq->buf_used = 0; etmq->buf_len = aux_buffer->size; etmq->buf = aux_buffer->data; - return 0; + + return etmq->buf_len; } static void cs_etm__set_pid_tid_cpu(struct cs_etm_auxtrace *etm, @@ -1686,33 +1687,26 @@ static int cs_etm__get_data_block(struct cs_etm_queue *etmq) { int ret; - /* The current block is not finished */ - if (etmq->buf_len) - return 1; - - ret = cs_etm__get_trace(etmq); - if (ret < 0) - return ret; - - /* No more buffer to read */ - if (!etmq->buf_len) - return 0; - - /* - * We cannot assume consecutive blocks in the data file - * are contiguous, reset the decoder to force re-sync. - */ - ret = cs_etm_decoder__reset(etmq->decoder); - if (ret) - return ret; + if (!etmq->buf_len) { + ret = cs_etm__get_trace(etmq); + if (ret <= 0) + return ret; + /* + * We cannot assume consecutive blocks in the data file + * are contiguous, reset the decoder to force re-sync. + */ + ret = cs_etm_decoder__reset(etmq->decoder); + if (ret) + return ret; - /* - * Since the decoder is reset, this causes a global trace - * discontinuity. Flush all thread stacks. - */ - cs_etm__flush_all_stack(etmq); + /* + * Since the decoder is reset, this causes a global trace + * discontinuity. Flush all thread stacks. + */ + cs_etm__flush_all_stack(etmq); + } - return 1; + return etmq->buf_len; } static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq, u8 trace_chan_id, -- 2.53.0