dataplane: fix memory cleanup order and improve mempool diagnostics - #330
Open
ezhk wants to merge 2 commits into
Open
dataplane: fix memory cleanup order and improve mempool diagnostics#330ezhk wants to merge 2 commits into
ezhk wants to merge 2 commits into
Conversation
The KNI (virtio_user vdev) MAC address is baked into the vdev creation arguments at init_kernel_interfaces() time, which happens before the physical port is started. For some drivers the MAC is only valid (or may change) once rte_eth_dev_start() is called, which resulted in a mismatch: one MAC in yanet and a different one in the system after the interface was brought up. Read the actual MAC via dpdk::GetMacAddress() after the port is started and apply it to all KNI interfaces (forward/in/out/drop) via SIOCSIFHWADDR while they are still DOWN, before SetUp() raises IFF_UP. Also fix a pre-existing socket leak in SetUp() and harden interface name copying with IFNAMSIZ - 1.
Add memory_manager::cleanup() that explicitly frees all tracked hugepage allocations before rte_eal_cleanup() is called. Without this, the implicit destruction of memory_manager (which happens after the destructor body) called rte_free() on already-torn-down EAL, corrupting glibc's internal linked lists and crashing with 'corrupted double-linked list'. Also log mempool allocation parameters (count, element size, approximate total MB) at INFO level for fp/wgc/cp pools to aid capacity planning, and call memory_manager::debug() on the relevant socket when mempool creation fails to surface fragmentation details in the error path.
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.
Add memory_manager::cleanup() that explicitly frees all tracked hugepage
allocations before rte_eal_cleanup() is called. Without this, the
implicit destruction of memory_manager (which happens after the destructor
body) called rte_free() on already-torn-down EAL, corrupting glibc's
internal linked lists and crashing with 'corrupted double-linked list'.
Also log mempool allocation parameters (count, element size, approximate
total MB) at INFO level for fp/wgc/cp pools to aid capacity planning, and
call memory_manager::debug() on the relevant socket when mempool creation
fails to surface fragmentation details in the error path.