0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 09:58:43 +00:00
Commit Graph

680 Commits

Author SHA1 Message Date
Maria Matejka
8424941f95 Forbid locking altogether when RCU reader is active 2024-06-27 08:42:18 +02:00
Maria Matejka
e2a427fc30 Flush deferred calls directly after the loop finished its one run 2024-06-27 08:37:05 +02:00
Maria Matejka
af73cc4215 Allocator now reports cold pages 2024-06-26 20:45:54 +02:00
Maria Matejka
be2ba84e50 Tame improper xmalloc warning 2024-06-26 17:21:26 +02:00
Maria Matejka
b797444e94 Merge commit 'b95dc8f29f18eb177f91fdc4bf0716fac9b15366' into mq-config-ref
Also converted all _Bool's to bool.
2024-06-26 17:19:24 +02:00
Maria Matejka
7d455d64ca Remove spinlock debug structures in production build 2024-06-26 11:30:41 +02:00
Maria Matejka
8e67cba528 Linpool: allocation split to fast and slow 2024-06-26 11:30:41 +02:00
Maria Matejka
6f981969bb RCU read lock optimization 2024-06-26 11:29:43 +02:00
Maria Matejka
0b6e752bd9 Conflating multiple partial ROA reload requests together 2024-06-26 11:29:43 +02:00
Maria Matejka
bd44a13ce5 Spinhash main lock removed
Spinhash now uses RCU instead to guard cur-new exchanges to avoid
excessive synchronization and cache misses on the main spinlock.
2024-06-26 11:29:12 +02:00
Maria Matejka
83045e9a1f Configuration obstacles made a separate, explicit structure
With this, one can walk the obstacle list in a debugger and
easier see which specific object is holding the reference.
2024-06-14 23:16:07 +02:00
Maria Matejka
61dcbb1d83 Global runtime values separated from config 2024-06-14 23:16:07 +02:00
Maria Matejka
f5fd70c54a Callback: bundling event with its target 2024-06-14 23:16:07 +02:00
Maria Matejka
3ed192edc3 Table: RCU synchronization moved to lfjour
the sync is actually needed when the pages get freed, not precisely
after every item cleanup, as the data technically stays intact until the
deferred free's are called.
2024-06-12 18:07:40 +02:00
Maria Matejka
bd05dd7304 Netindex cleanup calls synchronize_rcu() by batches 2024-06-12 14:48:33 +02:00
Maria Matejka
76a1998ff5 Netindex rehash debug 2024-06-12 14:48:33 +02:00
Maria Matejka
951d0422fa Attributes: fix collision on free-lookup
Freeing the eattrs is tricky as somebody else may find them
via RTA-unlocked lookup inbetween.
2024-06-12 14:48:33 +02:00
Maria Matejka
d8c0faaec9 Netindex cleanup now doesn't need to unlock to synchronize RCU 2024-06-12 14:48:33 +02:00
Maria Matejka
a146abc8fd Revert (partial) "Route attributes now use the common lockfree usecount"
This partially reverts commit d617801c31.

The common lockfree doesn't work well for high-volume structures like
eattr cache because it expects the structure to be cleaned up by a
sweeper routine ... which is very ineffective for >1M records.

OTOH, we need the deferred ea_free in all cases ... so keeping that.
2024-06-12 14:48:33 +02:00
Maria Matejka
47e493f228 Dropped net_resolve_index from feeder fast path 2024-06-12 14:48:33 +02:00
Maria Matejka
661193cf98 Thread IO: a little bit faster RX repeat 2024-06-12 14:48:33 +02:00
Maria Matejka
f516d7cfe9 Netindex: fix absurd hash parameters 2024-06-12 14:48:33 +02:00
Maria Matejka
fece55b810 Netindex: converted to spinlocked hash 2024-06-12 14:48:33 +02:00
Maria Matejka
1032bf2543 Hash: Added a spinlocked variant
The spinlocked hash has a main rw spinlock for the data blocks
and then a rw spinlock for each hash chain. Rehashing is asynchronous,
running from an event, and it happens chain-wise, never blocking more
than one chain at a time.
2024-06-12 14:48:33 +02:00
Maria Matejka
d4733b28d9 Dropping netindex fragile manipulation
Now the netindex doesn't expose its internals and can be converted
to the spinlocked implementation much easier.
2024-06-12 09:23:50 +02:00
Maria Matejka
499d5e6fb3 ROA tables have now an auxiliary table
There is an IP table for every ROA table, holding special records
combining all known ROAs for every top-prefix.

