public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Ed Cashin <ed.cashin@acm.org>,
	Tina Ruchandani <ruchandani.tina@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [Y2038] [PATCH] aoe: Use 64-bit timestamp in frame
Date: Tue, 12 May 2015 13:14:10 +0200	[thread overview]
Message-ID: <2349651.fBUtehr528@wuerfel> (raw)
In-Reply-To: <2498255.lB0xaQWuiu@wuerfel>

On Tuesday 12 May 2015 11:44:21 Arnd Bergmann wrote:
> 
> There are of course multiple ways to do this. One way would be to
> change the code to work on 32-bit nanoseconds instead of 32-bit
> microseconds. This requires proving that the we cannot exceed
> 4.29 seconds of round-trip time in calc_rttavg().
> Is that a valid assumption or not?
> 
> If not, we could replace do_gettimeofday() with ktime_get_ts64().
> This will ensure we don't need a 64-bit division when converting
> the ts64 to a 32-bit microsecond value, and combined with the
> conversion is still no slower than do_gettimeofday(), and it
> still avoids the double bookkeeping because it uses a monotonic
> timebase that is robust against settimeofday.

Two other approaches that occurred to me later:

- introduce common ktime_get_ms(), ktime_get_us(), ktime_get_real_ms()
  and ktime_get_real_is() interfaces, to match the other interfaces
  we already provide. These could be done as efficiently or better
  than what aoe does manually today.

- change the timebase that is used for the computations in aoe to use
  scaled nanoseconds instead of microseconds. Using 

  u32 time = ktime_get_ns() >> 10;

  would give you a similar range and precision as microseconds, but
  completely avoid integer division. You could also use a different
  shift value to either extend the range beyond 71 minutes, or the
  extend the precision to something below a microsecond. This would
  be the most efficient implementation, but also require significant
  changes to the driver.

	Arnd

  reply	other threads:[~2015-05-12 11:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11  2:35 [PATCH] aoe: Use 64-bit timestamp in frame Tina Ruchandani
2015-05-11 15:38 ` Arnd Bergmann
2015-05-11 15:59   ` Ed Cashin
2015-05-12  1:00 ` Ed Cashin
2015-05-12  9:44   ` Arnd Bergmann
2015-05-12 11:14     ` Arnd Bergmann [this message]
2015-05-13  1:23       ` [Y2038] " Ed Cashin
2015-05-13  8:04         ` Arnd Bergmann
2015-05-14  0:47           ` Ed Cashin
2015-05-12 11:21     ` Ed Cashin
2015-05-13  1:26     ` Ed Cashin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2349651.fBUtehr528@wuerfel \
    --to=arnd@arndb.de \
    --cc=ed.cashin@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruchandani.tina@gmail.com \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox