When an edge node boots up, there is a service called NSD which monitors the creation of kni-lrport-0 thread
. When NSD (Namespace Daemon) detects the creation of the kni-lrport-0 thread, it triggers a script called
ip.py
, which will configure the CPU affinity for the KNI thread. In certain circumstances when the nestdb-server on the edge node is busy, the NSD service fails to receive the status on kni-lrport-0 and
ip.py
is not run.
For example in a working setup, the following messages are seen in the edge syslog:
### process NSD is started. NSD polls for any interface changes in every 500ms.
bm-edge-1 systemd 1 - - Started Edge NSD.
### process datapathd is started. datapathd creates interface kni-lrport-0, which is detected by NSD
bm-edge-1 NSX 8298 - [nsx@6876 comp="nsx-edge" subcomp="nsd" tid="8298" level="INFO"] Set interface kni-lrport-0 MAC 02:50:56:xx:xx:xx
### The message below is the most important message. The following message triggers a script called ip.py.
bm-edge-1 NSX 8298 - [nsx@6876 comp="nsx-edge" subcomp="nsd" tid="8298" level="INFO"] Detected parent kni interface kni-lrport-0 creation state up, ifindex 11
### script ip.py is called. The script configures KNI thread cores
bm-edge-1 NSX 10730 - [nsx@6876 comp="nsx-edge" subcomp="nsd" tid="10730" level="INFO"] ExecuteCmd (Child): Running: ' /usr/bin/sudo /opt/vmware/nsx-edge/bin/ip.py configure-cpu --kni kni-lrport-0', env: ''
In a setup where the script is not called:
bm-edge-1 systemd 1 - - Started Edge NSD.
bm-edge-1 NSX 6619 - [nsx@6876 comp="nsx-edge" subcomp="nsd" tid="6619" level="INFO"] Set interface kni-lrport-0 state Up
Note: The log message '
Detected parent kni interface kni-lrport-0 creation state up
' is not logged, as in the working log messages above. As a result, the
ip.py
script is not run, which leads to the KNI thread CPU affinity not being configured.
Step 1. To check if the CPU affinity is configured for the KNI thread, as admin on the BME run:
bm-edge-1> get dataplane | find Corelist
Corelist : 0,4,8,12,10,6,2,16,20,24,22,18,14,28,32,36,38,34,30,26,40,44,48,50,46,42
Step 2. As root, run
'ps aux | grep kni' to get the process ID (PID) for KNI thread:
bm-edge-1:~# ps aux | grep kni
root 17901 97.8 0.0 0 0 ? R Aug10 12648:14 [kni_single]
Step 3. Then use the command below command with the PID found in the previous command:
bm-edge-1:~# taskset -apc 17901
pid 17901's current affinity list: 0-51
If CPU affinity for the KNI thread is configured properly, the CPU cores in Step 1 and Step 3 should not be overlapping.
Alternatively, step 2 and 3 can be run with the single command:
taskset -pc $(pidof kni_single)