summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDave Barach <dbarach@cisco.com>2018-09-07 11:12:27 -0400
committerDamjan Marion <dmarion@me.com>2018-09-07 19:38:50 +0000
commit36feebb42f1fb9734c1b99b4afae87d3c8233548 (patch)
tree099474480f66d765896a2824c87adead71ade7ce /src/vlib
parent833de8cab672c806176d580a1ebc001f394b2eaf (diff)
Improve NTP / kernel time change event handling
clib_time_verify_frequency(...) rejects clock frequency changes greater than 1%. vlib_worker_thread_barrier_sync_int (...) continuously checks that the barrier hold-down timer is not unreasonably far in the future. Change-Id: I00ecb4c20e44de5d6a9c1499fa933e3dd834d11a Signed-off-by: Dave Barach <dbarach@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/threads.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 8e75592c0e2..1972886a78b 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -1466,9 +1466,21 @@ vlib_worker_thread_barrier_sync_int (vlib_main_t * vm)
/* Enforce minimum barrier open time to minimize packet loss */
ASSERT (vm->barrier_no_close_before <= (now + BARRIER_MINIMUM_OPEN_LIMIT));
- while ((now = vlib_time_now (vm)) < vm->barrier_no_close_before)
- ;
+ while (1)
+ {
+ now = vlib_time_now (vm);
+ /* Barrier hold-down timer expired? */
+ if (now >= vm->barrier_no_close_before)
+ break;
+ if ((vm->barrier_no_close_before - now)
+ > (2.0 * BARRIER_MINIMUM_OPEN_LIMIT))
+ {
+ clib_warning ("clock change: would have waited for %.4f seconds",
+ (vm->barrier_no_close_before - now));
+ break;
+ }
+ }
/* Record time of closure */
t_open = now - vm->barrier_epoch;
vm->barrier_epoch = now;