summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/time.c
AgeCommit message (Collapse)AuthorFilesLines
2020-10-17vppinfra: explicitly export symbolsDamjan Marion1-4/+4
Type: improvement Change-Id: I57a9f85f7df1fc48656b72592349f4c544302f77 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-03-10vppinfra: improve timebase resilienceDave Barach1-3/+20
Deal with arbitrary kernel reference time changes: for example, yanking the kernel reference clock back to a time before vpp started. Best practice involves aligning the kernel reference clock with reality prior to starting apps which use 10us granularity timers. Compute change in the reference and cpu clocks. Recompute the vpp start time reference and and total cpu clock count, using the current clock tick rate. Next, compute a new clock rate sample. If the sample seems sane, factor it into the exponentially smoothed clock rate and recalculate total cpu ticks based on the new clock rate. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ib6132ffbbe0e6d140725676de5e35be112a31dfe
2020-03-08vppinfra: fix 32-bit overflow in os_cpu_clock_frequencyDamjan Marion1-1/+1
Type: fix Change-Id: I23250fcbc70086584b5448baec9af9a1528992f5 Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2020-02-05vppinfra: deal with 0 return from os_cpu_clock_frequency()Dave Barach1-0/+16
Sporadic reports of os_cpu_clock_frequency() returning 0.0 in highly parallel container environments. To avoid immediate division by zero: Step 1: try estimate_clock_frequency(1e-3). Step 2: give up. Pretend we have a 2gHz clock. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I19d0fe5259b757ab778599c7026ce485153b43fa
2020-01-30vppinfra: improve clocks_per_second convergenceDave Barach1-52/+68
Apply exponential smoothing to the clock rate update calculation in clib_time_verify_frequency(), with a half-life of 1 minute and a sampling frequency of 16 seconds. Within 5 minutes or so, the calculation converges With each rate recalculation: reset total_cpu_time based on the kernel timebase delta since vpp started, and the new clock rate Improve the "show clock [verbose]" debug CLI command. BFD echo + echo fail tests marked off until the BFD code can be reworked a bit. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I24e88a78819b12867736c875067b386ef6115c5c
2020-01-27vppinfra: use CPUID provided base frequency if availableDamjan Marion1-0/+32
Type: fix Change-Id: Ifb007207be97119e07c3a0eba4714eb519de043c Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-12-02vppinfra: preserve total_cpu_time across clock freq adjustmentDave Barach1-3/+14
If clib_time_verify_frequency() adjusts the clock frequency, transform total_cpu_time to the new time coordinate space. Otherwise, we break comparisons with previous clib_time_now() value. Without this correction, time jumps in one direction or the other depending on the sign of the frequency change. Reasonably harmless in most cases, but under perfect storm conditions the wheels fall off. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I21802c2630e2c87ff817cd732b7d78bc022cd2d7
2018-11-15VPP-1474: fix 2x coverity warningsDave Barach1-2/+2
Change-Id: I441beaf3d7f57886580d7cce35ef592aa0fcca5f Signed-off-by: Dave Barach <dave@barachs.net>
2018-11-08Calculate clock rounding constantDave Barach1-3/+18
Compute the first power of ten which is greater than 0.1% of the clock rate. Save the result, and use it to round future results. The previous constant value - 1e7 - didn't work properly on aarch64. Change-Id: Ic021e3eb1b90c0d4a7d9f1b6425123f0c8b48b0b Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-23c11 safe string handling supportDave Barach1-1/+1
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-09-07Improve NTP / kernel time change event handlingDave Barach1-0/+20
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>
2018-05-30Fix clang compilation on aarch64: value size does not match register size.Sirshak Das1-1/+1
Fixes clang error: value size does not match register size specified by the constraint and modifier Change-Id: I83e69445eacd6570607334e086a8582addb5bdfc Signed-off-by: Sirshak Das <sirshak.das@arm.com> Reviewed-by: Brian Brooks <brian.brooks@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2018-01-30Arm system counter cleanupBrian Brooks1-6/+9
Add some description and cleanup code that uses Arm system counter. Change-Id: Ie1fe00e3e4b5d98867617b7b0184ac526e333c53 Signed-off-by: Brian Brooks <brian.brooks@arm.com>
2017-10-03Repair vlib API socket serverDave Barach1-2/+2
- Teach vpp_api_test to send/receive API messages over sockets - Add memfd-based shared memory - Add api messages to create memfd-based shared memory segments - vpp_api_test supports both socket and shared memory segment connections - vpp_api_test pivot from socket to shared memory API messaging - add socket client support to libvlibclient.so - dead client reaper sends ping messages, container-friendly - dead client reaper falls back to kill (<pid>, 0) live checking if e.g. a python app goes silent for tens of seconds - handle ping messages in python client support code - teach show api ring about pairwise shared-memory segments - fix ip probing of already resolved destinations (VPP-998) We'll need this work to implement proper host-stack client isolation Change-Id: Ic23b65f75c854d0393d9a2e9d6b122a9551be769 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-03-21armv8 - fix os_cpu_clock_frequency for armv8Gabriel Ganne1-0/+6
System timer of ARMv8 runs at a different frequency than the CPU's. The frequency is fixed, typically in the range 1-50MHz. It can be read at CNTFRQ special register. Change-Id: I6a21a6a9e2df783559df0caec63d5525c2258227 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+226
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>