2015-04-16 18:11:03

by Vince Weaver

[permalink] [raw]
Subject: [patch 05/10] perf_event_open.2: aux_{head,tail,offset,size} support


This manpage patch relates to the addition of the AUX mmap region
as added in the following commit:

commit 45bfb2e50471abbbfd83d40d28c986078b0d24ff
Author: Peter Zijlstra <[email protected]>

perf: Add AUX area to ring buffer for raw data streams

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Acked-by: Alexander Shishkin <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Kaixu Xia <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/1421237903-181015-3-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <[email protected]>


Signed-off-by: Vince Weaver <[email protected]>

diff --git a/man2/perf_event_open.2 b/man2/perf_event_open.2
index 01ee579..28348f9 100644
--- a/man2/perf_event_open.2
+++ b/man2/perf_event_open.2
@@ -1348,6 +1348,10 @@ struct perf_event_mmap_page {
__u64 __reserved[120]; /* Pad to 1k */
__u64 data_head; /* head in the data section */
__u64 data_tail; /* user-space written tail */
+ __u64 aux_head;
+ __u64 aux_tail;
+ __u64 aux_offset;
+ __u64 aux_size;
}
.fi
.in
@@ -1564,6 +1568,33 @@ the
.I data_tail
value should be written by user space to reflect the last read data.
In this case, the kernel will not overwrite unread data.
+.TP
+.IR aux_head ", " aux_tail ", " aux_offset ", " aux_size " (since Linux 4.1)
+.\" commit 45bfb2e50471abbbfd83d40d28c986078b0d24ff
+The AUX region allows mmaping a separate sample buffer for high
+bandwidth data streams (separate from the main perf sample buffer).
+An example of a high bandwidth stream is instruction tracing support,
+as is found in newer Intel processors.
+
+To set up an AUX area, first
+.I aux_offset
+needs to be set with an offset greater than
+.IR data_offset + data_size
+and
+.I aux_size
+needs to be set to the desired buffer size.
+The desired offset and size must be page aligned.
+These values are then passed to mmap in order to map the AUX buffer.
+Pages in the AUX buffer are included as part of the user mlock
+rlimit as well as the
+.I perf_event_mlock_kb
+allowance.
+
+The
+.IR aux_head " and " aux_tail
+ring buffer pointers have the same behavior and ordering
+rules as the previous described
+.IR data_head " and " data_tail .
.PP
The following 2^n ring-buffer pages have the layout described below.


2015-04-16 18:56:23

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [patch 05/10] perf_event_open.2: aux_{head,tail,offset,size} support

On Thu, Apr 16, 2015 at 02:15:52PM -0400, Vince Weaver wrote:
> +.I aux_size
> +needs to be set to the desired buffer size.
> +The desired offset and size must be page aligned.

I think we also require the size to be a power of two.

> +These values are then passed to mmap in order to map the AUX buffer.
> +Pages in the AUX buffer are included as part of the user mlock
> +rlimit as well as the
> +.I perf_event_mlock_kb
> +allowance.