Skip to content

Commit adf35d0

Browse files
Suzuki K Poulosemathieupoirier
authored andcommitted
coresight: trbe: Make sure we have enough space
The TRBE driver makes sure that there is enough space for a meaningful run, otherwise pads the given space and restarts the offset calculation once. But there is no guarantee that we may find space or hit "no space". Make sure that we repeat the step until, either : - We have the minimum space OR - There is NO space at all. Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Leo Yan <leo.yan@linaro.org> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20211019163153.3692640-13-suzuki.poulose@arm.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent 7c2cc5e commit adf35d0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/hwtracing/coresight/coresight-trbe.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,14 @@ static unsigned long trbe_normal_offset(struct perf_output_handle *handle)
477477
* If the head is too close to the limit and we don't
478478
* have space for a meaningful run, we rather pad it
479479
* and start fresh.
480+
*
481+
* We might have to do this more than once to make sure
482+
* we have enough required space.
480483
*/
481-
if (limit && ((limit - head) < trbe_min_trace_buf_size(handle))) {
484+
while (limit && ((limit - head) < trbe_min_trace_buf_size(handle))) {
482485
trbe_pad_buf(handle, limit - head);
483486
limit = __trbe_normal_offset(handle);
487+
head = PERF_IDX2OFF(handle->head, buf);
484488
}
485489
return limit;
486490
}

0 commit comments

Comments
 (0)