[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150113111146.GL23965@worktop.programming.kicks-ass.net>
Date: Tue, 13 Jan 2015 12:11:46 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: John Stultz <john.stultz@...aro.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Dave Jones <davej@...emonkey.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Richard Cochran <richardcochran@...il.com>,
Prarit Bhargava <prarit@...hat.com>,
Stephen Boyd <sboyd@...eaurora.org>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 06/10] time: Cap clocksource reads to the clocksource
max_cycles value
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_cycles value, which is where an overflow would
> occur.
> +++ b/kernel/time/timekeeping.c
> @@ -202,6 +202,9 @@ static inline s64 timekeeping_get_ns(struct tk_read_base *tkr)
> /* calculate the delta since the last update_wall_time: */
> delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask);
>
> + /* Cap delta value to the max_cycles values to avoid mult overflows */
> + delta = min(delta, tkr->clock->max_cycles);
> +
> nsec = delta * tkr->mult + tkr->xtime_nsec;
> nsec >>= tkr->shift;
>
So while I appreciate stuff can be broken, should we not at least keep
track of this brokenness? That is, we all agree bad things happened IF
we actually hit this, right? So should we then not inform people that
bad things did happen?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists