Blocking call in phosphor-networkd

Lei Yu yulei.sh at bytedance.com
Wed Oct 19 14:40:17 AEDT 2022


During network testing, we identified an issue in phosphor-networkd
that the service is blocked for a few seconds in refreshObjects().

In future investigation, the blocking happens in
`getHostNameFromSystem()` that tries to get the hostname from
`systemd-hostnamed` service.
`systemd-hostnamed` is a service that will exit on idle (30s), and
start on request.
So as long as the `systemd-hostnamed` service is inactive, the call in
`getHostNameFromSystem()` will be blocked, waiting for
`systemd-hostnamed` to be started and the hostname is returned. It
takes more than 1s on AST2500 if the BMC is idle, and took more if the
BMC is busy.
When it is blocked, the services making DBus calls to networkd will be
blocked as well, this typically happens when BMC in DHCP refreshes
it's IP address and we notice that ipmid is blocked during this
period.

How about changing the code to read the `/etc/hostname` file directly?
It is much faster than making DBus call to `systemd-hostnamed`.

An alternative is to make async calls, but phosphor-networkd is
written in "sync" way so it may require more effort to change it
async.

Comments are welcome.

-- 
BRs,
Lei YU


More information about the openbmc mailing list