Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 Limit aarch64 fpu_kern_enter/leave ...



details:   https://anonhg.NetBSD.org/src/rev/0b692c3b2239
branches:  trunk
changeset: 935941:0b692c3b2239
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jul 13 16:52:23 2020 +0000

description:
Limit aarch64 fpu_kern_enter/leave to IPL_VM or below.

diffstat:

 sys/arch/aarch64/aarch64/fpu.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (49 lines):

diff -r 43a57ed54143 -r 0b692c3b2239 sys/arch/aarch64/aarch64/fpu.c
--- a/sys/arch/aarch64/aarch64/fpu.c    Mon Jul 13 16:51:51 2020 +0000
+++ b/sys/arch/aarch64/aarch64/fpu.c    Mon Jul 13 16:52:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.5 2020/06/29 23:53:12 riastradh Exp $ */
+/* $NetBSD: fpu.c,v 1.6 2020/07/13 16:52:23 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: fpu.c,v 1.5 2020/06/29 23:53:12 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: fpu.c,v 1.6 2020/07/13 16:52:23 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -184,14 +184,15 @@
        int s;
 
        /*
-        * Block all interrupts.  We must block preemption since -- if
-        * this is a user thread -- there is nowhere to save the kernel
-        * fpu state, and if we want this to be usable in interrupts,
-        * we can't let interrupts interfere with the fpu state in use
-        * since there's nowhere for them to save it.
+        * Block interrupts up to IPL_VM.  We must block preemption
+        * since -- if this is a user thread -- there is nowhere to
+        * save the kernel fpu state, and if we want this to be usable
+        * in interrupts, we can't let interrupts interfere with the
+        * fpu state in use since there's nowhere for them to save it.
         */
-       s = splhigh();
+       s = splvm();
        ci = curcpu();
+       KASSERTMSG(ci->ci_cpl <= IPL_VM, "cpl=%d", ci->ci_cpl);
        KASSERT(ci->ci_kfpu_spl == -1);
        ci->ci_kfpu_spl = s;
 
@@ -219,7 +220,7 @@
        struct cpu_info *ci = curcpu();
        int s;
 
-       KASSERT(ci->ci_cpl == IPL_HIGH);
+       KASSERT(ci->ci_cpl == IPL_VM);
        KASSERT(ci->ci_kfpu_spl != -1);
 
        /*



Home | Main Index | Thread Index | Old Index