Repository navigation
Give each network namespace its own socktab - #156
Draft
Stuartwastaken wants to merge 1 commit into
Draft
Stuartwastaken wants to merge 1 commit into
Stuartwastaken wants to merge 1 commit into
Conversation
Before this change all namespaces shared homa->socktab, with the namespace as part of the hash key. Now each homa_net has its own socktab, and homa->nets links the homa_nets together so that homa_timer can scan the sockets of all namespaces. This fixes a bug in homa_abort_rpcs: an ICMP error received in one namespace aborted RPCs to the same address in every namespace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first step of the namespace work. Today the sockets of all network namespaces share homa->socktab, and each lookup compares hsk->hnet. This moves the socktab into struct homa_net, so each namespace has its own table and its own port space.
homa_timer still has to visit every socket, so homa->nets links the homa_nets together and homa_socktab_start_scan_all walks all of their socktabs. The timer's scan can block, so it holds homa->nets_mutex to keep a namespace from being deleted in the middle; this is the same arrangement as qshared->mutex and qshared->qdevs in homa_qdisc.c. The scans in homa_devel.c can run at SoftIRQ level, so they use RCU instead: the new pre_exit hook unlinks the homa_net, and Linux waits for a grace period between pre_exit and exit.
This also fixes homa_abort_rpcs, which scanned the shared table without checking the namespace, so an ICMP unreachable received in one namespace aborted RPCs to the same address in all of them. It now takes the hnet from the error handler and scans only that table; homa_abort_rpcs__ignore_other_hnets fails without the change. Ashish's #143 contains the same fix for homa_abort_rpcs (an hnet argument plus a check in the loop), so you can take either one; whichever goes in second needs a small rebase.
Each namespace now allocates its own socktab (1024 buckets, a little over 8 KB) while Homa is loaded.
Besides the unit tests, I ran this on 6.17.8 with the same port bound in four namespaces at once, RPCs between two namespaces over a veth pair, and 300 namespace create/delete cycles under load. That kernel has neither KASAN nor lockdep, so those have not been run.