Page MenuHomeFreeBSD

arm64: close a race in SVE register management
ClosedPublic

Authored by alc on Sat, Aug 8, 6:41 AM.
Tags
None
Referenced Files
F167175592: D58723.id183661.diff
Wed, Aug 19, 4:21 PM
Unknown Object (File)
Tue, Aug 18, 6:43 AM
Unknown Object (File)
Mon, Aug 17, 5:45 PM
Unknown Object (File)
Fri, Aug 14, 8:46 PM
Unknown Object (File)
Thu, Aug 13, 6:07 PM
Unknown Object (File)
Tue, Aug 11, 11:48 PM
Unknown Object (File)
Sat, Aug 8, 12:24 PM
Unknown Object (File)
Sat, Aug 8, 11:46 AM
Subscribers

Details

Summary

While testing an unrelated pmap change, D58708, that dramatically
reduces the number of TLBI instructions performed, and likely the
timing of unrelated events, I started seeing "Storing an invalid VFP
state" panics in vfp_save_state_common(). However, the origin of the
panic is in the else branch of sve_restore_state(). Specifically, my
pmap change seems to have increased the likelihood that the thread
executing the else branch would be preempted by another thread between
the critical_exit() inside its call to vfp_restore_state_common() and
the else branch's own critical_enter(). Prior to expanding the scope
of the else branch's critical section, the MPASS added by this change
would fire, catching the problem at its source, rather than later in
vfp_save_state_common().

Assisted-by: Claude Code (Opus 5)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

alc requested review of this revision.Sat, Aug 8, 6:42 AM
This revision is now accepted and ready to land.Sat, Aug 8, 1:57 PM

Possibly vfp_restore_state_common() should rely on its caller to enter a critical section (with an assert).

catching the problem at is source

Typo: at its

Possibly vfp_restore_state_common() should rely on its caller to enter a critical section (with an assert).

Yes, critical_{enter,exit}() calls would need to be added to vfp_restore_state().

catching the problem at is source

Typo: at its

Fixed.

I'm waiting to hear if @andrew has any comments or questions.

I'm afk for a week and a half

This revision was automatically updated to reflect the committed changes.