Re: [PATCH] perf: fix ring_buffer perf_output_space() boundary calculation

2013-03-18 Thread Stephane Eranian
On Mon, Mar 18, 2013 at 2:11 PM, Peter Zijlstra wrote: > On Mon, 2013-03-18 at 14:03 +0100, Stephane Eranian wrote: >> On Mon, Mar 18, 2013 at 1:59 PM, Peter Zijlstra wrote: >> > On Mon, 2013-03-18 at 13:48 +0100, Stephane Eranian wrote: >> >> if (!rb->writable) >> >> - retu

Re: [PATCH] perf: fix ring_buffer perf_output_space() boundary calculation

2013-03-18 Thread Peter Zijlstra
On Mon, 2013-03-18 at 14:03 +0100, Stephane Eranian wrote: > On Mon, Mar 18, 2013 at 1:59 PM, Peter Zijlstra wrote: > > On Mon, 2013-03-18 at 13:48 +0100, Stephane Eranian wrote: > >> if (!rb->writable) > >> - return true; > >> + return false; > > > > > > writab

Re: [PATCH] perf: fix ring_buffer perf_output_space() boundary calculation

2013-03-18 Thread Stephane Eranian
On Mon, Mar 18, 2013 at 1:59 PM, Peter Zijlstra wrote: > On Mon, 2013-03-18 at 13:48 +0100, Stephane Eranian wrote: >> if (!rb->writable) >> - return true; >> + return false; > > > writable means user writable (VM_WRITE); the difference is that a > !VM_WRITE buf

Re: [PATCH] perf: fix ring_buffer perf_output_space() boundary calculation

2013-03-18 Thread Peter Zijlstra
On Mon, 2013-03-18 at 13:48 +0100, Stephane Eranian wrote: > if (!rb->writable) > - return true; > + return false; writable means user writable (VM_WRITE); the difference is that a !VM_WRITE buffer will simply over-write its own tail whereas a VM_WRITE buffer w

[PATCH] perf: fix ring_buffer perf_output_space() boundary calculation

2013-03-18 Thread Stephane Eranian
This patch fixes a flaw in perf_output_space(). In case the size of the space needed is bigger than the actual buffer size, there may be situations where the function would return true (i.e., there is space) when it should not. head > offset due to rounding of the masking logic. The problem can b