Blame SOURCES/tuned-2.11.0-irqbalance-tuning.patch

04124f
From 66924b842228e7178301aa399d30459155b35762 Mon Sep 17 00:00:00 2001
04124f
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
04124f
Date: Tue, 9 Jul 2019 11:31:20 +0200
04124f
Subject: [PATCH 1/3] plugin_script: Execute all scripts regardless of errors
04124f
MIME-Version: 1.0
04124f
Content-Type: text/plain; charset=UTF-8
04124f
Content-Transfer-Encoding: 8bit
04124f
04124f
Due to commit d4038a7e64af3, if a script fails to execute or its exit
04124f
code is non-zero, no subsequent scripts are executed. This seems
04124f
logically wrong and it causes problems especially during rollback as some
04124f
tunings may not be reverted due to this behaviour. Also, it appears it
04124f
was not the intention of that commit to change this behaviour - the
04124f
intention rather seems to have been to make _call_scripts return
04124f
success/error information for use by the verification mechanism.
04124f
04124f
So let's aggregate the success/error information instead.
04124f
04124f
Related: https://github.com/redhat-performance/tuned/pull/194
04124f
04124f
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
04124f
---
04124f
 tuned/plugins/plugin_script.py | 7 ++++---
04124f
 1 file changed, 4 insertions(+), 3 deletions(-)
04124f
04124f
diff --git a/tuned/plugins/plugin_script.py b/tuned/plugins/plugin_script.py
04124f
index 940c1f9a..19b7fc60 100644
04124f
--- a/tuned/plugins/plugin_script.py
04124f
+++ b/tuned/plugins/plugin_script.py
04124f
@@ -31,6 +31,7 @@ def _instance_cleanup(self, instance):
04124f
 		pass
04124f
 
04124f
 	def _call_scripts(self, scripts, arguments):
04124f
+		ret = True
04124f
 		for script in scripts:
04124f
 			environ = os.environ
04124f
 			environ.update(self._variables.get_env())
04124f
@@ -47,11 +48,11 @@ def _call_scripts(self, scripts, arguments):
04124f
 					log.error("script '%s' error output: '%s'" % (script, err[:-1]))
04124f
 				if proc.returncode:
04124f
 					log.error("script '%s' returned error code: %d" % (script, proc.returncode))
04124f
-					return False
04124f
+					ret = False
04124f
 			except (OSError,IOError) as e:
04124f
 				log.error("script '%s' error: %s" % (script, e))
04124f
-				return False
04124f
-		return True
04124f
+				ret = False
04124f
+		return ret
04124f
 
04124f
 	def _instance_apply_static(self, instance):
04124f
 		super(ScriptPlugin, self)._instance_apply_static(instance)
04124f
04124f
From 4a8e64994eb978ada0c7e23702e96c82352cc222 Mon Sep 17 00:00:00 2001
04124f
From: Peter Xu <peterx@redhat.com>
04124f
Date: Thu, 4 Jul 2019 11:16:54 +0800
04124f
Subject: [PATCH 2/3] cpu-partitioning: Introduce irqbalance helpers and use
04124f
04124f
Provide irqbalance_banned_cpus_{setup|clear} for tuning irqbalance.
04124f
Use them in cpu-partitioning.
04124f
04124f
Signed-off-by: Peter Xu <peterx@redhat.com>
04124f
---
04124f
 profiles/cpu-partitioning/script.sh |  5 ++---
04124f
 profiles/functions                  | 11 +++++++++++
04124f
 2 files changed, 13 insertions(+), 3 deletions(-)
