perf/ring_buffer: Fix AUX record suppression

The following commit:

1627314fb54a33e ("perf: Suppress AUX/OVERWRITE records")

has an unintended side-effect of also suppressing all AUX records with no flags
and non-zero size, so all the regular records in the full trace mode.
This breaks some use cases for people.

Fix this by restoring "regular" AUX records.

Reported-by: Ben Gainey <Ben.Gainey@arm.com>
Tested-by: Ben Gainey <Ben.Gainey@arm.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@vger.kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: 1627314fb54a33e ("perf: Suppress AUX/OVERWRITE records")
Link: https://lkml.kernel.org/r/20190329091338.29999-1-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Alexander Shishkin and committed by
Ingo Molnar
339bc418 52a44f83

+15 -18
+15 -18
kernel/events/ring_buffer.c
··· 455 455 rb->aux_head += size; 456 456 } 457 457 458 - if (size || handle->aux_flags) { 459 - /* 460 - * Only send RECORD_AUX if we have something useful to communicate 461 - * 462 - * Note: the OVERWRITE records by themselves are not considered 463 - * useful, as they don't communicate any *new* information, 464 - * aside from the short-lived offset, that becomes history at 465 - * the next event sched-in and therefore isn't useful. 466 - * The userspace that needs to copy out AUX data in overwrite 467 - * mode should know to use user_page::aux_head for the actual 468 - * offset. So, from now on we don't output AUX records that 469 - * have *only* OVERWRITE flag set. 470 - */ 471 - 472 - if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE) 473 - perf_event_aux_event(handle->event, aux_head, size, 474 - handle->aux_flags); 475 - } 458 + /* 459 + * Only send RECORD_AUX if we have something useful to communicate 460 + * 461 + * Note: the OVERWRITE records by themselves are not considered 462 + * useful, as they don't communicate any *new* information, 463 + * aside from the short-lived offset, that becomes history at 464 + * the next event sched-in and therefore isn't useful. 465 + * The userspace that needs to copy out AUX data in overwrite 466 + * mode should know to use user_page::aux_head for the actual 467 + * offset. So, from now on we don't output AUX records that 468 + * have *only* OVERWRITE flag set. 469 + */ 470 + if (size || (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE)) 471 + perf_event_aux_event(handle->event, aux_head, size, 472 + handle->aux_flags); 476 473 477 474 rb->user_page->aux_head = rb->aux_head; 478 475 if (rb_need_aux_wakeup(rb))