Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539066

Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math
Date 2016-12-09 05:50 +0100
Message-ID <sMli9-7cd-1@gated-at.bofh.it> (permalink)
References <sMdXk-2rQ-13@gated-at.bofh.it> <sMdXl-2rQ-43@gated-at.bofh.it> <sMkFr-6X5-1@gated-at.bofh.it> <sMkYN-75X-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 8, 2016 at 8:29 PM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Ingo Molnar <mingo@kernel.org> wrote:
>
>>
>> * Thomas Gleixner <tglx@linutronix.de> wrote:
>>
>> > If the timekeeping CPU is scheduled out long enough by a hypervisor the
>> > clocksource delta multiplication can overflow and as a result time can go
>> > backwards. That's insane to begin with, but people already triggered a
>> > signed multiplication overflow, so a unsigned overflow is not necessarily
>> > impossible.
>> >
>> > Implement optional 128bit math which can be selected by a config option.
>>
>> What's the rough VM interruption time that would trigger an overflow? Given that
>> the clock shift tk_read_base::mult is often 1, isn't it 32-bit nsecs, i.e. 4
>> seconds?
>>
>> That doesn't sound 'insanely long'.
>>
>> Or some other value?
>
> Ok, wasn't fully awake yet: more realistic values of the scaling factor on x86
> would allow cycles input values of up to ~70 billion with 64-bit math, which would
> allow deltas of up to about 1 minute with 64-bit math.

So if I'm remembering properly, we pick mult/shift pairs such that the
mult shouldn't overflow from ~10 minutes worth of cycles.

> I think we should at least detect (and report?) the overflow and sanitize the
> effects to the max offset instead of generating random overflown values.

So with CONFIG_DEBUG_TIMEKEEPING, we do check to see if the cycle
value is larger then the max_cycles and will report a warning. But
this is done at interrupt time and not in the hotpath.

thanks
-john

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch 0/6] timekeeping: Cure the signed/unsigned wreckage Thomas Gleixner <tglx@linutronix.de> - 2016-12-08 22:00 +0100
  [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Thomas Gleixner <tglx@linutronix.de> - 2016-12-08 22:00 +0100
    Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Ingo Molnar <mingo@kernel.org> - 2016-12-09 05:10 +0100
      Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Ingo Molnar <mingo@kernel.org> - 2016-12-09 05:30 +0100
        Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math John Stultz <john.stultz@linaro.org> - 2016-12-09 05:50 +0100
      Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 05:50 +0100
        Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Ingo Molnar <mingo@kernel.org> - 2016-12-09 06:30 +0100
          Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 06:50 +0100
    Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 06:20 +0100
      Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 07:10 +0100
    Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 06:30 +0100
      Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 07:40 +0100
        Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 09:40 +0100
          Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 10:20 +0100
          Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 11:10 +0100
        Re: [patch 5/6] [RFD] timekeeping: Provide optional 128bit math Peter Zijlstra <peterz@infradead.org> - 2016-12-09 11:20 +0100
  [patch 3/6] timekeeping: Get rid of pointless typecasts Thomas Gleixner <tglx@linutronix.de> - 2016-12-08 22:00 +0100
    Re: [patch 3/6] timekeeping: Get rid of pointless typecasts David Gibson <david@gibson.dropbear.id.au> - 2016-12-09 00:50 +0100
    [tip:timers/core] timekeeping: Get rid of pointless typecasts tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-12-09 12:20 +0100
  Re: [patch 0/6] timekeeping: Cure the signed/unsigned wreckage John Stultz <john.stultz@linaro.org> - 2016-12-09 06:00 +0100
  Re: [patch 0/6] timekeeping: Cure the signed/unsigned wreckage Peter Zijlstra <peterz@infradead.org> - 2016-12-09 06:40 +0100

csiph-web