The ROA digestor is now an IP digestor, running over the auxiliary
table.
2024-06-12 09:23:50 +02:00
Maria Matejka
602595fe10 Attributes: cleanup
Dropping EAF_TYPE__MAX and adding a check for forgotten
ea class registration
2024-06-12 09:23:50 +02:00
Maria Matejka
0fb9177374 Loop scheduler tracing options configurable 2024-06-12 09:23:50 +02:00
Maria Matejka
9e88fc5b6b Netindex: allow u32 -> netindex without locking 2024-06-12 09:23:50 +02:00
Maria Matejka
7c59ef3faa RCU Unwinder can now retry without yielding 2024-06-12 09:23:50 +02:00
Maria Matejka
4104d668d9 Read-write spinlocks 2024-06-12 09:23:50 +02:00
Maria Matejka
8f4a784e14 Netindex is now net-type specific
Combining all network types in one netindex was just a waste of memory
and too much complexity for no reason.
2024-06-05 17:47:32 +02:00
Maria Matejka
d617801c31 Route attributes now use the common lockfree usecount
Also route attributes are not freed immediately anymore.
2024-06-04 22:20:18 +02:00
Maria Matejka
98fee17456 Hash: dropped relics of hash iterators 2024-06-04 22:20:18 +02:00
Maria Matejka
b033561045 Route attribute hash replaced with the generic one 2024-06-04 22:20:18 +02:00
Maria Matejka
5d6c4ff35a BGP: Freeing prefixes deferred to save rcu synchronization 2024-06-04 22:20:18 +02:00
Maria Matejka
d4ea561917 Common parts of the ROA updater moved into the table
Channel is now just subscribing to yet another journal announcing
digested tries from the ROA table.

Creating tries in every channel on-the-fly was too slow to handle
and it ate obnoxious amounts of memory. Instead, the tries are
constructed directly in the table and the channels are notified
with the completed tries.

The delayed export-release mechanism is used to keep the tries allocated
until routes get reloaded.
2024-06-04 10:11:36 +02:00
Maria Matejka
b287c13f21 Task deferrer: kinda more dumb-resistant macro
Originally, this mechanism required to check whether there's enough time to work
and then to send an event. This macro combines all the logic and goes more straightforwardly
to the _end_ of the export processing loop.

One should note that there were two cases where the export processing loop
was deferred at the _beginning_, which led to ignoring some routes on
reimports. This wasn't easily noticeable in the tests until the one-task
limit got a ceiling on 300 ms to keep reasonable latency.
2024-06-04 10:11:36 +02:00
Maria Matejka
7a169e46a8 BGP: export table stores routes, reloads and shows in CLI.
In future, this and rtable's data structures should be probably merged
but it isn't a good idea to do now. The used data structure is similar
to rtable -- an array of pointers to linked lists.

Feed is lockless, as with all tables.

Full export (receiving updates) is not supported yet but we don't have
any method how to use it anyway. Gonna implement it later.
2024-06-04 10:11:36 +02:00
Maria Matejka
dc416d2de3 RCU: Rewritten to be more straightforward 2024-06-04 10:11:36 +02:00
Maria Matejka
7c41d860af Unit test for RCU 2024-06-04 10:11:36 +02:00
Maria Matejka
34acf22fc7 Netindex: consistency checks and deletion of whole hash 2024-06-04 10:11:36 +02:00
Maria Matejka
31d5ffa4a9 If debugging, store a malloc circular log for easier debugging 2024-06-04 10:11:36 +02:00
Maria Matejka
a2ddd3d443 Slab: can be deleted as a single object 2024-06-04 10:11:36 +02:00
Maria Matejka
10bb1c1e9d Real almost-lockless feeds and more pull-like exports
Introducing a new omnipotent internal API to just pass route updates
from whatever point wherever we want.

From now on, all the exports should be processed by RT_WALK_EXPORTS
macro, and you can also issue a separate feed-only request to just get a
feed and finish.

The exporters can now also stop and the readers must expect that to
happen and recover. Main tables don't stop, though.
2024-06-04 10:11:36 +02:00
Maria Matejka
03731bf356 Netindex: fixed resolving net by index 2024-05-25 19:37:16 +02:00
Maria Matejka
b5f803ce4a Simplified temporary resources
Also TMP_SAVED now uses the CLEANUP hook to allow for breaks and returns
2024-05-25 19:37:16 +02:00
Maria Matejka
76ca53e4f8 SKIP_BACK_DECLARE: easier embedded-to-parent typecasting 2024-05-25 19:37:16 +02:00
Maria Matejka
f6ad42777d Lockless feed of a single net 2024-05-25 19:37:16 +02:00
Maria Matejka
091130e84b Using ea_lookup_tmp() for temporarily keeping attribute references
To avoid needs for keeping local temporary references for attributes,
now one can use ea_lookup_tmp() to ensure that the attributes are
valid and stored until the task ends. After that, the attributes are
automatically unref'd and also deallocated if needed.
2024-05-25 19:37:16 +02:00