Blame SOURCES/tuned-2.13.0-realtime-cond-support-for-managed_irq.patch

3b7bb0
From 5ed61ce394bad089f86a0be4b911cd93eddeb1b3 Mon Sep 17 00:00:00 2001
3b7bb0
From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskarvad@redhat.com>
3b7bb0
Date: Fri, 20 Mar 2020 18:02:46 +0100
3b7bb0
Subject: [PATCH] realtime: added conditional support for managed_irq
3b7bb0
MIME-Version: 1.0
3b7bb0
Content-Type: text/plain; charset=UTF-8
3b7bb0
Content-Transfer-Encoding: 8bit
3b7bb0
3b7bb0
Also added regex_search_ternary built-in function.
3b7bb0
3b7bb0
It takes arguments in the following form:
3b7bb0
  STR1, REGEX, STR2, STR3
3b7bb0
3b7bb0
If REGEX matches STR1 (re.search is used), STR2 is returned,
3b7bb0
if it doesn't match STR3 is returned.
3b7bb0
3b7bb0
Example:
3b7bb0
[variables]
3b7bb0
foo=Y
3b7bb0
bar=${f:regex_search_ternary:${foo}:\b[y,Y,1,t,T]\b:foo:bar}
3b7bb0
3b7bb0
It will result in the 'foo' string stored in the '${bar}' variable.
3b7bb0
3b7bb0
Resolves: rhbz#1797025
3b7bb0
3b7bb0
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
3b7bb0
---
3b7bb0
 profiles/realtime/realtime-variables.conf     |  7 +++++++
3b7bb0
 profiles/realtime/tuned.conf                  |  5 ++++-
3b7bb0
 .../function_regex_search_ternary.py          | 21 +++++++++++++++++++
3b7bb0
 3 files changed, 32 insertions(+), 1 deletion(-)
3b7bb0
 create mode 100644 tuned/profiles/functions/function_regex_search_ternary.py
3b7bb0
3b7bb0
diff --git a/profiles/realtime/realtime-variables.conf b/profiles/realtime/realtime-variables.conf
3b7bb0
index b91e5f3..c2da595 100644
3b7bb0
--- a/profiles/realtime/realtime-variables.conf
3b7bb0
+++ b/profiles/realtime/realtime-variables.conf
3b7bb0
@@ -2,3 +2,10 @@
3b7bb0
 # isolated_cores=2,4-7
3b7bb0
 # isolated_cores=2-23
3b7bb0
 #
3b7bb0
+#
3b7bb0
+# Uncomment the 'isolate_managed_irq=Y' bellow if you want to move kernel
3b7bb0
+# managed IRQs out of isolated cores. Note that this requires kernel
3b7bb0
+# support. Please only specify this parameter if you are sure that the
3b7bb0
+# kernel supports it.
3b7bb0
+#
3b7bb0
+# isolate_managed_irq=Y
3b7bb0
diff --git a/profiles/realtime/tuned.conf b/profiles/realtime/tuned.conf
3b7bb0
index 6f5c5b1..a22ffdd 100644
3b7bb0
--- a/profiles/realtime/tuned.conf
3b7bb0
+++ b/profiles/realtime/tuned.conf
3b7bb0
@@ -28,6 +28,9 @@ isolated_cores_online_expanded=${f:cpulist_online:${isolated_cores}}
3b7bb0
 # Fail if isolated_cores contains CPUs which are not online
3b7bb0
 assert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_expanded}:${isolated_cores_online_expanded}}
3b7bb0
 
3b7bb0
+# Assembly managed_irq
3b7bb0
+managed_irq=${f:regex_search_ternary:${isolate_managed_irq}:\b[y,Y,1,t,T]\b:managed_irq,domain,:}
3b7bb0
+
3b7bb0
 [sysctl]
3b7bb0
 kernel.hung_task_timeout_secs = 600
3b7bb0
 kernel.nmi_watchdog = 0
3b7bb0
@@ -41,7 +44,7 @@ kernel.timer_migration = 0
3b7bb0
 /sys/devices/system/machinecheck/machinecheck*/ignore_ce = 1
3b7bb0
 
3b7bb0
 [bootloader]
3b7bb0
-cmdline_realtime=+isolcpus=${isolated_cores} intel_pstate=disable nosoftlockup tsc=nowatchdog
3b7bb0
+cmdline_realtime=+isolcpus=${managed_irq}${isolated_cores} intel_pstate=disable nosoftlockup tsc=nowatchdog
3b7bb0
 
3b7bb0
 [script]
3b7bb0
 script = ${i:PROFILE_DIR}/script.sh
3b7bb0
diff --git a/tuned/profiles/functions/function_regex_search_ternary.py b/tuned/profiles/functions/function_regex_search_ternary.py
3b7bb0
new file mode 100644
3b7bb0
index 0000000..42c4567
3b7bb0
--- /dev/null
3b7bb0
+++ b/tuned/profiles/functions/function_regex_search_ternary.py
3b7bb0
@@ -0,0 +1,21 @@
3b7bb0
+import re
3b7bb0
+from . import base
3b7bb0
+
3b7bb0
+class regex_search_ternary(base.Function):
3b7bb0
+	"""
3b7bb0
+	Ternary regex operator, it takes arguments in the following form
3b7bb0
+	STR1, REGEX, STR2, STR3
3b7bb0
+	If REGEX matches STR1 (re.search is used), STR2 is returned,
3b7bb0
+	otherwise STR3 is returned
3b7bb0
+	"""
3b7bb0
+	def __init__(self):
3b7bb0
+		# 4 arguments
3b7bb0
+		super(regex_search_ternary, self).__init__("regex_search_ternary", 4)
3b7bb0
+
3b7bb0
+	def execute(self, args):
3b7bb0
+		if not super(regex_search_ternary, self).execute(args):
3b7bb0
+			return None
3b7bb0
+		if re.search(args[1], args[0]):
3b7bb0
+			return args[2]
3b7bb0
+		else:
3b7bb0
+			return args[3]
3b7bb0
-- 
3b7bb0
2.21.1
3b7bb0