From owner-svn-src-stable@FreeBSD.ORG Wed Nov 24 11:54:09 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFD83106566B; Wed, 24 Nov 2010 11:54:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 775688FC15; Wed, 24 Nov 2010 11:54:09 +0000 (UTC) Received: from c122-106-145-124.carlnfd1.nsw.optusnet.com.au (c122-106-145-124.carlnfd1.nsw.optusnet.com.au [122.106.145.124]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id oAOBs4QT030463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Nov 2010 22:54:06 +1100 Date: Wed, 24 Nov 2010 22:54:04 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff In-Reply-To: <20101124102922.GP98817@FreeBSD.org> Message-ID: <20101124221820.X2463@besplex.bde.org> References: <201011240537.oAO5bCSC056347@svn.freebsd.org> <20101124175843.I1829@besplex.bde.org> <20101124102922.GP98817@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org, Bruce Evans Subject: Re: svn commit: r215791 - stable/8/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 11:54:10 -0000 On Wed, 24 Nov 2010, Gleb Smirnoff wrote: > On Wed, Nov 24, 2010 at 06:11:53PM +1100, Bruce Evans wrote: > B> > +++ stable/8/sys/netinet/if_ether.c Wed Nov 24 05:37:12 2010 (r215791) > B> > @@ -381,7 +381,7 @@ retry: > B> > int canceled; > B> > > B> > LLE_ADDREF(la); > B> > - la->la_expire = time_second + V_arpt_down; > B> > + la->la_expire = time_second; > B> > canceled = callout_reset(&la->la_timer, hz * V_arpt_down, > B> > arptimer, la); > B> > if (canceled) > B> > > B> > B> Isn't using non-monotic time for timeouts always wrong? monotonic > > Sure it is wrong. I never payed attention to that fact that time_second > could be non-monotic. Is it non-monotic? I failed to understand kern_tc > code at first glance. Real time (time_second) can go backwards (or jump forwards too much) if someone steps the the clock. In kern_tc.c, time_uptime is implemented as a purely monotonic clock which goes forward by 1 (second) approximately every 1 second of real-real-time, while time_second is misimplemented as essentially (boottime.tv_sec + time_uptime), where boottime is bogusly changed (although the actual boot time didn't change) if someone steps the realtime clock to fix drift in it, including for POSIX leap seconds and resumes. (Suspends stop the monotonic clock, and on resume only the real time clock is advanced by much (by bogusly setting boottime forwards so that (boottime.tv_sec + time_uptime) gives the correct real time.) Using real time is actually correct for some timeouts, mainly for long ones. E.g., ones for the next day shouldn't be 8 hours late because the system was suspended overnight. Bruce