[PATCH 05/14] arm64/fpsimd: Remove opportunistic freeing of SME state

Mark Brown broonie at kernel.org
Fri Apr 4 11:41:07 PDT 2025


On Fri, Apr 04, 2025 at 06:44:26PM +0100, Mark Rutland wrote:
> When a task's SVE vector length (NSVL) is changed, and the task happens
> to have SVCR.{SM,ZA}=={0,0}, vec_set_vector_length() opportunistically
> frees the task's sme_state and clears TIF_SME.
> 
> The opportunistic freeing was added with no rationale in commit:
> 
>   d4d5be94a8787242 ("arm64/fpsimd: Ensure SME storage is allocated after SVE VL changes")
> 
> That commit fixed an unrelated problem where the task's sve_state was
> freed while it could be used to store streaming mode register state,
> where the fix was to re-allocate the task's sve_state.

IIRC the concern was ending up in a state where we have SME enabled but
do not have SVE storage allocated, that could lead to us trying to save
the streaming SVE registers to a buffer that isn't there.  However in
what ended up getting posted we always do a sve_alloc() (and we'd need
to have done more anyway) so that situation can't arise and this is as
you say just redundant.

> Remove the unnecessary opportunistic freeing of the task's sme_state.

...and only do this when changing the SME vector length.

Reviewed-by: Mark Brown <broonie at kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250404/cffda224/attachment.sig>


More information about the linux-arm-kernel mailing list