Page MenuHomeFreeBSD

arm64: close a race in SVE register management
ClosedPublic

Authored by alc on Aug 8 2026, 6:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 18, 10:47 PM
Unknown Object (File)
Thu, Sep 17, 7:03 PM
Unknown Object (File)
Tue, Sep 15, 5:27 PM
Unknown Object (File)
Mon, Sep 14, 4:08 PM
Unknown Object (File)
Sun, Sep 6, 12:05 AM
Unknown Object (File)
Sat, Sep 5, 11:35 PM
Unknown Object (File)
Fri, Sep 4, 10:05 PM
Unknown Object (File)
Fri, Sep 4, 9:46 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.Aug 8 2026, 6:42 AM
This revision is now accepted and ready to land.Aug 8 2026, 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.