[ Sasha's backport helper bot ] Hi, The upstream commit SHA1 provided is correct: 5b590160d2cf776b304eb054afafea2bd55e3620 Status in newer kernel trees: 6.12.y | Present (different SHA1: bd0081617661) 6.11.y | Present (different SHA1: 549225e02e9b) 6.6.y | Present (different SHA1: 1488d93e3e1f) 6.1.y | Present (different SHA1: bda8868213ee) 5.15.y | Present (different SHA1: 1b843f820f7a) 5.10.y | Present (different SHA1: b243226da582) 5.4.y | Not found Note: The patch differs from the upstream commit: --- 1: 5b590160d2cf7 ! 1: 907198d6c6223 perf/x86/intel/pt: Fix buffer full but size is 0 case @@ Metadata ## Commit message ## perf/x86/intel/pt: Fix buffer full but size is 0 case + commit 5b590160d2cf776b304eb054afafea2bd55e3620 upstream. + If the trace data buffer becomes full, a truncated flag [T] is reported in PERF_RECORD_AUX. In some cases, the size reported is 0, even though data must have been added to make the buffer full. @@ Commit message Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Link: https://lkml.kernel.org/r/20241022155920.17511-2-adrian.hunter@xxxxxxxxx + Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> ## arch/x86/events/intel/pt.c ## @@ arch/x86/events/intel/pt.c: static void pt_buffer_advance(struct pt_buffer *buf) @@ arch/x86/events/intel/pt.c: static void pt_buffer_advance(struct pt_buffer *buf) + buf->wrapped = false; + - if (buf->single) { - local_set(&buf->data_size, buf->output_off); - return; + /* offset of the first region in this table from the beginning of buf */ + base = buf->cur->offset + buf->output_off; + @@ arch/x86/events/intel/pt.c: static void pt_update_head(struct pt *pt) } else { old = (local64_xchg(&buf->head, base) & @@ arch/x86/events/intel/pt.c: static void pt_update_head(struct pt *pt) ## arch/x86/events/intel/pt.h ## @@ arch/x86/events/intel/pt.h: struct pt_pmu { + * @lost: if data was lost/truncated * @head: logical write offset inside the buffer * @snapshot: if this is for a snapshot/overwrite counter - * @single: use Single Range Output instead of ToPA + * @wrapped: buffer advance wrapped back to the first topa table * @stop_pos: STOP topa entry index * @intr_pos: INT topa entry index * @stop_te: STOP topa entry pointer @@ arch/x86/events/intel/pt.h: struct pt_buffer { + local_t data_size; local64_t head; bool snapshot; - bool single; + bool wrapped; long stop_pos, intr_pos; struct topa_entry *stop_te, *intr_te; --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.4.y | Success | Success |