1
0
Fork 0

cpu-partitioning: autodetect dracut hook directory, systemd workaround

Wrong hook directory can make the machine unbootable:
https://issues.redhat.com/browse/RHEL-119889

Also added workaround for currently non-functional systemd plugin
which doesn't include the systemd config into the initrd image.

Resolves: RHEL-40619

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2025-10-08 19:29:41 +02:00
parent 181472a0be
commit 2145e1984b
No known key found for this signature in database
GPG key ID: D8E1C00E076E840B
2 changed files with 13 additions and 3 deletions

View file

@ -3,10 +3,19 @@
. /usr/lib/tuned/functions
start() {
DRACUT_VER=`dracut --version | sed 's/^.* \([0-9]\+\).*/\1/'`
echo "$DRACUT_VER" | grep -q '^[[:digit:]]\+$' || DRACUT_VER="0"
# https://issues.redhat.com/browse/RHEL-119889
if [ "$DRACUT_VER" -gt "102" ]
then
DRACUT_HOOK_DIR="/var/lib/dracut/hooks/pre-udev"
else
DRACUT_HOOK_DIR="/usr/lib/dracut/hooks/pre-udev"
fi
mkdir -p "${TUNED_tmpdir}/etc/systemd"
mkdir -p "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev"
mkdir -p "${TUNED_tmpdir}${DRACUT_HOOK_DIR}"
cp /etc/systemd/system.conf "${TUNED_tmpdir}/etc/systemd/"
cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev/"
cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}${DRACUT_HOOK_DIR}"
setup_kvm_mod_low_latency
disable_ksm
return "$?"

View file

@ -23,6 +23,7 @@ tmpdir=${f:strip:${f:exec:mktemp:-d}}
isolated_cores_expanded=${f:cpulist_unpack:${isolated_cores}}
isolated_cpumask=${f:cpulist2hex:${isolated_cores_expanded}}
not_isolated_cores_expanded=${f:cpulist_invert:${isolated_cores_expanded}}
not_isolated_cores=${f:cpulist_pack:${not_isolated_cores_expanded}}
isolated_cores_online_expanded=${f:cpulist_online:${isolated_cores}}
not_isolated_cores_online_expanded=${f:cpulist_online:${not_isolated_cores_expanded}}
not_isolated_cpumask=${f:cpulist2hex:${not_isolated_cores_expanded}}
@ -62,4 +63,4 @@ priority=10
initrd_remove_dir=True
initrd_dst_img=tuned-initrd.img
initrd_add_dir=${tmpdir}
cmdline_cpu_part=+nohz=on${cmd_isolcpus} nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup
cmdline_cpu_part=+nohz=on${cmd_isolcpus} nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} systemd.cpu_affinity=${not_isolated_cores} intel_pstate=disable nosoftlockup