summaryrefslogtreecommitdiff
path: root/lib/frrcu.c
AgeCommit message (Collapse)Author
2021-03-17*: require semicolon after DEFINE_<typesafe...>David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-13lib: completely get rid of the MTYPE alias hackDavid Lamparter
Sometimes the easiest solution is hardest to find... the whole point of all this "static const", aliasing, & co. was to make "MTYPE_FOO" usable without adding the extra & as in "&MTYPE_FOO". Making it a size-1 array does that perfectly through the magic of ISO C array decay... Signed-off-by: David Lamparter <equinox@diac24.net>
2019-10-01lib: Fix static variable initializationJuergen Werner
Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-10-01lib: Revert "lib: Stop arm crash on shutdown"Juergen Werner
This reverts commit 11375c52740089b6b49ca7d56b2cea0c7208338c. That commit was introduced to fix a CI failure, which should now not accure due to the preceding commit/revert. Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-08-28lib: Stop arm crash on shutdownDonald Sharp
Arm platforms are crashing in our topotests with this callstack; 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. [Current thread is 1 (Thread 0xffffabb591d0 (LWP 18947))] (gdb) bt file=file@entry=0xaaaadfed1e48 "lib/memory.c", line=line@entry=80, function=function@entry=0xaaaadfed1db8 <__func__.10514> "mt_count_free") at lib/log.c:837 (gdb) So we are crashing because we are attempting to free a mtype that has no allocations associated with it. I added this debug code: @@ -227,7 +230,9 @@ static void rcu_bump(void) struct rcu_next *rn; rn = XMALLOC(MTYPE_RCU_NEXT, sizeof(*rn)); - + zlog_debug("RCU_BUMP"); + mtype_dump(MTYPE_RCU_THREAD); + mtype_dump(MTYPE_RCU_NEXT); /* note: each RCUA_NEXT item corresponds to exactly one seqno bump. * This means we don't need to communicate which seqno is which * RCUA_NEXT, since we really don't care. and added a mtype_dump function: +void mtype_dump(struct memtype *mt) +{ + zlog_debug("%s: %d", mt->name, (int)mt->n_alloc); +} Which resulted in this output: 2019/08/28 15:41:11 BGP: RCU_BUMP 2019/08/28 15:41:11 BGP: RCU thread: 3 2019/08/28 15:41:11 BGP: RCU thread: 3 If we look at the defintion of the two static memory types: DEFINE_MTYPE_STATIC(LIB, RCU_THREAD, "RCU thread") DEFINE_MTYPE_STATIC(LIB, RCU_NEXT, "RCU sequence barrier") I would have expected the output to be: RCU_BUMP RCU thread: 3 RCU sequence barrier: X instead. As a thought experiment I reduced the number of static memory types to 1 in the file and the crash stopped happening. I suspect we have a systematic error on arm in lib/memory.h due to the asm code. I am going to leave that alone for the moment ( and leave the crash issue open ), but see if we can get this code change into the system so that our CI system becomes happy again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-31lib: RCUDavid Lamparter
Please refer to doc/developer/rcu.rst for documentation. Signed-off-by: David Lamparter <equinox@diac24.net>