summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-07-07 15:29:34 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-01-08 12:33:02 +0000
commitfa3cae37aefa584f8e1aa166c1ae969d7ef4b816 (patch)
tree4bdcfc8a524b3af4f64e8d63610493fb3a61f1b2
parent21c388e7260bf32359fc6239e5ff81d1d1527985 (diff)
arm64: text replication: early kernel option to enable replication
Provide an early kernel option "ktext=" which allows the kernel text replication to be enabled. This takes a boolean argument. The way this has been implemented means that we take all the same paths through the kernel at runtime whether kernel text replication has been enabled or not; this allows the performance effects of the code changes to be evaluated separately from the act of running with replicating the kernel text. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt5
-rw-r--r--arch/arm64/mm/ktext.c18
2 files changed, 23 insertions, 0 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 65731b060e3f..5fe6ac2c7dcb 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2533,6 +2533,11 @@
0: force disabled
1: force enabled
+ ktext= [ARM64] Control kernel text replication on NUMA
+ machines. Default: disabled.
+ 0: disable kernel text replication
+ 1: enable kernel text replication
+
kunit.enable= [KUNIT] Enable executing KUnit tests. Requires
CONFIG_KUNIT to be set to be fully enabled. The
default value can be overridden via
diff --git a/arch/arm64/mm/ktext.c b/arch/arm64/mm/ktext.c
index 6ca7c4730893..f55bfe29ad28 100644
--- a/arch/arm64/mm/ktext.c
+++ b/arch/arm64/mm/ktext.c
@@ -119,6 +119,21 @@ void ktext_replication_patch_alternative(__le32 *src, int nr_inst)
}
}
+static bool ktext_enabled;
+
+static int __init parse_ktext(char *str)
+{
+ bool enabled;
+ int ret = strtobool(str, &enabled);
+
+ if (ret)
+ return ret;
+
+ ktext_enabled = enabled;
+ return 0;
+}
+early_param("ktext", parse_ktext);
+
/* Allocate page tables and memory for the replicated kernel texts. */
void __init ktext_replication_init(void)
{
@@ -140,6 +155,9 @@ void __init ktext_replication_init(void)
return;
}
+ if (!ktext_enabled)
+ return;
+
for_each_node(nid) {
/* Nothing to do for node 0 */
if (!nid)