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 <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Mike Leach <[email protected]> Cc: Leo Yan <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 7c2cc5e commit adf35d0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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)