Kernel Bond Debugging in RHEL CoreOS

I'm working on a bug that involves functionality at a fairly low level, at least much lower than I usually deal with. One request from the experts who are helping me with this was to enable kernel bond debugging, which is not something I've ever done. At runtime this isn't too difficult, just two commands:

sysctl -w kernel.printk=8
echo 'module bonding +p' > /sys/kernel/debug/dynamic_debug/control

After you've run those commands you should see additional bond debug messages in your kernel logs (dmesg or the journal). However, neither of those settings is persistent over reboot so a different mechanism is needed to debug problems that happen at boot time. In short, add the following parameters to the kernel command line:

loglevel=8 bonding.dyndbg="+p"

Since this was just for one-time debugging I edited the Grub command line by hand rather than adding it permanently to the Grub config, but either will work. Note that while this is the correct syntax for a distro like RHCOS that compiles bonding as a module, if your distro compiles it into the kernel proper you may need to change the syntax to something like dyndbg="module bonding +p". That did not work on the kernel command line for me, but according to what I've read it may work in some distros.

I was able to find documentation about these various options in different places, but I thought I would pull it all together in this post so there is a one-stop shop for kernel bond debugging. Hope it helps.