-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Running debug=1 bash -x /usr/bin/kdumpctl restart 2>&1 | grep -c "kdump_get_conf_val " on my test system shows that kdump_get_conf_val is called many times during the start of the kdump.service. In particular (using the default kdump.conf) it is called 63 times when a rebuild of the kdump initrd is required, 53 times without rebuilding the kdump initrd and, 12 times with config force_no_rebuild enabled. Each time kdump_get_conf_val is called the whole kdump.conf is parsed. This can lead to performance regressions as reported in #134.
Fix this by moving over to only parse the config once and store it in a way so it can be accessed later again, like it is done in kdumpctl with the OPT array. The problem with this is that the config is needed in (at least) three different places, kdumpctl, the module-setup.sh and, kdump.sh within the kdump initrd.
My suggestion is to make use of the systemd-creds to pass the config to the kdump-capture.service. This could look something like this:
- Remove all uses of
kdump_get_conf_valinkdumpctlonly relying on theOPTarray. - Write the content of
OPTto temporary files, with the option name as file name and the value as content of the file. - Install the files to
/etc/credstore/kdumpin the kdump initrd. - Add
LoadCredential=kdump:/etc/credstore/kdumptokdump-capture.service - In
kdump.shthe config can be accesses by checking if the file$CREDENTIALS_DIRECTORY/kdump_<option>exists and then reading its content.
Benefits of using systemd-creds I see (besides reducing the number of times kdump.conf needs to be parsed)
kdumpctlcan easily change/update the config. E.g. it can add the-For--num-threadsoption formakedumpfile. This would allow us to move some functionality fromkdump.shtokdumpctl. Makingkdump.shsimpler, easier to predict and, ultimately easier to debug.- For UKIs the kdump initrd cannot be rebuild to include the local config but
systemd-credscan be passed to them. systemd-credscan be encrypted. Although this requires a TPM2 when the credential is supposed to be available in the initrd. Seeman systemd-credsfor details.