]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: Exclude nohz_full CPUs from 32bits el0 support
authorFrederic Weisbecker <frederic@kernel.org>
Thu, 24 Oct 2024 22:12:59 +0000 (00:12 +0200)
committerFrederic Weisbecker <frederic@kernel.org>
Wed, 8 Jan 2025 17:13:29 +0000 (18:13 +0100)
Nohz full CPUs are not a desirable fallback target to run 32bits el0
applications. If present, prefer a set of housekeeping CPUs that can do
the job instead. Otherwise just don't support el0 32 bits. Should the
need arise, appropriate support can be introduced in the future.

Suggested-by: Will Deacon <will@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Documentation/arch/arm64/asymmetric-32bit.rst
arch/arm64/kernel/cpufeature.c

index 64a0b505da7d80e872b77c800df3f5e33b595037..1ca2b359a907f0531da085ae4b73cb58d2d28c93 100644 (file)
@@ -153,3 +153,11 @@ asymmetric system, a broken guest at EL1 could still attempt to execute
 mode will return to host userspace with an ``exit_reason`` of
 ``KVM_EXIT_FAIL_ENTRY`` and will remain non-runnable until successfully
 re-initialised by a subsequent ``KVM_ARM_VCPU_INIT`` operation.
+
+NOHZ FULL
+---------
+
+To avoid perturbing an adaptive-ticks CPU (specified using
+``nohz_full=``) when a 32-bit task is forcefully migrated, these CPUs
+are treated as 64-bit-only when support for asymmetric 32-bit systems
+is enabled.
index 6ce71f444ed84f9056196bb21bbfac61c9687e30..3c87659c14db86a001efc56a5c5e4ce04b4dfa73 100644 (file)
@@ -75,6 +75,7 @@
 #include <linux/cpu.h>
 #include <linux/kasan.h>
 #include <linux/percpu.h>
+#include <linux/sched/isolation.h>
 
 #include <asm/cpu.h>
 #include <asm/cpufeature.h>
@@ -3742,7 +3743,14 @@ static int enable_mismatched_32bit_el0(unsigned int cpu)
        static int lucky_winner = -1;
 
        struct cpuinfo_arm64 *info = &per_cpu(cpu_data, cpu);
-       bool cpu_32bit = id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0);
+       bool cpu_32bit = false;
+
+       if (id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0)) {
+               if (!housekeeping_cpu(cpu, HK_TYPE_TICK))
+                       pr_info("Treating adaptive-ticks CPU %u as 64-bit only\n", cpu);
+               else
+                       cpu_32bit = true;
+       }
 
        if (cpu_32bit) {
                cpumask_set_cpu(cpu, cpu_32bit_el0_mask);