Skip to content

cps: don't wait for routing daemons to make progress#484

Merged
AltraMayor merged 6 commits intomasterfrom
nl
Jun 4, 2021
Merged

cps: don't wait for routing daemons to make progress#484
AltraMayor merged 6 commits intomasterfrom
nl

Conversation

@AltraMayor
Copy link
Owner

The code of the CPS block that communicates with routing daemon via rtnetlink(7) may wait for routing daemons to receive large replies (e.g. dumping a large routing table) in order to make progress. This wait disrupts the CPS block, which not only is expected to serve the rtnetlink interface, but also the KNI interfaces, and internal messages via its mailbox.

This pull request moves the rtnetlink code in the CPS block into a coroutine. Thus, whenever a wait is needed, the coroutine yields the control to the other activities that the CPS block is responsible for.

The code that supports routing daemons used to live in cps/kni.c.
This patch moves this code to the new file cps/rd.c.

This move splits cps/kni.c into two files about even in
the number of lines. The file cps/kni.c had more tahn 2K linas
before this patch.
Library CORO implements coroutines.
In order to list the routing table for routing daemons,
the CPS block needs to acquire a spin lock.

This patch yields the coroutine, so the CPS block goes and does
something instead of busy wait for the lock.
The system call sendto() may block for quite a while
when a routing daemon is busy.

This patch tests if calling sendto() is going to block, if so,
it yields to other activities.
@AltraMayor AltraMayor added the Operational demand This issue would make Gatekeeper safer and/or cheaper to operate label May 28, 2021
@AltraMayor AltraMayor added this to the First deployment milestone May 28, 2021
@AltraMayor
Copy link
Owner Author

Tested in production.

@AltraMayor AltraMayor merged commit 5f5c961 into master Jun 4, 2021
@AltraMayor AltraMayor deleted the nl branch June 4, 2021 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Operational demand This issue would make Gatekeeper safer and/or cheaper to operate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant