lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250103152043.GA3816@willie-the-truck>
Date: Fri, 3 Jan 2025 15:20:44 +0000
From: Will Deacon <will@...nel.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
	Catalin Marinas <catalin.marinas@....com>,
	Marc Zyngier <maz@...nel.org>,
	Oliver Upton <oliver.upton@...ux.dev>,
	Ard Biesheuvel <ardb@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 09/19] arm64: Exclude nohz_full CPUs from 32bits el0
 support

On Wed, Dec 11, 2024 at 04:40:22PM +0100, Frederic Weisbecker wrote:
> 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@...nel.org>
> Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> ---
>  Documentation/arch/arm64/asymmetric-32bit.rst | 9 +++++++++
>  arch/arm64/kernel/cpufeature.c                | 6 +++++-

Thanks, Frederic. A couple of comments below.

>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/arch/arm64/asymmetric-32bit.rst b/Documentation/arch/arm64/asymmetric-32bit.rst
> index 64a0b505da7d..0c762cfc0f34 100644
> --- a/Documentation/arch/arm64/asymmetric-32bit.rst
> +++ b/Documentation/arch/arm64/asymmetric-32bit.rst
> @@ -153,3 +153,12 @@ 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
> +--------
> +
> +Nohz full CPUs are not a desirable fallback target to run 32bits el0
> +applications. If present, a set of housekeeping CPUs that can do
> +the job instead is preferred. Otherwise 32-bit EL0 is not supported.
> +Should the need arise, appropriate support can be introduced in the
> +future.

I think we can probably word this slightly better. How about something
more along these lines?

  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.

> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 6ce71f444ed8..7ce1b8ab417f 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -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,10 @@ 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) && housekeeping_cpu(cpu, HK_TYPE_TICK))
> +		cpu_32bit = true;

I think it would be helpful to emit a diagnostic when a 32-bit CPU is
ignored because of the housekeeping check. e.g.


	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;
	}


It's a bit of a bummer that this will fire on hardware that isn't
asymmetric, but I suppose that's easily resolved by not passing the
'allow_mismatched_32bit_el0' option in that case.

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