diff --git a/SOURCES/tuned-2.10.0-disable-ksm-once.patch b/SOURCES/tuned-2.10.0-disable-ksm-once.patch new file mode 100644 index 0000000..f2f097f --- /dev/null +++ b/SOURCES/tuned-2.10.0-disable-ksm-once.patch @@ -0,0 +1,84 @@ +diff --git a/profiles/cpu-partitioning/script.sh b/profiles/cpu-partitioning/script.sh +index 0e94d3a..efe9bcb 100755 +--- a/profiles/cpu-partitioning/script.sh ++++ b/profiles/cpu-partitioning/script.sh +@@ -54,8 +54,8 @@ stop() { + then + sed -i '/^IRQBALANCE_BANNED_CPUS=/d' /etc/sysconfig/irqbalance + teardown_kvm_mod_low_latency ++ enable_ksm + fi +- enable_ksm + enable_balance_domains + return "$?" + } +diff --git a/profiles/functions b/profiles/functions +index 2df8168..919409c 100644 +--- a/profiles/functions ++++ b/profiles/functions +@@ -531,35 +531,30 @@ teardown_kvm_mod_low_latency() + + KSM_SERVICES="ksm ksmtuned" + KSM_RUN_PATH=/sys/kernel/mm/ksm/run ++KSM_MASK_FILE="${STORAGE_PERSISTENT}/ksm-masked" + + disable_ksm() + { +- for s in $KSM_SERVICES; do +- if systemctl is-enabled -q $s; then +- systemctl -q disable $s ++ if [ ! -f $KSM_MASK_FILE ]; then ++ # Always create $KSM_MASK_FILE, since we don't want to ++ # run any systemctl commands during boot ++ if ! touch $KSM_MASK_FILE; then ++ die "failed to create $KSM_MASK_FILE" + fi +- +- if systemctl is-active -q $s; then +- systemctl -q stop $s +- fi +- done +- +- if [ -f $KSM_RUN_PATH ]; then ++ systemctl --now --quiet mask $KSM_SERVICES + # Unmerge all shared pages +- echo 2 > $KSM_RUN_PATH ++ test -f $KSM_RUN_PATH && echo 2 > $KSM_RUN_PATH + fi + } + ++# Should only be called when full_rollback == true + enable_ksm() + { +- for s in $KSM_SERVICES; do +- systemctl -q preset $s +- +- # Only start the service if it's enabled by defaut +- if systemctl is-enabled -q $s; then +- systemctl start $s ++ if [ -f $KSM_MASK_FILE ]; then ++ if systemctl --quiet unmask $KSM_SERVICES; then ++ rm -f $KSM_MASK_FILE + fi +- done ++ fi + } + + die() { +diff --git a/profiles/realtime-virtual-host/script.sh b/profiles/realtime-virtual-host/script.sh +index a9366cb..33a7996 100755 +--- a/profiles/realtime-virtual-host/script.sh ++++ b/profiles/realtime-virtual-host/script.sh +@@ -93,8 +93,10 @@ start() { + } + + stop() { +- [ "$1" = "full_rollback" ] && teardown_kvm_mod_low_latency +- enable_ksm ++ if [ "$1" = "full_rollback" ]; then ++ teardown_kvm_mod_low_latency ++ enable_ksm ++ fi + systemctl stop rt-entsk + return "$?" + } diff --git a/SOURCES/tuned-2.10.0-update-kvm-modprobe-file.patch b/SOURCES/tuned-2.10.0-update-kvm-modprobe-file.patch new file mode 100644 index 0000000..d4d4886 --- /dev/null +++ b/SOURCES/tuned-2.10.0-update-kvm-modprobe-file.patch @@ -0,0 +1,73 @@ +From c4a0aef63df41a79e96c1276ac732ecde8d58d86 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= +Date: Thu, 22 Nov 2018 17:38:12 +0100 +Subject: [PATCH] functions: reworked setup_kvm_mod_low_latency to count with + kernel changes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It updates the KVM modprobe file if its content differs from what's +supported on the current system. It may look a bit over-engineered, but +it's done this way to lower the possibility of race condition. + +Resolves: rhbz#1649408 + +Signed-off-by: Jaroslav Škarvada +--- + profiles/functions | 35 +++++++++++++++++++---------------- + 1 file changed, 19 insertions(+), 16 deletions(-) + +diff --git a/profiles/functions b/profiles/functions +index 919409c..aab608a 100644 +--- a/profiles/functions ++++ b/profiles/functions +@@ -503,26 +503,29 @@ eee_set_normal_fsb() { + + kvm_modprobe_file=/etc/modprobe.d/kvm.rt.tuned.conf + +-setup_kvm_mod_low_latency() ++teardown_kvm_mod_low_latency() + { +- if [ -f $kvm_modprobe_file ]; then +- return +- fi +- +- modinfo -p kvm | grep -q kvmclock_periodic_sync +- if [ "$?" -eq 0 ]; then +- echo "options kvm kvmclock_periodic_sync=0" > $kvm_modprobe_file +- fi +- +- modinfo -p kvm_intel | grep -q ple_gap +- if [ "$?" -eq 0 ]; then +- echo "options kvm_intel ple_gap=0" >> $kvm_modprobe_file +- fi ++ rm -f $kvm_modprobe_file + } + +-teardown_kvm_mod_low_latency() ++setup_kvm_mod_low_latency() + { +- rm -f $kvm_modprobe_file ++ local HAS_KPS="" ++ local HAS_PLE_GAP="" ++ local WANTS_KPS="" ++ local WANTS_PLE_GAP="" ++ ++ modinfo -p kvm | grep -q kvmclock_periodic_sync && HAS_KPS=1 ++ modinfo -p kvm_intel | grep -q ple_gap && HAS_PLE_GAP=1 ++ grep -qs kvmclock_periodic_sync "$kvm_modprobe_file" && WANTS_KPS=1 ++ grep -qs ple_gap "$kvm_modprobe_file" && WANTS_PLE_GAP=1 ++ ++ if [ "$HAS_KPS" != "$WANTS_KPS" -o "$HAS_PLE_GAP" != "$WANTS_PLE_GAP" ]; then ++ teardown_kvm_mod_low_latency ++ [ "$HAS_KPS" ] && echo "options kvm kvmclock_periodic_sync=0" > $kvm_modprobe_file ++ [ "$HAS_PLE_GAP" ] && echo "options kvm_intel ple_gap=0" >> $kvm_modprobe_file ++ fi ++ return 0 + } + + # +-- +2.14.5 + diff --git a/SPECS/tuned.spec b/SPECS/tuned.spec index 99a88f4..abd0934 100644 --- a/SPECS/tuned.spec +++ b/SPECS/tuned.spec @@ -7,7 +7,7 @@ Summary: A dynamic adaptive system tuning daemon Name: tuned Version: 2.10.0 -Release: 6%{?prerel1}%{?dist} +Release: 6%{?prerel1}%{?dist}.3 License: GPLv2+ Source: https://github.com/redhat-performance/%{name}/archive/v%{version}%{?prerel2}.tar.gz#/%{name}-%{version}%{?prerel2}.tar.gz URL: http://www.tuned-project.org/ @@ -24,6 +24,8 @@ Requires: python-schedutils Patch0: tuned-2.10.0-gtk-3.8.patch Patch1: tuned-2.10.0-use-online-cpus.patch Patch2: tuned-2.10.0-realtime-virtual-enable-rt-entsk.patch +Patch3: tuned-2.10.0-disable-ksm-once.patch +Patch4: tuned-2.10.0-update-kvm-modprobe-file.patch %description The tuned package contains a daemon that tunes system settings dynamically. @@ -160,6 +162,8 @@ It can be also used to fine tune your system for specific scenarios. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1626473 chmod 0755 profiles/realtime-virtual-guest/script.sh @@ -412,6 +416,18 @@ fi %{_mandir}/man7/tuned-profiles-compat.7* %changelog +* Tue Nov 27 2018 Jaroslav Škarvada - 2.10.0-6.3 +- Reworked setup_kvm_mod_low_latency to count with kernel changes + Resolves: rhbz#1653767 + +* Tue Nov 27 2018 Jaroslav Škarvada - 2.10.0-6.2 +- Updated disable-ksm-once patch + Related: rhbz#1652822 + +* Fri Nov 23 2018 Jaroslav Škarvada - 2.10.0-6.1 +- Disable ksm once, re-enable it on full rollback + Resolves: rhbz#1652822 + * Fri Sep 7 2018 Jaroslav Škarvada - 2.10.0-6 - Added workaround for rpmbuild bug 1626473 related: rhbz#1616043