Blame SOURCES/tuned-2.11.0-define-variables-before-use.patch

04124f
From 0eb0c6bc7f48afe2f8c1f46ee7c9e7bb08db4163 Mon Sep 17 00:00:00 2001
04124f
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
04124f
Date: Mon, 6 Jan 2020 15:50:06 +0100
04124f
Subject: [PATCH] profiles: Make sure variables are defined before use
04124f
MIME-Version: 1.0
04124f
Content-Type: text/plain; charset=UTF-8
04124f
Content-Transfer-Encoding: 8bit
04124f
04124f
Make sure the isolated_cores and no_balance_cores variables are
04124f
defined before any of the variables that use them are defined. This
04124f
enforces a certain ordering of variable expansions so that child
04124f
profiles can set the variables directly in the profile (tuned.conf),
04124f
e.g.:
04124f
04124f
[main]
04124f
include=cpu-partitioning
04124f
04124f
[variables]
04124f
isolated_cores=3
04124f
04124f
Resolves: rhbz#1781664
04124f
04124f
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
04124f
---
04124f
 profiles/cpu-partitioning/tuned.conf | 8 ++++++++
04124f
 profiles/realtime/tuned.conf         | 4 ++++
04124f
 2 files changed, 12 insertions(+)
04124f
04124f
diff --git a/profiles/cpu-partitioning/tuned.conf b/profiles/cpu-partitioning/tuned.conf
04124f
index 1821b74e..56977500 100644
04124f
--- a/profiles/cpu-partitioning/tuned.conf
04124f
+++ b/profiles/cpu-partitioning/tuned.conf
04124f
@@ -10,6 +10,10 @@ include=network-latency
04124f
 include=/etc/tuned/cpu-partitioning-variables.conf
04124f
 
04124f
 isolated_cores_assert_check = \\${isolated_cores}
04124f
+# Make sure isolated_cores is defined before any of the variables that
04124f
+# use it (such as assert1) are defined, so that child profiles can set
04124f
+# isolated_cores directly in the profile (tuned.conf)
04124f
+isolated_cores = ${isolated_cores}
04124f
 # Fail if isolated_cores are not set
04124f
 assert1=${f:assertion_non_equal:isolated_cores are set:${isolated_cores}:${isolated_cores_assert_check}}
04124f
 
04124f
@@ -22,6 +26,10 @@ not_isolated_cores_expanded=${f:cpulist_invert:${isolated_cores_expanded}}
04124f
 isolated_cores_online_expanded=${f:cpulist_online:${isolated_cores}}
04124f
 not_isolated_cores_online_expanded=${f:cpulist_online:${not_isolated_cores_expanded}}
04124f
 not_isolated_cpumask=${f:cpulist2hex:${not_isolated_cores_expanded}}
04124f
+# Make sure no_balance_cores is defined before
04124f
+# no_balance_cores_expanded is defined, so that child profiles can set
04124f
+# no_balance_cores directly in the profile (tuned.conf)
04124f
+no_balance_cores=${no_balance_cores}
04124f
 no_balance_cores_expanded=${f:cpulist_unpack:${no_balance_cores}}
04124f
 
04124f
 # Fail if isolated_cores contains CPUs which are not online
04124f
diff --git a/profiles/realtime/tuned.conf b/profiles/realtime/tuned.conf
04124f
index 6294d0cc..6f5c5b14 100644
04124f
--- a/profiles/realtime/tuned.conf
04124f
+++ b/profiles/realtime/tuned.conf
04124f
@@ -12,6 +12,10 @@ include = network-latency
04124f
 include = /etc/tuned/realtime-variables.conf
04124f
 
04124f
 isolated_cores_assert_check = \\${isolated_cores}
04124f
+# Make sure isolated_cores is defined before any of the variables that
04124f
+# use it (such as assert1) are defined, so that child profiles can set
04124f
+# isolated_cores directly in the profile (tuned.conf)
04124f
+isolated_cores = ${isolated_cores}
04124f
 # Fail if isolated_cores are not set
04124f
 assert1=${f:assertion_non_equal:isolated_cores are set:${isolated_cores}:${isolated_cores_assert_check}}
04124f