summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2023-04-25Refactoring of domains connected to poolsMaria Matejka
2023-04-24Resource pools are now bound with domains.Maria Matejka
Memory allocation is a fragile part of BIRD and we need checking that everybody is using the resource pools in an appropriate way. To assure this, all the resource pools are associated with locking domains and every resource manipulation is thoroughly checked whether the appropriate locking domain is locked. With transitive resource manipulation like resource dumping or mass free operations, domains are locked and unlocked on the go, thus we require pool domains to have higher order than their parent to allow for this transitive operations. Adding pool locking revealed some cases of insecure memory manipulation and this commit fixes that as well.
2023-04-22Protocols and tables now use the birdloop pools as primaryMaria Matejka
2023-04-22Resource pool closing has its dedicated functionMaria Matejka
2023-04-22Socket closing has its dedicated functionMaria Matejka
2023-04-22Typed lists: added add_after() and unit testsMaria Matejka
2023-04-19Typed lists keep an explicit pointer to the list head.Maria Matejka
This change adds one pointer worth of memory to every list node. Keeping this information helps auditing the lists, checking that the node indeed is outside of list or inside the right one. The typed lists shouldn't be used anywhere with memory pressure anyway, thus the one added pointer isn't significant.
2023-04-17IO: added a specific loop pickup group for BFD; to be done better in futureMaria Matejka
2023-04-14Merge commit '231c6385' into thread-next-ifaceMaria Matejka
2023-04-14Merge commit '6c058ae4' into thread-next-ifaceMaria Matejka
2023-04-06Loop: keep running the same loop for some time if there is work to doMaria Matejka
2023-04-04Sockets: Unified API for main and other loopsMaria Matejka
Now sk_open() requires an explicit IO loop to open the socket in. Also specific functions for socket RX pause / resume are added to allow for BGP corking. And last but not least, socket reloop is now synchronous to resolve weird cases of the target loop stopping before actually picking up the relooped socket. Now the caller must ensure that both loops are locked while relooping, and this way all sockets always have their respective loop.
2023-04-04More efficient IO loop event execution to avoid long loopsMaria Matejka
If there are lots of loops in a single thread and only some of the loops are actually active, the other loops are now kept aside and not checked until they actually get some timers, events or active sockets. This should help with extreme loads like 100k tables and protocols. Also ping and loop pickup mechanism was allowing subtle race conditions. Now properly handling collisions between loop ping and pickup.
2023-04-04Resource dumps also write out block addressesMaria Matejka
2023-04-04Linpool: State restoration works in initial linpool stateMaria Matejka
2023-04-04Propagated const through route feed routinesMaria Matejka
2023-04-04Fixed bad filter re-evaluation with import table if filtered->acceptedMaria Matejka
The import table feed wasn't resetting the table-specific route values like REF_FILTERED and thus made the route look like filtered even though it should have been re-evaluated as accepted.
2023-03-06Net: Replace runtime checks with STATIC_ASSERT()Ondrej Zajicek
2023-03-06Printf test suite fails on systems with musl libc because tests for "%m"Petr Vaněk
and "%M" formats expect "Input/output error" message but musl returns "I/O error". Proposed change compares the printf output with string returned from strerror function for EIO constant. See-also: https://bugs.gentoo.org/836713 Minor change from committer.
2023-02-22Linpool flush drops all the allocated pages but oneMaria Matejka
When a linpool is used to allocate a one-off big load of memory, it makes no sense to keep that amount of memory for future use inside the linpool. Contrary to previous implementations where the memory was directly free()d, we now use the page allocator which has an internal cache which keeps the released pages for us and subsequent allocations simply get these released pages back. And even if the page cleanup routine kicks in inbetween, the pages get only madvise()d, not munmap()ed so performance aspects are negligible. This may fix some memory usage peaks in extreme cases.
2023-02-07Protocol shutdown/restart from limits is respecting the loopsMaria Matejka
2023-02-07Merge commit '0bb04d5390f21b0c96fc4894ba5d5510c541f0ef' into HEADMaria Matejka
2023-02-02Macro: stringifyMaria Matejka
2023-02-02Lists: fixed bugs in expensive checks in quirky usecasesMaria Matejka
2023-02-02Typed lists: shortcut for simple nodesMaria Matejka
2023-01-23Merge commit '7fb23041a52d01754c53ba963e2282e524813364' into thread-nextMaria Matejka
2023-01-20Fixed various build problems on FreeBSD and/or CLangMaria Matejka
2023-01-19Decoupling loops from threads to allow fixed thread countMaria Matejka
On large configurations, too many threads would spawn with one thread per loop. Therefore, threads may now run multiple loops at once. The thread count is configurable and may be changed during run. All threads are spawned on startup. This change helps with memory bloating. BIRD filters need large temporary memory blocks to store their stack and also memory management keeps its hot page storage per-thread. Known bugs: * Thread autobalancing is not yet implemented. * Low latency loops are executed together with standard loops.
2023-01-19Removed config reparsing from unrelated testsMaria Matejka
2023-01-12Log message before abortingMike Crute
Log message before aborting due to watchdog timeout. We have to use async-safe write to debug log, as it is done in signal handler. Minor changes from committer.
2022-11-07Merge commit '8478de88' into thread-nextMaria Matejka
2022-10-12Attribute blocks are now allocated from slabs instead of malloc()Maria Matejka
2022-10-12Tamed slab signedness warning on 32-bit architecturesMaria Matejka
2022-09-21Local page allocationMaria Matejka
2022-09-18Fixing several race-conditions in event code.Maria Matejka
After a suggestion by Santiago, I added the direct list pointer into events and the events are now using this value to check whether the route is active or not. Also the whole trick with sentinel node unioned with event list is now gone. For debugging, there is also an internal circular buffer to store what has been recently happening in event code before e.g. a crash happened. By default, this debug is off and must be manually enabled in lib/event.c as it eats quite some time and space.
2022-09-18Loop flags: a simple idempotent event announcement mechanismMaria Matejka
2022-09-18Routing tables have their own service loops.Maria Matejka
2022-09-18Memory pages allocator is now a global simple lockless structureMaria Matejka
2022-09-09Created a dedicated settle timer structureMaria Matejka
2022-09-08Table access is now locked.Maria Matejka
2022-08-03Merge commit '038fcf1c' into thread-nextMaria Matejka
It was necessary to update the code to match removal of rta, as well as existence of cached nested attribute lists.
2022-08-03Merge commit '97476e00' into thread-nextMaria Matejka
Had to fix route source locking inside BGP export table as we need to keep the route sources properly allocated until even last BGP pending update is sent out, therefore the export table printout is accurate.
2022-08-02Merge commit 'f0507f05ce57398e135651896dace4cb68eeed54' into thread-nextMaria Matejka
2022-08-02Introducing basic RCU primitives for lock-less shared data structuresMaria Matejka
2022-08-01Fixed main birdloop init in unit testsMaria Matejka
Some unit tests weren't initializing the birdloop, trying to write the birdloop ping into stdin. Fixed this and also forced stdin close on startup of every test just to be sure that CI and local build behave the same in this. (CI was failing on this while local build not.)
2022-07-28Sending an event must also ping the target IO loopMaria Matejka
2022-07-28Moved the thread starting code to IO loop codeMaria Matejka
2022-07-18Event lists rewritten to a single linked listMaria Matejka
In multithreaded environment, we need to pass messages between workers. This is done by queuing events to their respective queues. The double-linked list is not really useful for that as it needs locking everywhere. This commit rewrites the event subsystem to use a single-linked list where events are enqueued by a single atomic instruction and the queue is processed after atomically moving the whole queue aside.
2022-07-18Merge commit '94eb0858' into thread-nextMaria Matejka
2022-07-18Merge commit 'a4451535' into thread-nextMaria Matejka