Dear DPDK Developers,
I am reporting an issue encountered in an environment running Linux kernel version 5.4.46 with DPDK 19.11. When attempting to run Docker containers in bridge mode, the container creation fails consistently. The kmsg indicate a crash during the initialization of the loopback device within a new net_namespace, specifically due to the loopback interface not being assigned the expected ifindex
of 1.
Issue Description:
During the creation of a
net_namespace, the kernel initializes network devices in a specific order. It is expected that the loopback interface is the first to be initialized, thereby receiving an ifindex
of 1. This assumption is enforced in the kernel code, where a BUG_ON
check ensures that the loopback interface has ifindex == 1
. However, with the DPDK KNI module loaded, this assumption fails, resulting in a kernel panic during container creation.
Root Cause Analysis:
Upon investigation, it appears that the KNI module registers its network operations using the register_pernet_subsys()
function. This registration method places the KNI initialization function before the loopback device's initialization in pernet_list. Consequently, when a new
net_namespace
is created, the KNI interface is initialized before the loopback interface, causing the KNI interface to receive ifindex
1 and the loopback interface to receive ifindex
2. This order violates the kernel's expectation and triggers the BUG_ON
check.
Environment Details:
DPDK Version: 19.11
Kernel Version: 5.4.46
Operating System: Linux
Reproduction Steps:
Load the DPDK KNI module.
Use Docker to create a new container in bridge mode.
Observe the kernel panic due to the loopback interface not having ifindex
1.
Additional Information:
We would appreciate it if the DPDK development team could review this issue and consider incorporating the proposed change into future releases. Please let us know if further information or testing is required from our side.
Best regards,