The branch main has been updated by alc:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=189ee41b6cc3b0d92c291cc854d9781afec23ad4

commit 189ee41b6cc3b0d92c291cc854d9781afec23ad4
Author:     Alan Cox <[email protected]>
AuthorDate: 2026-08-15 06:15:36 +0000
Commit:     Alan Cox <[email protected]>
CommitDate: 2026-08-18 06:55:39 +0000

    arm64 vfp: eliminate nested critical sections
    
    At two out of three call sites to vfp_restore_state_common(), the caller
    must use critical_{enter,exit}() to prevent preemption between its call
    to vfp_restore_state_common() and other actions, notably its call to
    sve_enable().  So, it is arguably better to make
    vfp_restore_state_common()'s caller responsible for performing
    critical_{enter,exit}() and simply perform CRITICAL_ASSERT() inside
    vfp_restore_state_common().
    
    Reviewed by:    kib, markj
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D58859
---
 sys/arm64/arm64/vfp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c
index 11faa4cc21cd..afb6d9e02107 100644
--- a/sys/arm64/arm64/vfp.c
+++ b/sys/arm64/arm64/vfp.c
@@ -679,8 +679,7 @@ vfp_restore_state_common(struct thread *td, int flags)
 
        KASSERT(td == curthread, ("%s: Called with non-current thread",
            __func__));
-
-       critical_enter();
+       CRITICAL_ASSERT(td);
 
        cpu = PCPU_GET(cpuid);
        curpcb = td->td_pcb;
@@ -728,8 +727,6 @@ vfp_restore_state_common(struct thread *td, int flags)
                PCPU_SET(fpcurthread, td);
                curpcb->pcb_vfpcpu = cpu;
        }
-
-       critical_exit();
 }
 
 void
@@ -738,7 +735,9 @@ vfp_restore_state(void)
        struct thread *td;
 
        td = curthread;
+       critical_enter();
        vfp_restore_state_common(td, td->td_pcb->pcb_fpflags);
+       critical_exit();
 }
 
 bool

Reply via email to