amboar.github.io

Software development notes

View My GitHub Profile

8 June 2023

Inspecting Boot Performance in OpenBMC

by Andrew

OpenBMC uses systemd as a system management daemon. While this raises some eyebrows given the environment, it’s what we have. At least it provides reliability and familiarity as we disregard the perceived complexity. With systemd comes an opportunity to use systemd-bootchart for measuring boot-time behaviour of the system. While it’s relatively easy to use in general, some of the details of the OpenBMC boot process can get in the road.

The first detail is that it’s very unlikely that anyone will include the systemd-bootchart binary in their platform’s distribution by default. To deal with that we’re going to have to build the image ourselves, and if we’re doing that, we can take the easy road to plonk it in:

$ cd openbmc/openbmc
$ . setup p10bmc
$ echo 'IMAGE_INSTALL:append = " systemd-bootchart"' >> conf/local.conf

systemd-bootchart requires at CONFIG_SCHEDSTATS=y be set in the kernel config. This wasn’t the case as it stood, so I’ve fixed that up. Another problem I encountered was that the /init script for eMMC-based systems in OpenBMC didn’t honor init= on the kernel commandline, so I’ve fixed that too.

With those pieces in place we can now bitbake obmc-phosphor-image and boot it up. However, before doing any analysis, from experience it’s worth configuring bootchart to reduce the sample rate, extend the sample count, and tell it to log the process command lines rather than just PIDs. For example, on the BMC, I used:

# cat <<EOF >>/etc/systemd/bootchart.conf
Samples=1200
Frequency=10
Cmdline=yes
EOF
#

With that done we’re set up, we just need to configure systemd-bootchart to run. This is best done by stopping at the u-boot prompt and updating bootargs without writing the environment back to flash1:

ast# setenv bootargs console=ttyS4,115200n8 init=/lib/systemd/systemd-bootchart
ast# boot

And with that, you should have bootchart .svg files appear in /run/log!

  1. Some quirk that I didn’t investigate meant systemd-bootchart wasn’t installed at /usr/lib/systemd/systemd-bootchart like the documentation suggests it should be 

tags: