2012-06-13 12:51:07

by Stephane Eranian

[permalink] [raw]
Subject: [BUG] perf: perf_output_sample() merge issue?

Peter,

I was looking at perf_output_sample() today, when I ran
into the following weird statement coming from:

commit a7ac67ea021b4603095d2aa458bc41641238f22c
Author: Peter Zijlstra <[email protected]>
Date: Mon Jun 27 16:47:16 2011 +0200

perf: Remove the perf_output_begin(.sample) argument

Since only samples call perf_output_sample() its much saner (and more


I think the intent of this commit was to add the watermark check
at the very end of the perf_output_sample() and NOT between processing
of RAW and BRANCH_STACK. Something may have gone wrong
in the merge.

Can you confirm this?


perf_output_sample()
{
if (sample_type & PERF_SAMPLE_RAW) {
}

if (!event->attr.watermark) {
int wakeup_events = event->attr.wakeup_events;

if (wakeup_events) {
struct ring_buffer *rb = handle->rb;
int events = local_inc_return(&rb->events);

if (events >= wakeup_events) {
local_sub(wakeup_events, &rb->events);
local_inc(&rb->wakeup);
}
}
}

if (sample_type & PERF_SAMPLE_BRANCH_STACK) {
}
}


2012-06-13 13:04:34

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [BUG] perf: perf_output_sample() merge issue?

On Wed, 2012-06-13 at 14:51 +0200, Stephane Eranian wrote:
> I think the intent of this commit was to add the watermark check
> at the very end of the perf_output_sample() and NOT between processing
> of RAW and BRANCH_STACK. Something may have gone wrong
> in the merge.
>
> Can you confirm this?

Yes very much so, good spotting. Weird stuff this merging.

2012-06-13 13:10:14

by Stephane Eranian

[permalink] [raw]
Subject: Re: [BUG] perf: perf_output_sample() merge issue?

On Wed, Jun 13, 2012 at 3:04 PM, Peter Zijlstra <[email protected]> wrote:
> On Wed, 2012-06-13 at 14:51 +0200, Stephane Eranian wrote:
>> I think the intent of this commit was to add the watermark check
>> at the very end of the perf_output_sample() and NOT between processing
>> of RAW and BRANCH_STACK. Something may have gone wrong
>> in the merge.
>>
>> Can you confirm this?
>
> Yes very much so, good spotting. Weird stuff this merging.

Ok, so I will post a patch to fix that then.