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

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