Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159854815
D42936.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
27 KB
Referenced Files
None
Subscribers
None
D42936.diff
View Options
diff --git a/sys/amd64/conf/FFCLOCK b/sys/amd64/conf/FFCLOCK
new file mode 100644
--- /dev/null
+++ b/sys/amd64/conf/FFCLOCK
@@ -0,0 +1,6 @@
+#NO_UNIVERSE
+
+include GENERIC
+ident FFCLOCK
+
+options FFCLOCK # enable feedforward system clock components
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1274,11 +1274,13 @@
options PPS_SYNC
-# Enable support for generic feed-forward clocks in the kernel.
-# The feed-forward clock support is an alternative to the feedback oriented
-# ntpd/system clock approach, and is to be used with a feed-forward
-# synchronization algorithm such as the RADclock:
-# More info here: http://www.synclab.org/radclock
+# Enable support for feedforward based system clocks in the kernel.
+# Feedforward clock support is an alternative to the traditional feedback
+# based approach, and is to be used with a feedforward synchronization daemon
+# such as the RADclock (see radicalsync.net for more information). With
+# FFCLOCK enabled, the system clock can be dynamically selected to be either
+# FF or FB based, and packet timestamps can be read from a chosen clock.
+# See man pages for ffclock (sections 2 and 4), and bpf.
options FFCLOCK
diff --git a/sys/i386/conf/FFCLOCK b/sys/i386/conf/FFCLOCK
new file mode 100644
--- /dev/null
+++ b/sys/i386/conf/FFCLOCK
@@ -0,0 +1,6 @@
+#NO_UNIVERSE
+
+include GENERIC
+ident FFCLOCK
+
+options FFCLOCK # enable feedforward system clock components
diff --git a/sys/kern/kern_ffclock.c b/sys/kern/kern_ffclock.c
--- a/sys/kern/kern_ffclock.c
+++ b/sys/kern/kern_ffclock.c
@@ -48,7 +48,7 @@
#ifdef FFCLOCK
-FEATURE(ffclock, "Feed-forward clock support");
+FEATURE(ffclock, "Feedforward clock support");
extern struct ffclock_estimate ffclock_estimate;
extern struct bintime ffclock_boottime;
@@ -56,8 +56,8 @@
extern struct mtx ffclock_mtx;
/*
- * Feed-forward clock absolute time. This should be the preferred way to read
- * the feed-forward clock for "wall-clock" type time. The flags allow to compose
+ * Feedforward clock absolute time. This should be the preferred way to read
+ * the feedforward clock for "wall-clock" type time. The flags allow to compose
* various flavours of absolute time (e.g. with or without leap seconds taken
* into account). If valid pointers are provided, the ffcounter value and an
* upper bound on clock error associated with the bintime are provided.
@@ -84,7 +84,7 @@
/* Current ffclock estimate, use update_ffcount as generation number. */
do {
update_ffcount = ffclock_estimate.update_ffcount;
- bcopy(&ffclock_estimate, &cest, sizeof(struct ffclock_estimate));
+ memcpy(&cest, &ffclock_estimate,sizeof(struct ffclock_estimate));
} while (update_ffcount != ffclock_estimate.update_ffcount);
/*
@@ -107,12 +107,8 @@
if (error_bound) {
ffdelta_error = ffc - cest.update_ffcount;
ffclock_convert_diff(ffdelta_error, error_bound);
- /* 18446744073709 = int(2^64/1e12), err_bound_rate in [ps/s] */
- bintime_mul(error_bound, cest.errb_rate *
- (uint64_t)18446744073709LL);
- /* 18446744073 = int(2^64 / 1e9), since err_abs in [ns] */
- bintime_addx(error_bound, cest.errb_abs *
- (uint64_t)18446744073LL);
+ bintime_mul(error_bound, cest.errb_rate * PS_AS_BINFRAC);
+ bintime_addx(error_bound, cest.errb_abs * NS_AS_BINFRAC);
}
if (ffcount)
@@ -120,7 +116,7 @@
}
/*
- * Feed-forward difference clock. This should be the preferred way to convert a
+ * Feedforward difference clock. This should be the preferred way to convert a
* time interval in ffcounter values into a time interval in seconds. If a valid
* pointer is passed, an upper bound on the error in computing the time interval
* in seconds is provided.
@@ -141,29 +137,28 @@
} while (update_ffcount != ffclock_estimate.update_ffcount);
ffclock_convert_diff(ffdelta, error_bound);
- /* 18446744073709 = int(2^64/1e12), err_bound_rate in [ps/s] */
- bintime_mul(error_bound, err_rate * (uint64_t)18446744073709LL);
+ bintime_mul(error_bound, err_rate * PS_AS_BINFRAC);
}
}
/*
* Create a new kern.sysclock sysctl node, which will be home to some generic
- * sysclock configuration variables. Feed-forward clock specific variables will
+ * sysclock configuration variables. Feedforward clock specific variables will
* live under the ffclock subnode.
*/
SYSCTL_NODE(_kern, OID_AUTO, sysclock, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
"System clock related configuration");
SYSCTL_NODE(_kern_sysclock, OID_AUTO, ffclock, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
- "Feed-forward clock configuration");
+ "Feedforward clock configuration");
-static char *sysclocks[] = {"feedback", "feed-forward"};
+static char *sysclocks[] = {"FBclock", "FFclock"};
#define MAX_SYSCLOCK_NAME_LEN 16
#define NUM_SYSCLOCKS nitems(sysclocks)
static int ffclock_version = 2;
SYSCTL_INT(_kern_sysclock_ffclock, OID_AUTO, version, CTLFLAG_RD,
- &ffclock_version, 0, "Feed-forward clock kernel version");
+ &ffclock_version, 0, "Feedforward clock kernel version");
/* List available sysclocks. */
static int
@@ -204,27 +199,29 @@
{
char newclock[MAX_SYSCLOCK_NAME_LEN];
int error;
- int clk;
+ int clk, origclk;
/* Return the name of the current active sysclock. */
strlcpy(newclock, sysclocks[sysclock_active], sizeof(newclock));
error = sysctl_handle_string(oidp, newclock, sizeof(newclock), req);
- /* Check for error or no change */
+ /* Check for error or no change. */
if (error != 0 || req->newptr == NULL)
goto done;
- /* Change the active sysclock to the user specified one: */
+ /* Change the active sysclock to the user specified one. */
error = EINVAL;
+ origclk = sysclock_active;
for (clk = 0; clk < NUM_SYSCLOCKS; clk++) {
- if (strncmp(newclock, sysclocks[clk],
- MAX_SYSCLOCK_NAME_LEN - 1)) {
+ if (strncmp(newclock, sysclocks[clk], MAX_SYSCLOCK_NAME_LEN -1))
continue;
- }
sysclock_active = clk;
error = 0;
break;
}
+ if (sysclock_active != origclk)
+ printf("Active sysclock changed to %s \n",
+ sysclocks[sysclock_active] );
done:
return (error);
}
@@ -237,10 +234,10 @@
static int sysctl_kern_ffclock_ffcounter_bypass = 0;
SYSCTL_INT(_kern_sysclock_ffclock, OID_AUTO, ffcounter_bypass, CTLFLAG_RW,
&sysctl_kern_ffclock_ffcounter_bypass, 0,
- "Use reliable hardware timecounter as the feed-forward counter");
+ "Use reliable hardware timecounter as the feedforward counter");
/*
- * High level functions to access the Feed-Forward Clock.
+ * High level functions to access the FFclock.
*/
void
ffclock_bintime(struct bintime *bt)
@@ -375,7 +372,7 @@
/*
* System call allowing userland applications to retrieve the current value of
- * the Feed-Forward Clock counter.
+ * the feedforward clock counter.
*/
#ifndef _SYS_SYSPROTO_H_
struct ffclock_getcounter_args {
@@ -399,7 +396,7 @@
}
/*
- * System call allowing the synchronisation daemon to push new feed-forward clock
+ * System call allowing the synchronisation daemon to push new feedforward clock
* estimates to the kernel. Acquire ffclock_mtx to prevent concurrent updates
* and ensure data consistency.
* NOTE: ffclock_updated signals the fftimehands that new estimates are
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -500,16 +500,16 @@
#ifdef FFCLOCK
/*
- * Support for feed-forward synchronization algorithms. This is heavily inspired
+ * Support for feedforward synchronization algorithms. This is heavily inspired
* by the timehands mechanism but kept independent from it. *_windup() functions
* have some connection to avoid accessing the timecounter hardware more than
* necessary.
*/
-/* Feed-forward clock estimates kept updated by the synchronization daemon. */
+/* Feedforward clock estimates kept updated by the synchronization daemon. */
struct ffclock_estimate ffclock_estimate;
-struct bintime ffclock_boottime; /* Feed-forward boot time estimate. */
-uint32_t ffclock_status; /* Feed-forward clock status. */
+struct bintime ffclock_boottime; /* feedforward boot time estimate. */
+uint32_t ffclock_status; /* feedforward clock status. */
int8_t ffclock_updated; /* New estimates are available. */
struct mtx ffclock_mtx; /* Mutex on ffclock_estimate. */
@@ -547,11 +547,11 @@
}
/*
- * Reset the feed-forward clock estimates. Called from inittodr() to get things
+ * Reset the feedforward clock estimates. Called from inittodr() to get things
* kick started and uses the timecounter nominal frequency as a first period
* estimate. Note: this function may be called several time just after boot.
* Note: this is the only function that sets the value of boot time for the
- * monotonic (i.e. uptime) version of the feed-forward clock.
+ * monotonic (i.e. uptime) version of the feedforward clock.
*/
void
ffclock_reset_clock(struct timespec *ts)
@@ -574,7 +574,7 @@
cest.leapsec = 0;
mtx_lock(&ffclock_mtx);
- bcopy(&cest, &ffclock_estimate, sizeof(struct ffclock_estimate));
+ memcpy(&ffclock_estimate, &cest, sizeof(struct ffclock_estimate));
ffclock_updated = INT8_MAX;
mtx_unlock(&ffclock_mtx);
@@ -639,7 +639,7 @@
ogen = ffth->gen;
ffth->gen = 0;
cest = &ffth->cest;
- bcopy(&fftimehands->cest, cest, sizeof(struct ffclock_estimate));
+ memcpy(cest, &fftimehands->cest, sizeof(struct ffclock_estimate));
ffdelta = (ffcounter)delta;
ffth->period_lerp = fftimehands->period_lerp;
@@ -668,14 +668,14 @@
/*
* If available, grab updated clock estimates and make them current.
* Recompute time at this tick using the updated estimates. The clock
- * estimates passed the feed-forward synchronisation daemon may result
+ * estimates passed the feedforward synchronisation daemon may result
* in time conversion that is not monotonically increasing (just after
* the update). time_lerp is a particular linear interpolation over the
* synchronisation algo polling period that ensures monotonicity for the
* clock ids requesting it.
*/
if (ffclock_updated > 0) {
- bcopy(&ffclock_estimate, cest, sizeof(struct ffclock_estimate));
+ memcpy(cest, &ffclock_estimate,sizeof(struct ffclock_estimate));
ffdelta = ffth->tick_ffcount - cest->update_ffcount;
ffth->tick_time = cest->update_time;
ffclock_convert_delta(ffdelta, cest->period, &bt);
@@ -734,7 +734,7 @@
ffclock_convert_delta(ffdelta, cest->period, &bt);
polling = bt.sec;
bt.sec = 0;
- bt.frac = 5000000 * (uint64_t)18446744073LL;
+ bt.frac = 5000000 * NS_AS_BINFRAC;
bintime_mul(&bt, polling);
if (bintime_cmp(&gap_lerp, &bt, >))
gap_lerp = bt;
@@ -766,7 +766,7 @@
* the old and new hardware counter cannot be read simultaneously. tc_windup()
* does read the two counters 'back to back', but a few cycles are effectively
* lost, and not accumulated in tick_ffcount. This is a fairly radical
- * operation for a feed-forward synchronization daemon, and it is its job to not
+ * operation for a feedforward synchronization daemon, and it is its job to not
* pushing irrelevant data to the kernel. Because there is no locking here,
* simply force to ignore pending or next update to give daemon a chance to
* realize the counter has changed.
@@ -785,7 +785,7 @@
ffth->gen = 0;
cest = &ffth->cest;
- bcopy(&(fftimehands->cest), cest, sizeof(struct ffclock_estimate));
+ memcpy(cest, &(fftimehands->cest), sizeof(struct ffclock_estimate));
cest->period = ((1ULL << 63) / tc->tc_frequency ) << 1;
cest->errb_abs = 0;
cest->errb_rate = 0;
@@ -806,7 +806,7 @@
}
/*
- * Retrieve feed-forward counter and time of last kernel tick.
+ * Retrieve feedforward counter and time of last kernel tick.
*/
void
ffclock_last_tick(ffcounter *ffcount, struct bintime *bt, uint32_t flags)
@@ -873,7 +873,7 @@
/*
* Difference clock conversion.
- * Low level function to Convert a time interval measured in RAW counter units
+ * Low level function to convert a time interval measured in raw counter units
* into bintime. The difference clock allows measuring small intervals much more
* reliably than the absolute clock.
*/
@@ -1033,15 +1033,16 @@
* System clock currently providing time to the system. Modifiable via sysctl
* when the FFCLOCK option is defined.
*/
-int sysclock_active = SYSCLOCK_FBCK;
+int sysclock_active = SYSCLOCK_FB;
/* Internal NTP status and error estimates. */
extern int time_status;
extern long time_esterror;
/*
- * Take a snapshot of sysclock data which can be used to compare system clocks
- * and generate timestamps after the fact.
+ * Take a raw timestamp (timecounter reading), and then snapshot the sysclock
+ * data which can be used to compare system clocks and generate timestamps
+ * of all possible types after the fact.
*/
void
sysclock_getsnapshot(struct sysclock_snap *clock_snap, int fast)
@@ -1069,7 +1070,7 @@
fbi->tick_time = th->th_offset;
#ifdef FFCLOCK
ffth = fftimehands;
- ffi->tick_time = ffth->tick_time_lerp;
+ ffi->tick_time = ffth->tick_time;
ffi->tick_time_lerp = ffth->tick_time_lerp;
ffi->period = ffth->cest.period;
ffi->period_lerp = ffth->period_lerp;
@@ -1085,31 +1086,28 @@
clock_snap->sysclock_active = sysclock_active;
/* Record feedback clock status and error. */
- clock_snap->fb_info.status = time_status;
+ fbi->status = time_status;
/* XXX: Very crude estimate of feedback clock error. */
- bt.sec = time_esterror / 1000000;
- bt.frac = ((time_esterror - bt.sec) * 1000000) *
- (uint64_t)18446744073709ULL;
- clock_snap->fb_info.error = bt;
+ bt.sec = time_esterror / 1000000; // time_esterror is in mus
+ bt.frac = (time_esterror - bt.sec * 1000000) * MUS_AS_BINFRAC;
+ fbi->error = bt;
#ifdef FFCLOCK
if (!fast)
clock_snap->ffcount += delta;
- /* Record feed-forward clock leap second adjustment. */
+ /* Record feedforward clock leap second adjustment. */
ffi->leapsec_adjustment = cest.leapsec_total;
if (clock_snap->ffcount > cest.leapsec_next)
ffi->leapsec_adjustment -= cest.leapsec;
- /* Record feed-forward clock status and error. */
- clock_snap->ff_info.status = cest.status;
+ /* Record feedforward clock status and error. */
+ ffi->status = cest.status;
ffcount = clock_snap->ffcount - cest.update_ffcount;
ffclock_convert_delta(ffcount, cest.period, &bt);
- /* 18446744073709 = int(2^64/1e12), err_bound_rate in [ps/s]. */
- bintime_mul(&bt, cest.errb_rate * (uint64_t)18446744073709ULL);
- /* 18446744073 = int(2^64 / 1e9), since err_abs in [ns]. */
- bintime_addx(&bt, cest.errb_abs * (uint64_t)18446744073ULL);
- clock_snap->ff_info.error = bt;
+ bintime_mul(&bt, cest.errb_rate * PS_AS_BINFRAC);
+ bintime_addx(&bt, cest.errb_abs * NS_AS_BINFRAC);
+ ffi->error = bt;
#endif
}
@@ -1119,7 +1117,7 @@
*/
int
sysclock_snap2bintime(struct sysclock_snap *cs, struct bintime *bt,
- int whichclock, uint32_t flags)
+ int clockfamily, uint32_t flags)
{
struct bintime boottimebin;
#ifdef FFCLOCK
@@ -1127,8 +1125,8 @@
uint64_t period;
#endif
- switch (whichclock) {
- case SYSCLOCK_FBCK:
+ switch (clockfamily) {
+ case SYSCLOCK_FB:
*bt = cs->fb_info.tick_time;
/* If snapshot was created with !fast, delta will be >0. */
@@ -1141,7 +1139,7 @@
}
break;
#ifdef FFCLOCK
- case SYSCLOCK_FFWD:
+ case SYSCLOCK_FF:
if (flags & FFCLOCK_LERP) {
*bt = cs->ff_info.tick_time_lerp;
period = cs->ff_info.period_lerp;
@@ -1152,7 +1150,7 @@
/* If snapshot was created with !fast, delta will be >0. */
if (cs->delta > 0) {
- ffclock_convert_delta(cs->delta, period, &bt2);
+ ffclock_convert_delta((ffcounter)cs->delta,period,&bt2);
bintime_add(bt, &bt2);
}
@@ -1286,6 +1284,8 @@
/*
* Step our concept of UTC. This is done by modifying our estimate of
* when we booted.
+ * Since this function sets the FB clock, if FFCLOCK defined, ensure all
+ * timestamp calls are in fact from the FB clock for consistency.
*/
void
tc_setclock(struct timespec *ts)
@@ -1294,10 +1294,18 @@
struct bintime bt, bt2;
timespec2bintime(ts, &bt);
+#ifdef FFCLOCK
+ fbclock_nanotime(&tbef);
+#else
nanotime(&tbef);
+#endif
mtx_lock_spin(&tc_setclock_mtx);
cpu_tick_calibrate(1);
+#ifdef FFCLOCK
+ fbclock_binuptime(&bt2);
+#else
binuptime(&bt2);
+#endif
bintime_sub(&bt, &bt2);
/* XXX fiddle all the little crinkly bits around the fiords... */
@@ -1309,7 +1317,11 @@
timerfd_jumped();
sleepq_chains_remove_matching(sleeping_on_old_rtc);
if (timestepwarnings) {
+#ifdef FFCLOCK
+ fbclock_nanotime(&taft);
+#else
nanotime(&taft);
+#endif
log(LOG_INFO,
"Time stepped from %jd.%09ld to %jd.%09ld (%jd.%09ld)\n",
(intmax_t)tbef.tv_sec, tbef.tv_nsec,
@@ -1476,15 +1488,17 @@
/* Go live with the new struct timehands. */
#ifdef FFCLOCK
switch (sysclock_active) {
- case SYSCLOCK_FBCK:
+ case SYSCLOCK_FB:
#endif
time_second = th->th_microtime.tv_sec;
time_uptime = th->th_offset.sec;
#ifdef FFCLOCK
break;
- case SYSCLOCK_FFWD:
- time_second = fftimehands->tick_time_lerp.sec;
- time_uptime = fftimehands->tick_time_lerp.sec - ffclock_boottime.sec;
+ case SYSCLOCK_FF:
+ ffclock_getbintime(&bt);
+ time_second = bt.sec;
+ ffclock_getbinuptime(&bt);
+ time_uptime = bt.sec;
break;
}
#endif
diff --git a/sys/sys/_ffcounter.h b/sys/sys/_ffcounter.h
--- a/sys/sys/_ffcounter.h
+++ b/sys/sys/_ffcounter.h
@@ -30,10 +30,10 @@
*/
#ifndef _SYS__FFCOUNTER_H_
-#define _SYS__FFCOUNTER_H_
+#define _SYS__FFCOUNTER_H_
/*
- * The feed-forward clock counter. The fundamental element of a feed-forward
+ * The feedforward clock counter. The fundamental element of a feedforward
* clock is a wide monotonically increasing counter that accumulates at the same
* rate as the selected timecounter.
*/
diff --git a/sys/sys/timeffc.h b/sys/sys/timeffc.h
--- a/sys/sys/timeffc.h
+++ b/sys/sys/timeffc.h
@@ -30,12 +30,12 @@
*/
#ifndef _SYS_TIMEFF_H_
-#define _SYS_TIMEFF_H_
+#define _SYS_TIMEFF_H_
#include <sys/_ffcounter.h>
/*
- * Feed-forward clock estimate
+ * Feedforward clock estimate
* Holds time mark as a ffcounter and conversion to bintime based on current
* timecounter period and offset estimate passed by the synchronization daemon.
* Provides time of last daemon update, clock status and bound on error.
@@ -55,52 +55,60 @@
#if __BSD_VISIBLE
#ifdef _KERNEL
-/* Define the kern.sysclock sysctl tree. */
+/* Constants to hold errors and error rates in 64bit binary fraction fields. */
+#define MS_AS_BINFRAC (uint64_t)18446744073709551ULL // floor(2^64/1e3)
+#define MUS_AS_BINFRAC (uint64_t)18446744073709ULL // floor(2^64/1e6)
+#define NS_AS_BINFRAC (uint64_t)18446744073ULL // floor(2^64/1e9)
+#define PS_AS_BINFRAC (uint64_t)18446744ULL // floor(2^64/1e12)
+
+
+/* Declare the kern.sysclock sysctl tree. */
SYSCTL_DECL(_kern_sysclock);
-/* Define the kern.sysclock.ffclock sysctl tree. */
+/* Declare the kern.sysclock.ffclock sysctl tree. */
SYSCTL_DECL(_kern_sysclock_ffclock);
/*
* Index into the sysclocks array for obtaining the ASCII name of a particular
* sysclock.
*/
-#define SYSCLOCK_FBCK 0
-#define SYSCLOCK_FFWD 1
+#define SYSCLOCK_FB 0
+#define SYSCLOCK_FF 1
extern int sysclock_active;
/*
- * Parameters of counter characterisation required by feed-forward algorithms.
+ * Parameters of counter characterisation required by feedforward algorithms.
*/
-#define FFCLOCK_SKM_SCALE 1024
+#define FFCLOCK_SKM_SCALE 1024
/*
- * Feed-forward clock status
+ * Feedforward clock status.
*/
-#define FFCLOCK_STA_UNSYNC 1
-#define FFCLOCK_STA_WARMUP 2
+#define FFCLOCK_STA_UNSYNC 1
+#define FFCLOCK_STA_WARMUP 2
/*
* Flags for use by sysclock_snap2bintime() and various ffclock_ functions to
* control how the timecounter hardware is read and how the hardware snapshot is
* converted into absolute time.
- * {FB|FF}CLOCK_FAST: Do not read the hardware counter, instead using the
- * value at last tick. The time returned has a resolution
- * of the kernel tick timer (1/hz [s]).
- * FFCLOCK_LERP: Linear interpolation of ffclock time to guarantee
- * monotonic time.
- * FFCLOCK_LEAPSEC: Include leap seconds.
- * {FB|FF}CLOCK_UPTIME: Time stamp should be relative to system boot, not epoch.
+ * The flags all set independent bits and so are OR-able.
+ * {FB|FF}CLOCK_FAST: Do not read the hardware counter, instead using the
+ * value at last tick. The time returned has a resolution
+ * of the kernel tick timer (1/hz [s]).
+ * FFCLOCK_LERP: Linear interpolation of ffclock time to guarantee
+ * monotonic time.
+ * FFCLOCK_LEAPSEC: Include leap seconds.
+ * {FB|FF}CLOCK_UPTIME: Time stamp should be relative to system boot, not epoch.
*/
-#define FFCLOCK_FAST 0x00000001
-#define FFCLOCK_LERP 0x00000002
-#define FFCLOCK_LEAPSEC 0x00000004
-#define FFCLOCK_UPTIME 0x00000008
-#define FFCLOCK_MASK 0x0000ffff
+#define FFCLOCK_FAST 0x00000001
+#define FFCLOCK_LERP 0x00000002
+#define FFCLOCK_LEAPSEC 0x00000004
+#define FFCLOCK_UPTIME 0x00000008
+#define FFCLOCK_MASK 0x0000ffff
-#define FBCLOCK_FAST 0x00010000 /* Currently unused. */
-#define FBCLOCK_UPTIME 0x00020000
-#define FBCLOCK_MASK 0xffff0000
+#define FBCLOCK_FAST 0x00010000 /* Currently unused. */
+#define FBCLOCK_UPTIME 0x00020000
+#define FBCLOCK_MASK 0xffff0000
/*
* Feedback clock specific info structure. The feedback clock's estimation of
@@ -108,26 +116,27 @@
* is determined by the userland daemon.
*/
struct fbclock_info {
- struct bintime error;
- struct bintime tick_time;
- uint64_t th_scale;
- int status;
+ struct bintime error;
+ struct bintime tick_time;
+ uint64_t th_scale;
+ int status;
};
/*
- * Feed-forward clock specific info structure. The feed-forward clock's
+ * Feedforward clock specific info structure. The feedforward clock's
* estimation of clock error is an upper bound, which although potentially
* looser than the feedback clock equivalent, is much more reliable. The status
* is determined by the userland daemon.
*/
struct ffclock_info {
- struct bintime error;
- struct bintime tick_time;
- struct bintime tick_time_lerp;
- uint64_t period;
- uint64_t period_lerp;
- int leapsec_adjustment;
- int status;
+ struct bintime error;
+ struct bintime tick_time;
+ struct bintime tick_time_lerp;
+ struct bintime tick_time_diff;
+ uint64_t period;
+ uint64_t period_lerp;
+ int leapsec_adjustment;
+ int status;
};
/*
@@ -137,11 +146,11 @@
* at the time of the read.
*/
struct sysclock_snap {
- struct fbclock_info fb_info;
- struct ffclock_info ff_info;
- ffcounter ffcount;
- unsigned int delta;
- int sysclock_active;
+ struct fbclock_info fb_info;
+ struct ffclock_info ff_info;
+ ffcounter ffcount;
+ unsigned int delta;
+ int sysclock_active;
};
/* Take a snapshot of the system clocks and related information. */
@@ -149,20 +158,20 @@
/* Convert a timestamp from the selected system clock into bintime. */
int sysclock_snap2bintime(struct sysclock_snap *cs, struct bintime *bt,
- int whichclock, uint32_t flags);
+ int clockfamily, uint32_t flags);
-/* Resets feed-forward clock from RTC */
+/* Resets feedforward clock from RTC */
void ffclock_reset_clock(struct timespec *ts);
/*
- * Return the current value of the feed-forward clock counter. Essential to
+ * Return the current value of the feedforward clock counter. Essential to
* measure time interval in counter units. If a fast timecounter is used by the
* system, may also allow fast but accurate timestamping.
*/
void ffclock_read_counter(ffcounter *ffcount);
/*
- * Retrieve feed-forward counter value and time of last kernel tick. This
+ * Retrieve feedforward counter value and time of last kernel tick. This
* accepts the FFCLOCK_LERP flag.
*/
void ffclock_last_tick(ffcounter *ffcount, struct bintime *bt, uint32_t flags);
@@ -176,7 +185,7 @@
void ffclock_convert_diff(ffcounter ffdelta, struct bintime *bt);
/*
- * Feed-forward clock routines.
+ * Feedforward clock routines.
*
* These functions rely on the timecounters and ffclock_estimates stored in
* fftimehands. Note that the error_bound parameter is not the error of the
@@ -199,7 +208,7 @@
struct bintime *error_bound);
/*
- * Wrapper routines to return current absolute time using the feed-forward
+ * Wrapper routines to return current absolute time using the feedforward
* clock. These functions are named after those defined in <sys/time.h>, which
* contains a description of the original ones.
*/
@@ -221,7 +230,7 @@
/*
* Wrapper routines to convert a time interval specified in ffcounter units into
- * seconds using the current feed-forward clock estimates.
+ * seconds using the current feedforward clock estimates.
*/
void ffclock_bindifftime(ffcounter ffdelta, struct bintime *bt);
void ffclock_nanodifftime(ffcounter ffdelta, struct timespec *tsp);
@@ -229,7 +238,7 @@
/*
* When FFCLOCK is enabled in the kernel, [get]{bin,nano,micro}[up]time() become
- * wrappers around equivalent feedback or feed-forward functions. Provide access
+ * wrappers around equivalent feedback or feedforward functions. Provide access
* outside of kern_tc.c to the feedback clock equivalent functions for
* specialised use i.e. these are not for general consumption.
*/
@@ -259,7 +268,7 @@
bintime_fromclock(struct bintime *bt, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_bintime(bt);
else
fbclock_bintime(bt);
@@ -269,7 +278,7 @@
nanotime_fromclock(struct timespec *tsp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_nanotime(tsp);
else
fbclock_nanotime(tsp);
@@ -279,7 +288,7 @@
microtime_fromclock(struct timeval *tvp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_microtime(tvp);
else
fbclock_microtime(tvp);
@@ -289,7 +298,7 @@
getbintime_fromclock(struct bintime *bt, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_getbintime(bt);
else
fbclock_getbintime(bt);
@@ -299,7 +308,7 @@
getnanotime_fromclock(struct timespec *tsp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_getnanotime(tsp);
else
fbclock_getnanotime(tsp);
@@ -309,7 +318,7 @@
getmicrotime_fromclock(struct timeval *tvp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_getmicrotime(tvp);
else
fbclock_getmicrotime(tvp);
@@ -319,7 +328,7 @@
binuptime_fromclock(struct bintime *bt, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_binuptime(bt);
else
fbclock_binuptime(bt);
@@ -329,7 +338,7 @@
nanouptime_fromclock(struct timespec *tsp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_nanouptime(tsp);
else
fbclock_nanouptime(tsp);
@@ -339,7 +348,7 @@
microuptime_fromclock(struct timeval *tvp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_microuptime(tvp);
else
fbclock_microuptime(tvp);
@@ -349,7 +358,7 @@
getbinuptime_fromclock(struct bintime *bt, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_getbinuptime(bt);
else
fbclock_getbinuptime(bt);
@@ -359,7 +368,7 @@
getnanouptime_fromclock(struct timespec *tsp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_getnanouptime(tsp);
else
fbclock_getnanouptime(tsp);
@@ -369,7 +378,7 @@
getmicrouptime_fromclock(struct timeval *tvp, int whichclock)
{
- if (whichclock == SYSCLOCK_FFWD)
+ if (whichclock == SYSCLOCK_FF)
ffclock_getmicrouptime(tvp);
else
fbclock_getmicrouptime(tvp);
@@ -377,7 +386,7 @@
#else /* !_KERNEL */
-/* Feed-Forward Clock system calls. */
+/* Feedforward Clock system calls. */
__BEGIN_DECLS
int ffclock_getcounter(ffcounter *ffcount);
int ffclock_getestimate(struct ffclock_estimate *cest);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 19, 8:11 PM (12 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34096113
Default Alt Text
D42936.diff (27 KB)
Attached To
Mode
D42936: sysclock: Bug fixes and cleanup
Attached
Detach File
Event Timeline
Log In to Comment