mirror_frr/lib
Donald Sharp a8ca407929 lib: Fix FreeBSD clock_gettime(CLOCK_THREAD_CPUTIME_ID,..) going backwards
On FreeBSD I have noticed that subsuquent calls to clock_gettime(..)
can return an after time that is before first calls value.
This in turn is generating CPU_HOG's because the subtraction
is wrapping into very very large numbers:

2022/02/28 20:12:58 SHARP: [PTDQA-70FG5]     start: 35.741981000  now: 35.740581000
2022/02/28 20:12:58 SHARP: [XK9YH-ZD8FA][EC 100663313] CPU HOG: task zclient_read (800744240) ran for 0ms (cpu time 18446744073709550ms)

(Please note I added the first line of debug to figure this issue out).

I have been asked to open a FreeBSD bug report and have done so.
In the mean time I think that it is important that FRR does
not generate bogus CPU HOG's on FreeBSD ( especially since
this may or may not be easily fixed and FRR has no control
over what version of the operating system, operators are
going to be running with FRR.

So, add a bit of specialized code that checks to see if
the after time in FreeBSD is before the now time in
thread_consumed_time and do some quick manipulations
to not have this issue.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4e2839de64)
2022-03-01 18:49:40 +00:00
..
assert lib: rework how we "override" assert() 2021-05-02 16:27:17 +02:00
printf *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
.gitignore
agentx.c *: don't pass pointers to a local variables to thread_add_* 2021-10-07 16:01:03 +03:00
agg_table.c lib: make some variables static 2019-12-13 06:22:34 +01:00
agg_table.h *: Create/Use accessor functions for lock count 2020-10-17 13:39:10 -04:00
atomlist.c lib: avoid include loop with assert.h 2021-11-10 12:36:50 +01:00
atomlist.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
bfd.c lib: fix the right value is returned for fail cases 2022-01-12 08:08:29 -05:00
bfd.h lib: rename one bfd parameter name to reflect real meaning 2022-01-10 08:15:08 -05:00
bitfield.h lib: add an MTYPE for bitfields 2021-06-18 09:34:43 +01:00
buffer.c lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
buffer.h
checksum.c
checksum.h
clippy.c lib: rework how we "override" assert() 2021-05-02 16:27:17 +02:00
clippy.h lib/clippy: add libelf wrapper 2021-02-23 16:56:58 +01:00
command_graph.c lib: assign CLI varnames while parsing 2021-10-18 19:48:11 +02:00
command_graph.h lib: assign CLI varnames while parsing 2021-10-18 19:48:11 +02:00
command_lex.l lib: add ![...] syntax for easy "no" forms 2021-08-26 21:03:44 +02:00
command_match.c lib: fix segfault on question mark on empty line 2021-09-14 15:12:23 +03:00
command_match.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
command_parse.y lib: assign CLI varnames while parsing 2021-10-18 19:48:11 +02:00
command_py.c lib: fix indentation trainwreck in command_py 2021-08-26 21:08:51 +02:00
command.c *: Add necessary new line for output of vty_out() 2022-02-27 12:44:34 +00:00
command.h lib: rework vty_check_node_for_xpath_decrement 2021-11-16 18:51:22 +01:00
compiler.h Merge pull request #8888 from dlqs/lua-call 2021-07-05 04:13:20 +00:00
csv.c lib: Avoid using assignments within checks 2021-06-29 22:27:49 +03:00
csv.h
db.c lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
db.h
debug.c *: require semicolon after DEFINE_<typesafe...> 2021-03-17 06:18:39 +01:00
debug.h *: require semicolon after DEFINE_<typesafe...> 2021-03-17 06:18:39 +01:00
defaults.c build: make builddir include path consistent 2021-04-21 15:42:33 +02:00
defaults.h *: require semicolon after FRR_CFG_DEFAULT_* 2021-03-17 06:18:39 +01:00
defun_lex.l lib: fix some misc SA warnings 2021-02-17 17:01:06 -05:00
distribute.c lib: Remove dead code 2021-05-04 16:23:37 -04:00
distribute.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
elf_py.c lib/clippy: don't endian-convert twice 2022-01-18 10:20:34 +01:00
ferr.c lib: use vty_json() 2021-11-17 16:01:30 +01:00
ferr.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
filter_cli.c lib: Add autocomplete for access-lists 2021-10-31 20:26:06 +02:00
filter_nb.c lib: fix prefix-list duplication check 2021-08-10 22:31:42 +03:00
filter.c lib: use json-printf in filter code 2021-11-17 16:01:30 +01:00
filter.h lib: northbound cli show/cmd functions must not modify data nodes 2021-10-13 20:12:35 +03:00
freebsd-queue.h
frr_pthread.c lib: hard-fail creating threads before fork() 2021-04-22 13:25:38 +02:00
frr_pthread.h *: generously apply const 2019-12-02 15:01:29 +01:00
frr_zmq.c Merge pull request #9751 from ewlumpkin/comment_spelling_fixes 2021-10-14 02:05:44 +03:00
frr_zmq.h lib: avoid double-free in zmq wrapper callbacks 2021-08-19 13:31:33 -04:00
frratomic.h lib/atomlist: make C++ compatible 2020-04-21 21:38:07 +02:00
frrcu.c *: require semicolon after DEFINE_<typesafe...> 2021-03-17 06:18:39 +01:00
frrcu.h lib: avoid include loop with assert.h 2021-11-10 12:36:50 +01:00
frrlua.c lib: Add encoder/decoder for nexthop/nexthop group 2021-10-20 00:56:00 +08:00
frrlua.h lib: Add encoder/decoder for nexthop/nexthop group 2021-10-20 00:56:00 +08:00
frrscript.c lib: Return Null when we have an empty string for script name 2021-11-01 07:29:10 -04:00
frrscript.h lib: Add frrscript names hash 2021-10-20 00:56:00 +08:00
frrstr.c lib: add frrstr_hex to hexdump buffers 2021-08-12 16:25:57 -04:00
frrstr.h lib: add frrstr_hex to hexdump buffers 2021-08-12 16:25:57 -04:00
getopt1.c
getopt.c *: fix for -Wstrict-prototypes 2021-09-02 13:00:35 +02:00
getopt.h treewide: fix some issues found with -Werror=undef 2020-03-10 16:53:13 +01:00
gitversion.pl build: fix auto git ID length 2020-01-17 15:54:50 +01:00
grammar_sandbox_main.c lib: adapt to version 2 of libyang 2021-05-13 16:24:48 -04:00
grammar_sandbox.c vtysh: defer CLI tree building 2021-10-18 19:48:11 +02:00
graph.c lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
graph.h
hash.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
hash.h lib: Update hash.h documentation to warn of a possible crash 2022-02-09 10:46:33 +00:00
hook.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
hook.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
iana_afi.h lib, zebra: add missing extern "C" {} blocks to new header files 2020-04-22 23:49:22 -03:00
id_alloc.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
id_alloc.h
if_rmap.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
if_rmap.h
if.c lib: Fix possible usage of uninited data 2022-02-23 17:34:57 +00:00
if.h *: do not print vrf name for interface config when using vrf-lite 2022-01-24 14:44:05 +03:00
imsg-buffer.c *: Remove parenthesis on return for constants 2020-02-09 14:21:56 +02:00
imsg.c *: Remove parenthesis on return for constants 2020-02-09 14:21:56 +02:00
imsg.h
ipaddr.h vrrpd: use ipaddr_is_zero when needed 2022-01-27 21:05:40 +03:00
jhash.c
jhash.h
json.c lib: add printfrr to json string helpers 2021-11-17 16:01:30 +01:00
json.h lib: add printfrr to json string helpers 2021-11-17 16:01:30 +01:00
keychain.c *: explicitly print "exit" at the end of every node config 2021-08-23 22:08:20 +03:00
keychain.h *: require semicolon after DEFINE_QOBJ & co. 2021-03-17 06:18:37 +01:00
ldp_sync.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
ldp_sync.h ldpd, isisd, ospfd: Remove periodic ldp-sync hello message 2020-12-09 14:11:38 -05:00
lib_errors.c lib: Figure out if we are being starved for cpu 2022-01-20 11:56:27 -05:00
lib_errors.h lib: Figure out if we are being starved for cpu 2022-01-20 11:56:27 -05:00
lib_vty.c northbound: KISS always batch yang config (file read), it's faster 2021-06-02 14:05:26 +00:00
lib_vty.h lib: rename memory_vty.c to lib_vty.c 2019-12-06 15:13:29 +01:00
libfrr_trace.c *: make sure config.h or zebra.h is first 2021-04-23 12:06:35 +02:00
libfrr_trace.h lib, bgpd: convert lttng tracepoints to frrtrace() 2020-10-23 15:13:51 -04:00
libfrr.c Merge pull request #10183 from idryzhov/rework-vrf-rename 2022-01-17 08:45:12 -03:00
libfrr.h lib: shuffle around command line options 2021-12-14 18:12:20 +01:00
libospf.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
link_state.c lib: Update Link State functions to handle IPv6 2021-11-30 15:22:28 +01:00
link_state.h lib: Update Link State functions to handle IPv6 2021-11-30 15:22:28 +01:00
linklist.c lib: kill unused list_filter_out_nodes() 2021-05-03 20:56:55 +02:00
linklist.h lib: kill unused list_filter_out_nodes() 2021-05-03 20:56:55 +02:00
log_filter.c lib: include \n in zlog_msg_text() 2021-06-18 21:05:21 +02:00
log_vty.c vtysh: dispatch unique-id backtrace cmd properly 2021-11-16 18:51:22 +01:00
log_vty.h lib: make a few log symbols accessible 2021-06-18 21:05:21 +02:00
log.c *: Rename quagga_timestamp with frr_timestamp 2021-11-11 14:41:27 -05:00
log.h *: Rename quagga_timestamp with frr_timestamp 2021-11-11 14:41:27 -05:00
Makefile
md5.c *: Do not cast to the same type 2020-04-08 17:15:06 +03:00
md5.h
memory.c lib: add an MTYPE for bitfields 2021-06-18 09:34:43 +01:00
memory.h *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
mlag.c lib: Ensure pointer exists before using in mlag 2020-03-20 18:17:40 -04:00
mlag.h lib, pimd, zebra: Provide some insurance against reading bad stream data 2020-03-06 16:03:59 -05:00
module.c lib/module.c and callers of frrmod_load(): fix error messages 2021-09-14 09:51:49 -07:00
module.h lib/module.c and callers of frrmod_load(): fix error messages 2021-09-14 09:51:49 -07:00
monotime.h lib: add time formatting printfrr exts 2022-01-14 13:33:57 +01:00
mpls.c zebra,lib: use const in more apis 2020-03-27 09:37:02 -04:00
mpls.h ldpd: Fix issue when starting up LDP with no configuration. 2020-09-04 09:24:47 -04:00
netns_linux.c lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
netns_other.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
network.c lib: Avoid using assignments within checks 2021-06-29 22:27:49 +03:00
network.h *: frr-format with unmodified GCC 2021-09-28 11:20:32 +02:00
nexthop_group_private.h lib,zebra: use nhg_hash_entry pointer in route_entry 2019-12-04 08:13:52 -05:00
nexthop_group.c *: Remove unused variables 2021-11-18 18:45:41 +02:00
nexthop_group.h *: require semicolon after DEFINE_QOBJ & co. 2021-03-17 06:18:37 +01:00
nexthop.c *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
nexthop.h bgpd: VRF-Lite fix nexthop type 2021-09-07 01:50:06 -07:00
northbound_cli.c lib: northbound cli show/cmd functions must not modify data nodes 2021-10-13 20:12:35 +03:00
northbound_cli.h lib: northbound cli show/cmd functions must not modify data nodes 2021-10-13 20:12:35 +03:00
northbound_confd.c lib: confd: fix format-truncation warnings 2021-11-11 23:05:46 -08:00
northbound_db.c lib: libyang2 add missed conversion 2021-05-17 22:13:59 -04:00
northbound_db.h
northbound_grpc.cpp lib: prevent gRPC assert on missing YANG node 2021-10-05 10:22:27 -03:00
northbound_sysrepo.c *: don't pass pointers to a local variables to thread_add_* 2021-10-07 16:01:03 +03:00
northbound.c lib: Do not use sizeof() on size_t errmsg_len. 2021-11-18 22:44:00 +08:00
northbound.h lib: northbound cli show/cmd functions must not modify data nodes 2021-10-13 20:12:35 +03:00
ns.h vrf: VRF_DEFAULT must be 0, remove useless code 2020-09-21 10:17:35 +02:00
ntop.c lib: Avoid using assignments within checks 2021-06-29 22:27:49 +03:00
openbsd-queue.h
openbsd-tree.c *: Remove parenthesis on return for constants 2020-02-09 14:21:56 +02:00
openbsd-tree.h
pbr.h pbrd: add vlan actions to vty 2021-10-07 09:14:59 -04:00
pid_output.c build: make builddir include path consistent 2021-04-21 15:42:33 +02:00
plist_int.h *: cleanup number-named access-lists and prefix-lists 2021-04-14 17:18:13 +03:00
plist.c bgpd: fix BGP ORF Prefix-length matching 2021-12-14 14:53:53 +01:00
plist.h lib, pimd: add address match mode to prefix lists 2021-07-06 01:44:34 +02:00
prefix.c *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
prefix.h pimd: move %pSG4 to %pPSG4 2022-01-12 18:24:07 +01:00
printfrr.h *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
privs.c lib: Add ZCAP_IPC_LOCK 2021-05-11 19:54:40 -04:00
privs.h lib: Add ZCAP_IPC_LOCK 2021-05-11 19:54:40 -04:00
ptm_lib.c *: sprintf -> snprintf 2020-04-20 19:14:33 -04:00
ptm_lib.h
pullwr.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
pullwr.h lib, zebra: add missing extern "C" {} blocks to new header files 2020-04-22 23:49:22 -03:00
pw.h ldpd: Relay data plane pseudowire status in LDP notification 2020-06-01 13:21:37 -04:00
qobj.c *: require semicolon after DEFINE_<typesafe...> 2021-03-17 06:18:39 +01:00
qobj.h *: require semicolon after DEFINE_<typesafe...> 2021-03-17 06:18:39 +01:00
queue.h
resolver.c lib: resolver per vrf support 2021-11-23 09:02:23 +01:00
resolver.h lib: resolver per vrf support 2021-11-23 09:02:23 +01:00
ringbuf.c Revert "lib: add ringbuf socket read function" 2021-04-29 12:12:32 -04:00
ringbuf.h Revert "lib: add ringbuf socket read function" 2021-04-29 12:12:32 -04:00
route_opaque.h lib, ospfd, ospf6d, zebra: add OSPF opaque route attributes 2022-01-15 17:22:27 +01:00
route_types.pl lib: restore blank line after show route header 2021-01-27 12:19:52 +00:00
route_types.txt lib: remove quagga from route_types.txt 2021-07-19 08:43:48 -04:00
routemap_cli.c lib: routemap config output cleanup 2021-12-03 21:00:01 +03:00
routemap_northbound.c bgpd: Add an ability to match ipv6 next-hop by prefix-list 2021-11-24 16:28:31 +02:00
routemap.c bgpd: Add an ability to match ipv6 next-hop by prefix-list 2021-11-24 16:28:31 +02:00
routemap.h bgpd: Add an ability to match ipv6 next-hop by prefix-list 2021-11-24 16:28:31 +02:00
routing_nb_config.c *: make sure config.h or zebra.h is first 2021-04-23 12:06:35 +02:00
routing_nb.c *: make sure config.h or zebra.h is first 2021-04-23 12:06:35 +02:00
routing_nb.h tests: add grpc unit test 2021-06-06 18:03:17 +00:00
sbuf.c lib: use snprintfrr() in "hidden" printfs 2019-06-12 19:35:43 +02:00
sbuf.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
seqlock.c treewide: fix some issues found with -Werror=undef 2020-03-10 16:53:13 +01:00
seqlock.h lib, zebra: add missing extern "C" {} blocks to new header files 2020-04-22 23:49:22 -03:00
sha256.c build: remove deprecated AC_WORDS_BIGENDIAN 2021-04-21 15:42:37 +02:00
sha256.h
sigevent.c *: Convert quagga_signal_X to frr_signal_X 2021-11-11 14:41:27 -05:00
sigevent.h *: Convert quagga_signal_X to frr_signal_X 2021-11-11 14:41:27 -05:00
skiplist.c lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
skiplist.h lib: fix spelling nits in more lib files 2021-10-05 21:42:57 +00:00
smux.h lib, bgpd: add a specific oid_copy function for IPv6 addrs 2021-03-25 15:24:50 +00:00
snmp.c *: use compiler.h MIN/MAX macros instead of everyone having one 2021-11-11 09:39:52 -05:00
sockopt.c lib: finish fixing spelling in lib files 2021-10-22 03:06:16 +00:00
sockopt.h bgpd: Support tcp-mss for bgp neighbors 2021-05-04 06:21:24 +00:00
sockunion.c *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
sockunion.h lib: use in6addr comparator in test 2021-06-23 00:58:04 +08:00
spf_backoff.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
spf_backoff.h *: use the current project name (FRRouting) 2020-03-25 17:38:56 -04:00
srcdest_table.c *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
srcdest_table.h staticd : Configuration northbound implementation 2020-07-16 08:33:00 -07:00
srte.h lib, zebra: Add SR-TE policy infrastructure to zebra 2020-08-07 11:08:49 +02:00
srv6.c zebra: Add support for json output in srv6 locator detail command 2021-11-28 23:53:41 +00:00
srv6.h zebra: Add support for json output in srv6 locator detail command 2021-11-28 23:53:41 +00:00
stream.c bgpd: Convert bgp_addpath_encode_[tr]x() to bool from int 2022-02-23 21:38:12 +02:00
stream.h bgpd: Convert bgp_addpath_encode_[tr]x() to bool from int 2022-02-23 21:38:12 +02:00
strformat.c *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
strlcat.c *: require ISO C11 (or C++11) 2021-03-17 06:18:17 +01:00
strlcpy.c
subdir.am build: fix duplicate yang.c file inclusions 2021-11-11 15:49:40 +01:00
systemd.c lib: fix coverity unused result warning 2021-07-07 14:58:14 +02:00
systemd.h lib, watchfrr: remove HAVE_SYSTEMD, use own code 2021-06-29 17:57:04 +02:00
table.c lib: finish fixing spelling in lib files 2021-10-22 03:06:16 +00:00
table.h lib: remove pure attribute from functions that modify memory 2021-06-18 19:54:40 +03:00
termtable.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
termtable.h *: generously apply const 2019-12-02 15:01:29 +01:00
thread.c lib: Fix FreeBSD clock_gettime(CLOCK_THREAD_CPUTIME_ID,..) going backwards 2022-03-01 18:49:40 +00:00
thread.h lib: Save number of times a thread is starved 2022-02-17 16:09:20 +00:00
trace.h lib: add trace.h, frrtrace(), support for USDT 2020-10-23 15:13:51 -04:00
typerb.c lib: typesafe *_member() 2021-10-19 14:55:39 +02:00
typerb.h lib: add missing include in typerb.h 2021-11-10 10:39:17 +01:00
typesafe.c lib: avoid include loop with assert.h 2021-11-10 12:36:50 +01:00
typesafe.h lib: avoid include loop with assert.h 2021-11-10 12:36:50 +01:00
vector.c lib: remove vector_get_index() 2021-11-08 14:07:30 +01:00
vector.h lib: remove vector_get_index() 2021-11-08 14:07:30 +01:00
version.h.in build: make builddir include path consistent 2021-04-21 15:42:33 +02:00
vlan.h
vrf_int.h
vrf.c Merge pull request #10183 from idryzhov/rework-vrf-rename 2022-01-17 08:45:12 -03:00
vrf.h *: rework renaming the default VRF 2021-12-21 22:09:29 +03:00
vty.c Merge pull request #10084 from opensourcerouting/json-sugar 2021-11-18 10:33:52 +02:00
vty.h lib: add vty_json() helper 2021-11-17 16:01:30 +01:00
vxlan.h lib: finish fixing spelling in lib files 2021-10-22 03:06:16 +00:00
wheel.c *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
wheel.h
workqueue.c lib, zebra: Add ability to tell thread system to ignore late timers 2022-01-20 11:58:48 -05:00
workqueue.h *: require semicolon after DEFINE_MTYPE & co 2021-03-17 06:18:17 +01:00
xref.c lib: stuff xrefs into a tree for lookup 2021-11-10 10:39:17 +01:00
xref.h lib: stuff xrefs into a tree for lookup 2021-11-10 10:39:17 +01:00
yang_translator.c lib: adapt to version 2 of libyang 2021-05-13 16:24:48 -04:00
yang_translator.h
yang_wrappers.c lib: adapt to version 2 of libyang 2021-05-13 16:24:48 -04:00
yang_wrappers.h lib: yang wrapper for getting empty type 2020-08-11 17:06:23 -07:00
yang.c lib: avoid pointless search for built-in IETF YANG 2022-01-17 09:46:15 +01:00
yang.h lib: finish fixing spelling in lib files 2021-10-22 03:06:16 +00:00
zclient.c *: rework renaming the default VRF 2021-12-21 22:09:29 +03:00
zclient.h lib: rename bfd function to reflect real functionality 2021-11-15 18:16:30 +03:00
zebra.h *: Add FOREACH_AFI_SAFI_NSF(afi, safi) macro to reduce nesting 2022-01-13 14:29:54 +02:00
zlog_targets.c lib: make a few log symbols accessible 2021-06-18 21:05:21 +02:00
zlog_targets.h lib, zebra: add missing extern "C" {} blocks to new header files 2020-04-22 23:49:22 -03:00
zlog.c lib: add debug uid XXXXX-XXXXX backtrace 2021-11-10 12:36:50 +01:00
zlog.h lib: add debug uid XXXXX-XXXXX backtrace 2021-11-10 12:36:50 +01:00