Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-22 Thread John Stultz
On Wed, Jan 14, 2015 at 1:35 AM, Peter Zijlstra wrote: > On Tue, Jan 13, 2015 at 01:33:29PM -0800, John Stultz wrote: >> On Tue, Jan 13, 2015 at 3:11 AM, Peter Zijlstra wrote: >> > On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote: >> >> When calculating the current delta since the last

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-14 Thread Peter Zijlstra
On Tue, Jan 13, 2015 at 01:33:29PM -0800, John Stultz wrote: > On Tue, Jan 13, 2015 at 3:11 AM, Peter Zijlstra wrote: > > On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote: > >> When calculating the current delta since the last tick, we > >> currently have no hard protections to prevent

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-13 Thread Linus Torvalds
On Wed, Jan 14, 2015 at 10:33 AM, John Stultz wrote: > > So since this is a time reading function, this could be called > anywhere. Indeed. Could, and is. >From within the scheduler, with some very core locks held. From within printk itself (more really core locks held). From the tracer (which i

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-13 Thread John Stultz
On Tue, Jan 13, 2015 at 3:11 AM, Peter Zijlstra wrote: > On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote: >> When calculating the current delta since the last tick, we >> currently have no hard protections to prevent a multiplciation >> overflow from ocurring. >> >> This patch introduc

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-13 Thread Peter Zijlstra
On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote: > When calculating the current delta since the last tick, we > currently have no hard protections to prevent a multiplciation > overflow from ocurring. > > This patch introduces such a cap that limits the read delta > value to the max_cy

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-12 Thread Richard Cochran
On Mon, Jan 12, 2015 at 09:30:07PM +0100, Richard Cochran wrote: > On Mon, Jan 12, 2015 at 10:54:50AM -0800, John Stultz wrote: > > You say the tick should be scheduled before the clocksource wraps - > > but we have logic to do that. > > Well that is a shame. Arg, I mean, not a shame that we have

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-12 Thread Richard Cochran
On Tue, Jan 13, 2015 at 08:02:53AM +1300, Linus Torvalds wrote: > Indeed. It's making things more robust in the face of _known_ issues. > Even with a perfectly designed timer (which we so far have never > seen), interrupts get delayed etc, so trying to stretch it to the > limit of the timer is simp

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-12 Thread Richard Cochran
On Mon, Jan 12, 2015 at 10:54:50AM -0800, John Stultz wrote: > On Sun, Jan 11, 2015 at 4:41 AM, Richard Cochran > wrote: > > On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote: > >> When calculating the current delta since the last tick, we > >> currently have no hard protections to preve

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-12 Thread Linus Torvalds
On Tue, Jan 13, 2015 at 7:54 AM, John Stultz wrote: > > So I disagree this is papering over the problem. Indeed. It's making things more robust in the face of _known_ issues. Even with a perfectly designed timer (which we so far have never seen), interrupts get delayed etc, so trying to stretch i

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-12 Thread John Stultz
On Sun, Jan 11, 2015 at 4:41 AM, Richard Cochran wrote: > On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote: >> When calculating the current delta since the last tick, we >> currently have no hard protections to prevent a multiplciation >> overflow from ocurring. > > This is just paperin

Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-11 Thread Richard Cochran
On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote: > When calculating the current delta since the last tick, we > currently have no hard protections to prevent a multiplciation > overflow from ocurring. This is just papering over the problem. The "hard protection" should be having a tick

[PATCH 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-09 Thread John Stultz
When calculating the current delta since the last tick, we currently have no hard protections to prevent a multiplciation overflow from ocurring. This patch introduces such a cap that limits the read delta value to the max_cycles value, which is where an overflow would occur. There was some conce