From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from s3.sipsolutions.net ([5.9.151.49]:34127 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932657AbaFLIkU (ORCPT ); Thu, 12 Jun 2014 04:40:20 -0400 Message-ID: <1402562399.8095.5.camel@jlt4.sipsolutions.net> (sfid-20140612_104051_922015_348DF2F9) Subject: Re: net_timedelta() affected by settimeofday() (was: [patch 12/13] net: mac80211: Remove silly timespec dance) From: Johannes Berg To: Thomas Gleixner Cc: LKML , John Stultz , Peter Zijlstra , Ingo Molnar , "John W. Linville" , linux-wireless@vger.kernel.org, Stephen Hemminger , netdev Date: Thu, 12 Jun 2014 10:39:59 +0200 In-Reply-To: <1402562114.8095.3.camel@jlt4.sipsolutions.net> (sfid-20140612_103558_525847_209A5C98) References: <20140611234024.103571777@linutronix.de> <20140611234607.683770899@linutronix.de> <1402555774.4224.1.camel@jlt4.sipsolutions.net> <1402562114.8095.3.camel@jlt4.sipsolutions.net> (sfid-20140612_103558_525847_209A5C98) Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Thu, 2014-06-12 at 10:35 +0200, Johannes Berg wrote: > +netdev, Stephen Well, stupid me. Fixing that netdev address. > On Thu, 2014-06-12 at 10:19 +0200, Thomas Gleixner wrote: > > On Thu, 12 Jun 2014, Johannes Berg wrote: > > > > > On Wed, 2014-06-11 at 23:59 +0000, Thomas Gleixner wrote: > > > > > > > + msrmnt = ktime_to_ms(net_timedelta(skb_arv)); > > > > > > This is probably more of a question about net_timedelta(), but is > > > ktime_get_real() really appropriate for duration measurements? Isn't > > > that non-monotonic? > > > > Well, it's monotonic, but might be affected by settimeofday(). > > Right, but isn't that odd? Suddenly your delay measurement here might be > minutes, hours, or years if you settimeofday() between timestamping and > calculating the delta. That seems very strange to me, why would that be > the right behaviour in any way? > > Now, it seems that there are only two current users of net_timedelta() > (in DCCP) so perhaps it's not too late to change some of this? > > Maybe in general the skb timestamp should be based on a different clock > and only adjusted to real time when used in userspace?