linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] perf, pt: Improve data loss
@ 2021-04-08 15:31 Alexander Shishkin
  2021-04-08 15:31 ` [PATCH 1/2] perf: Cap allocation order at aux_watermark Alexander Shishkin
  2021-04-08 15:31 ` [PATCH 2/2] perf intel-pt: Use aux_watermark Alexander Shishkin
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Shishkin @ 2021-04-08 15:31 UTC (permalink / raw)
  To: Peter Zijlstra, Arnaldo Carvalho de Melo, adrian.hunter
  Cc: Ingo Molnar, linux-kernel, Jiri Olsa, Mathieu Poirier,
	Alexander Shishkin

Hi guys,

There is a problem between the PT driver and the AUX allocator that results
in smaller buffers consisting of 2 high-order regions, which also means
only 2 possibilities of where PMI gets generated and where tracing stops.

This is not good enough for double buffering: when we get a PMI mid-buffer,
we update the ->aux_head etc and immediately start a new transaction while
observing ->aux_tail to still be zero, which makes the PT driver put a stop
bit at the end of the buffer. However quick userspace is to update the
->aux_tail, that second transaction/PERF_RECORD_AUX ends up truncated.

The proposed solution here is to set up attr.aux_watermark to a quarter of
the buffer. Unfortunately, at the moment, the PT driver is not equipped to
deal with aux_watermark that's smaller than the AUX allocation order. I
could fix this in the driver itself, but, seeing as it's the only PMU that
actually uses the 'order' from AUX allocations, I'd rather fix the
allocator instead, which is done in patch 1/2.

Patch 2/2 could be replaced by instead changing the in-kernel aux_watermark
default, but that may interfere with PMU drivers that don't ignore said
watermark / handle->wakeup (afaict, that's only arm_spe).

Alexander Shishkin (2):
  perf: Cap allocation order at aux_watermark
  perf intel-pt: Use aux_watermark

 kernel/events/ring_buffer.c         | 34 +++++++++++++++--------------
 tools/perf/arch/x86/util/intel-pt.c |  4 ++++
 2 files changed, 22 insertions(+), 16 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-14 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 15:31 [PATCH 0/2] perf, pt: Improve data loss Alexander Shishkin
2021-04-08 15:31 ` [PATCH 1/2] perf: Cap allocation order at aux_watermark Alexander Shishkin
2021-04-08 15:31 ` [PATCH 2/2] perf intel-pt: Use aux_watermark Alexander Shishkin
2021-04-14  6:00   ` Adrian Hunter
2021-04-14 15:50     ` Alexander Shishkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).