Re: [RFC PATCH] arm64/sve,sme: Refine scalable regset sizes at boot

From: Dave Martin
Date: Wed Feb 07 2024 - 07:33:00 EST


On Wed, Feb 07, 2024 at 10:04:56AM +0000, Mark Brown wrote:
> On Mon, Feb 05, 2024 at 05:27:20PM +0000, Dave Martin wrote:
>
> > index a5dc6f764195..5c2f91f84c31 100644
> > --- a/arch/arm64/kernel/fpsimd.c
> > +++ b/arch/arm64/kernel/fpsimd.c
> > @@ -1189,6 +1189,7 @@ void __init sve_setup(void)
> > pr_warn("%s: unvirtualisable vector lengths present\n",
> > info->name);
> >
> > + arch_ptrace_sve_init(sve_vq_from_vl(info->max_vl));
> > sve_efi_setup();
> > }
>
> This will only get run if the system actually supports SVE since the
> first thing that sve_setup() does is to exit if the system does not
> support SVE. That means that the size limiting will only be done on
> systems that have SVE, but since we unconditionally register all our
> regsets if the system doesn't have SVE it will end up with a maximally
> sized SVE regset registered which doesn't seem ideal. As I mentioned in
> the other thread we should probably just not be registering unsupported
> regsets with the core, that would avoid the issue without a change to
> this patch.
>
> A similar issue applies for SME.

Good point.

I guess if we're following this approach we also do have the option
to knock out entries of the array altogether once cpufeatures are
finalised.

If we want a quick fix the silly memory allocation triggering for
Douglas' splat then this probably isn't it, but if removing regsets at
boot time is desirable anyway, we might kill two birds with one stone
here.

I'll wait for progress on the other threads before digging too deeply
into this (but anyone wanting to see this patch expedited, please
shout!)

Cheers
---Dave