Repository navigation
bootloader: Simplify tuning of rpm-ostree kargs - #690
Conversation
d6801e7 to
f9f5e9e
Compare
There is an older grub convention that TuneD cannot change/delete any karg it didn't add itself, so I think this restriction is OK. One question, what happen if there is running deployment or the |
I will re-check that, can't remember if I tested such cases or not, thanks. |
Is the behaviour the same? |
Looking at it now, I likely factored out that code by accident. I will add it back. |
f9f5e9e to
879323d
Compare
|
Updated the code to handle errors better and re-added the wait until rpm-ostree becomes idle. |
|
I've tested this PR on RHEL AI 1.4 and apart from very long times (cca 1 minute) to add/remove kernel parameters I did not find any issues. The very long times seem to be an Edit: this seems to lower the long delays in rpm-ostree by roughly 6x for me (from 1 minute to 10s). |
|
I adjusted the handling of kargs in no-daemon mode: before appending kargs from a profile, TuneD removes any kargs that may be present from previous profiles. This should be consistent with how TuneD behaves on traditional package-based systems, where the entire grub configuration file is overwritten. |
|
Closed this on accident, reopening. |
|
One thing I would note here is that with bootc we are also now supporting modifying kargs at container build time via https://docs.fedoraproject.org/en-US/bootc/kernel-args/#_via_usrlibbootckargs_d This is a totally new capability vs what came before with (rpm-)ostree. So in a world where we're running tuned at build time to execute on a profile, it could write out e.g. |
Thanks - @martinpitt this is good to know when you get to converting the bootloader system role to work at container build time - also note that for TOML formatting we implemented an Ansible filter plugin for the podman role to convert data types to their TOML representation - https://github.com/linux-system-roles/podman/tree/main/filter_plugins |
cgwalters
left a comment
There was a problem hiding this comment.
I give this only a somewhat superficial review, it seems sane. I think it's worth calling out that there's very similar reconciliation logic that lives in https://github.com/openshift/machine-config-operator/blob/b1b4c729adbd8d7bd20c1fd3ae7801e5fa23230b/pkg/daemon/update.go#L1757
Now again kargs are very complex because we have the use case of both machine-specific or generic kargs embedded in bootc images, but I really hope for as many use cases as possible we can go to the kargs-in-container path because it dramatically simplifies this reconciliation logic.
| if d is None: | ||
| """Apply kernel parameter tuning in a rpm-ostree system.""" | ||
| appended_kargs = self._get_appended_rpm_ostree_kargs() | ||
| profile_kargs = self._cmdline_val.split() |
There was a problem hiding this comment.
This is a pre-existing issue but I think something to followup on at some point here is that just using split() on kargs will incorrectly handle quoted kernel arguments that contain embedded whitespace. This has been rare IME. But probably worth at least having "parse_kargs" function that can be updated in one place when we do fix this.
There was a problem hiding this comment.
Good catch. This also applies to package mode systems, I'll create an issue for it.
| log.error("Not updating kernel arguments, could not read the current ones.") | ||
| return | ||
| # Ignore kargs previously appended by TuneD, these will be removed later. | ||
| non_tuned_kargs = active_kargs.split() |
The bootloader plugin claims that it does not mess with existing kernel parameters; make sure we adhere to that also for rpm-ostree systems: 1. Only append a new karg if the same key=value pair does not already appear in kernel parameters. If we would duplicate it, it would not be possible to determine which one to delete when unapplying the profile. 2. Do not delete existing key=value pairs when the profile adds a karg with another value for the key. A single key can appear multiple times in the kernel parameter list with different values. Also make sure new kargs are added exactly in the order in which they appear in the profile. This is especially important for kargs related to hugepages. Resolves: RHEL-45836
If TuneD-appended kargs are present and do not match the kargs to be appended, we should remove them. This can happen if there was no profile rollback, e.g., when using the no-daemon mode. Resolves: RHEL-86814
|
Thank you for the comments, @cgwalters, much appreciated.
Is there a way to reliably detect that we are in this scenario, i.e., in a bootc container being built? |
|
|
IMHO in TuneD we use |
|
xref bootc-dev/bootc#899 |
This can be handled in future PRs. |
This PR aims to simplify the tuning of kernel parameters in rpm-ostree systems, which has some major flaws:
The new implementation is much simpler, but it also restricts the user more, since it disallows replacing existing kernel parameters.
Setting to WIP, since I'm still doing testing on Fedora CoreOS virtual machines.