uwcms / IPMC

University of Wisconsin ZYNQ IPMC
8 stars 5 forks source link

Investigate high CPU usage by lwip during autonegotiation #2

Closed mpv89 closed 6 years ago

mpv89 commented 6 years ago

networkd task starves other processes when waiting for a DHCP address, probably internal to lwIP. Investigation is required.

PID Name             BasePrio CurPrio StackHW CPU% CPU
 10 networkd                3       3    1716  61% 2604622
  2 IDLE                    0       0     156  38% 1622663

Console might become irresponsible.

jtikalsky commented 6 years ago

It's not DHCP, it's PHY auto-negotiation, it looks like.

 4009 | ipmc.network.lwip                      | INFO | autonegotiation complete 
 4009 | ipmc.network.lwip                      | INFO | link speed for phy address 7: 1000
 4011 | ipmc.console.uart                      | INFO | Starting Console Service "console"
 4011 | ipmc.console.uart.input                | INFO | loglevel ipmc.ipmi E

...

 5502 | ipmc.network                           | NOTI | DHCP request success
Address: 192.168.250.234
Netmask: 255.255.0.0
Gateway: 192.168.1.4
jtikalsky commented 6 years ago

Problem identified, thanks to @mpv89.

./common/lwIP/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c:              sleep(1);
./common/lwIP/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c:      sleep(1);
./common/lwIP/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c:      sleep(1);
./common/lwIP/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c:      sleep(1);
./common/lwIP/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c:              sleep(1);
./common/lwIP/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c:              sleep(1);
jtikalsky commented 6 years ago
[NOTI] DHCP request success
Address: 192.168.250.234
Netmask: 255.255.0.0
Gateway: 192.168.1.4

> ps
PID Name             BasePrio CurPrio StackHW CPU% CPU
  2 IDLE                    0       0     156  99% 3863521
 10 networkd                3       3    1716  <1% 6085

Fix confirmed.