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
F167952918: D58723.id.diff
Tue, Aug 25, 2:43 PM
F167838702: D58723.diff
Mon, Aug 24, 10:03 PM
Unknown Object (File)
Sun, Aug 23, 3:19 AM
Unknown Object (File)
Sat, Aug 22, 9:23 PM
Unknown Object (File)
Sat, Aug 22, 12:47 PM
Unknown Object (File)
Wed, Aug 19, 4:21 PM
Unknown Object (File)
Tue, Aug 18, 6:43 AM
Unknown Object (File)
Mon, Aug 17, 5:45 PM
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.