From owner-svn-src-stable@freebsd.org Mon Aug 29 04:46:00 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A0D9B77CE7; Mon, 29 Aug 2016 04:46:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFD96FF2; Mon, 29 Aug 2016 04:45:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7T4jx7I035659; Mon, 29 Aug 2016 04:45:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7T4jxYJ035658; Mon, 29 Aug 2016 04:45:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201608290445.u7T4jxYJ035658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 29 Aug 2016 04:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r304974 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 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: Mon, 29 Aug 2016 04:46:00 -0000 Author: kib Date: Mon Aug 29 04:45:58 2016 New Revision: 304974 URL: https://svnweb.freebsd.org/changeset/base/304974 Log: MFC r303548: Cache getbintime(9) answer in timehands. Modified: stable/11/sys/kern/kern_tc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_tc.c ============================================================================== --- stable/11/sys/kern/kern_tc.c Mon Aug 29 04:44:24 2016 (r304973) +++ stable/11/sys/kern/kern_tc.c Mon Aug 29 04:45:58 2016 (r304974) @@ -68,6 +68,7 @@ struct timehands { uint64_t th_scale; u_int th_offset_count; struct bintime th_offset; + struct bintime th_bintime; struct timeval th_microtime; struct timespec th_nanotime; struct bintime th_boottime; @@ -235,9 +236,8 @@ fbclock_bintime(struct bintime *bt) do { th = timehands; gen = atomic_load_acq_int(&th->th_generation); - *bt = th->th_offset; + *bt = th->th_bintime; bintime_addx(bt, th->th_scale * tc_delta(th)); - bintime_add(bt, &th->th_boottime); atomic_thread_fence_acq(); } while (gen == 0 || gen != th->th_generation); } @@ -311,8 +311,7 @@ fbclock_getbintime(struct bintime *bt) do { th = timehands; gen = atomic_load_acq_int(&th->th_generation); - *bt = th->th_offset; - bintime_add(bt, &th->th_boottime); + *bt = th->th_bintime; atomic_thread_fence_acq(); } while (gen == 0 || gen != th->th_generation); } @@ -387,9 +386,8 @@ bintime(struct bintime *bt) do { th = timehands; gen = atomic_load_acq_int(&th->th_generation); - *bt = th->th_offset; + *bt = th->th_bintime; bintime_addx(bt, th->th_scale * tc_delta(th)); - bintime_add(bt, &th->th_boottime); atomic_thread_fence_acq(); } while (gen == 0 || gen != th->th_generation); } @@ -463,8 +461,7 @@ getbintime(struct bintime *bt) do { th = timehands; gen = atomic_load_acq_int(&th->th_generation); - *bt = th->th_offset; - bintime_add(bt, &th->th_boottime); + *bt = th->th_bintime; atomic_thread_fence_acq(); } while (gen == 0 || gen != th->th_generation); } @@ -1389,6 +1386,8 @@ tc_windup(struct bintime *new_boottimebi if (bt.sec != t) th->th_boottime.sec += bt.sec - t; } + th->th_bintime = th->th_offset; + bintime_add(&th->th_bintime, &th->th_boottime); /* Update the UTC timestamps used by the get*() functions. */ /* XXX shouldn't do this here. Should force non-`get' versions. */ bintime2timeval(&bt, &th->th_microtime); @@ -1808,9 +1807,8 @@ pps_event(struct pps_state *pps, int eve /* Convert the count to a timespec. */ tcount = pps->capcount - pps->capth->th_offset_count; tcount &= pps->capth->th_counter->tc_counter_mask; - bt = pps->capth->th_offset; + bt = pps->capth->th_bintime; bintime_addx(&bt, pps->capth->th_scale * tcount); - bintime_add(&bt, &pps->capth->th_boottime); bintime2timespec(&bt, &ts); /* If the timecounter was wound up underneath us, bail out. */