Repository navigation
Fix poll/epoll/recv not waking up in interrupt driven mode with AF_XDP - #342
Open
johnmave126 wants to merge 1 commit into
Open
johnmave126 wants to merge 1 commit into
johnmave126 wants to merge 1 commit into
Conversation
c3b1560 was introduced to optimize waiter callback registration with AF_XDP. The patch requires adding the waiter back after every wait_callback(). But when userspace is holding the net_if lock, wait_callback() defers the priming. When userspace releases the lock, ci_netif_unlock_slow() checks the NIC flag, sees NIC_FLAG_USERSPACE_PRIME, and calls efxdp_ef_eventq_prime() to prime the NIC. However, efxdp_ef_eventq_prime() is empty but still the queue is considered primed. When next poll happens, tcp_helper_request_wakeup() checks the primed flag, considers it primed, and skips waiter callback installation. This put poll to sleep without corresponding waiter on the socket. The poll only gets woken up when linux_tcp_helper_periodic_timer fires. This change removes NIC_FLAG_USERSPACE_PRIME for AF_XDP, so polls can install waiter callback correctly. Tested on the repro in PR. Fixes: c3b1560 ("Add/Remove socket waiter on wakeup_request/wait_callback") Signed-off-by: Shuhao Tan <tanshuhao@google.com>
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.
c3b1560 was introduced to optimize waiter callback registration with AF_XDP. The patch requires adding the waiter back after every wait_callback(). But when userspace is holding the net_if lock, wait_callback() defers the priming. When userspace releases the lock, ci_netif_unlock_slow() checks the NIC flag, sees
NIC_FLAG_USERSPACE_PRIME, and calls efxdp_ef_eventq_prime() to prime the NIC. However, efxdp_ef_eventq_prime() is empty but still the queue is considered primed. When next poll happens,
tcp_helper_request_wakeup() checks the primed flag, considers it primed, and skips waiter callback installation. This put poll to sleep without corresponding waiter on the socket. The poll only gets woken up when linux_tcp_helper_periodic_timer fires.
This change removes NIC_FLAG_USERSPACE_PRIME for AF_XDP, so polls can install waiter callback correctly.
Minimal reproducer, the sender sends the packet with sequence numbers at a definite rate, and the receiver measures the gap in the sequence number:
udp_sender.c
udp_receiver.c
Run with two machines with AF_XDP
onload ./udp_receiver <IP> <PORT> <NIC_NAME> <SO_RCVBUF>onload ./udp_sender <IP> <PORT> <NIC_NAME> <PPS>In our testing environment, with 75k pps