04124f
04124f
diff --git a/profiles/cpu-partitioning/script.sh b/profiles/cpu-partitioning/script.sh
04124f
index efe9bcbb..4d0a08b2 100755
04124f
--- a/profiles/cpu-partitioning/script.sh
04124f
+++ b/profiles/cpu-partitioning/script.sh
04124f
@@ -39,8 +39,7 @@ start() {
04124f
     mkdir -p "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev"
04124f
     cp /etc/systemd/system.conf "${TUNED_tmpdir}/etc/systemd/"
04124f
     cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev/"
04124f
-    sed -i '/^IRQBALANCE_BANNED_CPUS=/d' /etc/sysconfig/irqbalance
04124f
-    echo "IRQBALANCE_BANNED_CPUS=$TUNED_isolated_cpumask" >>/etc/sysconfig/irqbalance
04124f
+    irqbalance_banned_cpus_setup "$TUNED_isolated_cpumask"
04124f
     setup_kvm_mod_low_latency
04124f
     disable_ksm
04124f
 
04124f
@@ -52,7 +51,7 @@ start() {
04124f
 stop() {
04124f
     if [ "$1" = "full_rollback" ]
04124f
     then
04124f
-        sed -i '/^IRQBALANCE_BANNED_CPUS=/d' /etc/sysconfig/irqbalance
04124f
+        irqbalance_banned_cpus_clear
04124f
         teardown_kvm_mod_low_latency
04124f
         enable_ksm
04124f
     fi
04124f
diff --git a/profiles/functions b/profiles/functions
04124f
index aab608ad..d52b0818 100644
04124f
--- a/profiles/functions
04124f
+++ b/profiles/functions
04124f
@@ -473,6 +473,17 @@ restore_logs_syncing() {
04124f
 	mv -Z $RSYSLOG_SAVE $RSYSLOG_CFG || mv $RSYSLOG_SAVE $RSYSLOG_CFG
04124f
 }
04124f
 
04124f
+irqbalance_banned_cpus_clear() {
04124f
+    sed -i '/^IRQBALANCE_BANNED_CPUS=/d' /etc/sysconfig/irqbalance
04124f
+}
04124f
+
04124f
+irqbalance_banned_cpus_setup() {
04124f
+    irqbalance_banned_cpus_clear
04124f
+    if [ -n "$1" ]; then
04124f
+        echo "IRQBALANCE_BANNED_CPUS=$1" >> /etc/sysconfig/irqbalance
04124f
+    fi
04124f
+}
04124f
+
04124f
 #
04124f
 # HARDWARE SPECIFIC tuning
04124f
 #
04124f
04124f
From 7e93b6948f0ab2eb10db5abccb71ae1cc489460c Mon Sep 17 00:00:00 2001
04124f
From: Peter Xu <peterx@redhat.com>
04124f
Date: Thu, 4 Jul 2019 11:18:11 +0800
04124f
Subject: [PATCH 3/3] realtime: Apply irqbalance tunes too in realtime profiles
04124f
04124f
Realtime profiles require to restrict irqbalance too.  Apply them to
04124f
the realtime profile so that realtime-virtual-{host|guest} can benefit
04124f
from that too.
04124f
04124f
Signed-off-by: Peter Xu <peterx@redhat.com>
04124f
---
04124f
 profiles/realtime/script.sh  | 2 ++
04124f
 profiles/realtime/tuned.conf | 1 +
04124f
 2 files changed, 3 insertions(+)
04124f
04124f
diff --git a/profiles/realtime/script.sh b/profiles/realtime/script.sh
04124f
index 41517315..e2a2829c 100755
04124f
--- a/profiles/realtime/script.sh
04124f
+++ b/profiles/realtime/script.sh
04124f
@@ -3,10 +3,12 @@
04124f
 . /usr/lib/tuned/functions
04124f
 
04124f
 start() {
04124f
+    irqbalance_banned_cpus_setup "$TUNED_isolated_cpumask"
04124f
     return 0
04124f
 }
04124f
 
04124f
 stop() {
04124f
+    irqbalance_banned_cpus_clear
04124f
     return 0
04124f
 }
04124f
 
04124f
diff --git a/profiles/realtime/tuned.conf b/profiles/realtime/tuned.conf
04124f
index c595e67b..3100941f 100644
04124f
--- a/profiles/realtime/tuned.conf
04124f
+++ b/profiles/realtime/tuned.conf
04124f
@@ -18,6 +18,7 @@ assert1=${f:assertion_non_equal:isolated_cores are set:${isolated_cores}:${isola
04124f
 # Non-isolated cores cpumask including offline cores
04124f
 not_isolated_cpumask = ${f:cpulist2hex_invert:${isolated_cores}}
04124f
 isolated_cores_expanded=${f:cpulist_unpack:${isolated_cores}}
04124f
+isolated_cpumask=${f:cpulist2hex:${isolated_cores_expanded}}
04124f
 isolated_cores_online_expanded=${f:cpulist_online:${isolated_cores}}
04124f
 
04124f
 # Fail if isolated_cores contains CPUs which are not online