lkml.org 
[lkml]   [2014]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 09/22] perf: Support overwrite mode for AUX area
On Tue, Sep 09, 2014 at 12:40:39PM +0300, Alexander Shishkin wrote:
> Peter Zijlstra <peterz@infradead.org> writes:
>
> > On Wed, Aug 20, 2014 at 03:36:06PM +0300, Alexander Shishkin wrote:
> >
> >> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> >> index 925f369947..5006caba63 100644
> >> --- a/kernel/events/ring_buffer.c
> >> +++ b/kernel/events/ring_buffer.c
> >
> >> @@ -294,9 +295,22 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size,
> >> bool truncated)
> >> {
> >> struct ring_buffer *rb = handle->rb;
> >> + unsigned long aux_head;
> >>
> >> + aux_head = local_read(&rb->aux_head);
> >> +
> >> + if (rb->aux_overwrite) {
> >> + local_set(&rb->aux_head, size);
> >> +
> >> + /*
> >> + * Send a RECORD_AUX with size==0 to communicate aux_head
> >> + * of this snapshot to userspace
> >> + */
> >> + perf_event_aux_event(handle->event, size, 0, truncated);
> >
> > Humm.. why not write a 'normal' AUX record?
>
> In this mode, the hardware is running in a circular buffer mode,
> overwriting old data, so we don't actually know the size of the
> snapshot, we have userspace figure it out later on (based on timestamps,
> for example). I didn't want to configure PMI for this mode to avoid
> overhead, but with PMI we can try to keep track of the overwrites and
> try to infer the actual snapshot size in the kernel. For Intel PT. As
> far as I can tell, ARM's scatter-gather trace-to-memory storing block
> does not generate interrupts at all.

Well, wouldn't the 'size' be basically the entire buffer. All you have
to then provide is the head pointer. Ideally you would also provide a
tail pointer so you know when to stop, but I suppose you can infer that
from the data stream itself? If you can provide the tail you can indeed
compute the size etc.. at which point you don't have to rely on parsing
the stream etc.


[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-09-09 13:21    [W:1.498 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site