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


Groups > linux.kernel > #1534441

Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in its calculation.

From John Stultz <john.stultz@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in its calculation.
Date 2016-12-01 22:20 +0100
Message-ID <sJGVP-2jo-15@gated-at.bofh.it> (permalink)
References (3 earlier) <sJmu5-4gu-11@gated-at.bofh.it> <sJp8C-612-9@gated-at.bofh.it> <sJylz-3Eb-17@gated-at.bofh.it> <sJG9s-1Bs-9@gated-at.bofh.it> <sJGsN-1Sz-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 1, 2016 at 12:46 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Thu, 1 Dec 2016, John Stultz wrote:
>> I would also suggest:
>> 3) If the systems are halted for longer then the timekeeping core
>> expects, the system will "miss" or "lose" some portion of that halted
>> time, but otherwise the system will function properly.  Which is the
>> result with this patch.
>
> Wrong. This is not the result with this patch.
>
> If the time advances enough to overflow the unsigned mult, which is
> entirely possible as it takes just twice the time of the negative overflow,
> then time will go backwards again and that's not 'miss' or 'lose', that's
> just broken.

Eh? If you overflow the 64bits on the mult, the shift (which is likely
large if you're actually hitting the overflow) brings the value back
down to a smaller value. Time doesn't go backwards, its just smaller
then it ought to be (since the high bits were lost).

> If we want to prevent that, then we either have to clamp the delta value,
> which is the worst choice or use 128bit math to avoid the overflow.

I'm not convinced yet either of these approaches are really needed.

>> I'm not sure if its really worth trying to recover that time or be
>> perfect in those situations. Especially since on narrow clocksources
>> you'll have the same result.
>
> We can deal with the 64bit overflow at least for wide clocksources which
> all virtualizaton infected architectures provide in a sane way.

Another approach would be to push back on the virtualization
environments to step in and virtualize a solution if they've idled a
host for too long. They could do like the old tick-based
virtualization environments used to and trigger a few timer interrupts
while slowly removing a fake negative clocksource offset to allow time
to catch up more normally after a long stall.

Or they could require clocksources that have smaller shift values to
allow longer idle periods.

> For bare metal systems with narrow clocksources the whole issue is non
> existant we can make the 128bit math depend on both a config switch and a
> static key, so bare metal will not have to take the burden.

Bare metal machines also sometimes run virtualization. I'm not sure
the two are usefully exclusive.

thanks
-john

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


Thread

Re: [PATCH] timekeeping: Change type of nsec variable to unsigned  in its calculation. Thomas Gleixner <tglx@linutronix.de> - 2016-11-29 15:30 +0100
  Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in  its calculation. David Gibson <david@gibson.dropbear.id.au> - 2016-11-30 01:40 +0100
    Re: [PATCH] timekeeping: Change type of nsec variable to unsigned  in its calculation. Thomas Gleixner <tglx@linutronix.de> - 2016-12-01 00:30 +0100
      Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in  its calculation. David Gibson <david@gibson.dropbear.id.au> - 2016-12-01 03:20 +0100
        Re: [PATCH] timekeeping: Change type of nsec variable to unsigned  in its calculation. Thomas Gleixner <tglx@linutronix.de> - 2016-12-01 13:10 +0100
          Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in  its calculation. John Stultz <john.stultz@linaro.org> - 2016-12-01 21:30 +0100
            Re: [PATCH] timekeeping: Change type of nsec variable to unsigned  in its calculation. Thomas Gleixner <tglx@linutronix.de> - 2016-12-01 21:50 +0100
              Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in  its calculation. John Stultz <john.stultz@linaro.org> - 2016-12-01 22:20 +0100
                Re: [PATCH] timekeeping: Change type of nsec variable to unsigned  in its calculation. Thomas Gleixner <tglx@linutronix.de> - 2016-12-01 23:50 +0100
                Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in  its calculation. John Stultz <john.stultz@linaro.org> - 2016-12-02 00:10 +0100
                Re: [PATCH] timekeeping: Change type of nsec variable to unsigned  in its calculation. Thomas Gleixner <tglx@linutronix.de> - 2016-12-02 00:20 +0100
          Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in  its calculation. David Gibson <david@gibson.dropbear.id.au> - 2016-12-02 00:40 +0100
            Re: [PATCH] timekeeping: Change type of nsec variable to unsigned  in its calculation. Thomas Gleixner <tglx@linutronix.de> - 2016-12-02 09:40 +0100
              Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in  its calculation. David Gibson <david@gibson.dropbear.id.au> - 2016-12-03 01:40 +0100

csiph-web