Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread John Kacur
On Mon, 17 May 2010, Stephane Eranian wrote: > In case the sampling buffer has no "payload" pages, nr_pages is 0. > The problem is that the error path in perf_output_begin() skips to > a label which assumes perf_output_lock() has been issued which is > not the case. That triggers a WARN_

[perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin() (take 3)

2010-05-17 Thread Stephane Eranian
In case the sampling buffer has no "payload" pages, nr_pages is 0. The problem is that the error path in perf_output_begin() skips to a label which assumes perf_output_lock() has been issued which is not the case. That triggers a WARN_ON() in perf_output_unlock(). This patch fixes the problem by s

Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Stephane Eranian
On Mon, May 17, 2010 at 2:09 PM, Peter Zijlstra wrote: > On Mon, 2010-05-17 at 14:04 +0200, Stephane Eranian wrote: >> >> > So you want to preserve this state for when you munmap() and mmap() >> > again? The only user of data->lost is writing the PERF_RECORD_LOST >> > event, which only ever happen

Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Peter Zijlstra
On Mon, 2010-05-17 at 14:04 +0200, Stephane Eranian wrote: > > > So you want to preserve this state for when you munmap() and mmap() > > again? The only user of data->lost is writing the PERF_RECORD_LOST > > event, which only ever happens when you have pages, so counting it when > > there's no pag

Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Stephane Eranian
On Mon, May 17, 2010 at 2:03 PM, Peter Zijlstra wrote: > On Mon, 2010-05-17 at 13:56 +0200, Stephane Eranian wrote: >> >> +     if (!data->nr_pages) { >> >> +             atomic_inc(&data->lost); >> >> +             goto out; >> >> +     } > > >> Well, nr_pages = 0 means all you have is the sampli

[perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin() (take 2)

2010-05-17 Thread Stephane Eranian
In case the sampling buffer has no "payload" pages, nr_pages is 0. The problem is that the error path in perf_output_begin() skips to a label which assumes perf_output_lock() has been issued which is not the case. That triggers a WARN_ON() is perf_output_unlock(). This patch fixes the problem by s

Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Peter Zijlstra
On Mon, 2010-05-17 at 13:56 +0200, Stephane Eranian wrote: > >> + if (!data->nr_pages) { > >> + atomic_inc(&data->lost); > >> + goto out; > >> + } > Well, nr_pages = 0 means all you have is the sampling buffer > header page. You cannot save any sample, so you actu

Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Stephane Eranian
On Mon, May 17, 2010 at 1:04 PM, John Kacur wrote: > > > On Mon, 17 May 2010, Stephane Eranian wrote: > >>   In case the sampling buffer has no "payload" pages, nr_pages is 0. >>   The problem is that the error path in perf_output_begin() skips to >>   a label which assumes perf_output_lock() has

Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Stephane Eranian
On Mon, May 17, 2010 at 1:46 PM, Frederic Weisbecker wrote: > On Mon, May 17, 2010 at 12:46:01PM +0200, Stephane Eranian wrote: >>   In case the sampling buffer has no "payload" pages, nr_pages is 0. >>   The problem is that the error path in perf_output_begin() skips to >>   a label which assumes

Re: [perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Frederic Weisbecker
On Mon, May 17, 2010 at 12:46:01PM +0200, Stephane Eranian wrote: > In case the sampling buffer has no "payload" pages, nr_pages is 0. > The problem is that the error path in perf_output_begin() skips to > a label which assumes perf_output_lock() has been issued which is > not the case. Tha

[perfmon2] [PATCH] perf_events: fix errors path in perf_output_begin()

2010-05-17 Thread Stephane Eranian
In case the sampling buffer has no "payload" pages, nr_pages is 0. The problem is that the error path in perf_output_begin() skips to a label which assumes perf_output_lock() has been issued which is not the case. That triggers a WARN_ON() is perf_output_unlock(). This patch fixes the pr