Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932443AbbELLOU (ORCPT ); Tue, 12 May 2015 07:14:20 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:57370 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932192AbbELLOR (ORCPT ); Tue, 12 May 2015 07:14:17 -0400 From: Arnd Bergmann To: y2038@lists.linaro.org Cc: Ed Cashin , Tina Ruchandani , 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 Message-ID: <2349651.fBUtehr528@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <2498255.lB0xaQWuiu@wuerfel> References: <20150511023505.GA2714@tinar> <555150A9.8000301@acm.org> <2498255.lB0xaQWuiu@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:zPWfqVIFtPYJEgntwauik6rc4N/wllgHHjDNOPa9C6UVyORDIVP HhgJNiE3HtF+J/t9cU1cST+XZ5gqwL//9ajRETdNYqSUwOmF53ylaaLl70seZWHOYBl30v3 aj6TBhKbGHXL/c3QRf2fJXCJFt2IJ7sh4kJ9DLdXk1/Q6KlvHR7VVxNU1J+8Q+D1uXoGdFG UO3ojWPgrSVxFEwJObtzQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1793 Lines: 40 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/