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

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