0

I'm building a system image with v4.19.106 kernel and BusyBox for BeagleBone Black using buildroot 2020.02. If I boot the board from the resulting SD card, I see a strange behaviour: system load stays between 0.60 and 0.75 while CPU usage is below 1%, with no services running, when there's no Ethernet cable connected. As soon as I plug in a cable, the load goes down to 0.00-0.01.

With the cable unplugged I see this line in top -H:

  PID USER         TIME+ S WCHAN      COMMAND
   42 root       0:03.03 D msleep     [kworker/0:3+events_power_efficient]

Snippet from ip link output:

4: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 4c:3f:d3:91:f2:66 brd ff:ff:ff:ff:ff:ff

Snippet from ifconfig output:

eth0      Link encap:Ethernet  HWaddr 4C:3F:D3:91:F2:66
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:49

When I plug in the cable, I see this message:

# [ 3811.689083] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off

After that there's no process with Process Status D in top -H, and the load goes down.

Snippet from ip link output with the cable plugged in:

4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 4c:3f:d3:91:f2:66 brd ff:ff:ff:ff:ff:ff

Snippet from ifconfig output the cable plugged in:

eth0      Link encap:Ethernet  HWaddr 4C:3F:D3:91:F2:66
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:66 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7605 (7.4 KiB)  TX bytes:0 (0.0 B)
          Interrupt:49

Unplugging the cable brings back the high load.

My eth0 config in /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp

If I use allow-hotplug eth0, the interface stays down when the cable is unplugged at boot (and the load stays normal), but it doesn't come up afterwards when I connect a cable, just when I run ifup eth0.

How can I prevent the high load when a cable is unplugged, and get a working connection when it gets plugged in? Are there any kernel configs or device tree entries I should check?


Update:

The issue is present on an image built with the default configuration for the board (beaglebone_defconfig). It uses v4.19.79-ti-r30 kernel from the beagleboard repo (with omap2plus_defconfig).

Another confusing bit is that the issue does not appear after every boot. Power cycling the board usually makes it appear if it was not present, while reboot not necessarily. (I'm not sure if it really makes a difference which method I use, or it just appeared so in my limited number of trials.)

0

The problem is caused by the SMSC LAN8710A PHY chip on BeagleBone Black. When it is put into power saving mode, it fails to detect if a cable has been connected. To work around this issue, the kernel driver regularly wakes the PHY chip to test for connection, and the details of this workaround have changed between v3.8.13-bone80 (used in Debian 7.11) and the v4.4.9 (used in Debian 8.4). The new method is still in use in Linux kernel v5.6.4.

The msleep function visible in top -H is called from lan87xx_read_status() in drivers/net/phy/smsc.c.

I resolved the issue by adding a node for the PHY chip to the device tree with a flag that disables the power saving mode:

&davinci_mdio {
    ethernetphy0: ethernet-phy@0 {
        reg = <0>;
        smsc,disable-energy-detect;
    };
};

(The CONFIG_PM kernel config option is ignored by the driver, this is the only way to disable this behaviour.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.