Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Use pcu_save_all_on_cpu, not pcu_save.



details:   https://anonhg.NetBSD.org/src/rev/0b99e6ec75e6
branches:  trunk
changeset: 935943:0b99e6ec75e6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jul 13 16:54:03 2020 +0000

description:
Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.

diffstat:

 sys/arch/aarch64/aarch64/fpu.c |  15 ++++-----------
 sys/arch/arm/vfp/vfp_init.c    |  15 ++++-----------
 2 files changed, 8 insertions(+), 22 deletions(-)

diffs (86 lines):

diff -r 18d9e1ef78b6 -r 0b99e6ec75e6 sys/arch/aarch64/aarch64/fpu.c
--- a/sys/arch/aarch64/aarch64/fpu.c    Mon Jul 13 16:53:06 2020 +0000
+++ b/sys/arch/aarch64/aarch64/fpu.c    Mon Jul 13 16:54:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.6 2020/07/13 16:52:23 riastradh Exp $ */
+/* $NetBSD: fpu.c,v 1.7 2020/07/13 16:54:03 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.6 2020/07/13 16:52:23 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: fpu.c,v 1.7 2020/07/13 16:54:03 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -179,7 +179,6 @@
 void
 fpu_kern_enter(void)
 {
-       struct lwp *l = curlwp;
        struct cpu_info *ci;
        int s;
 
@@ -196,14 +195,8 @@
        KASSERT(ci->ci_kfpu_spl == -1);
        ci->ci_kfpu_spl = s;
 
-       /*
-        * If we are in a softint and have a pinned lwp, the fpu state
-        * is that of the pinned lwp, so save it there.
-        */
-       if ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL))
-               l = l->l_switchto;
-       if (fpu_used_p(l))
-               fpu_save(l);
+       /* Save any fpu state on the current CPU.  */
+       pcu_save_all_on_cpu();
 
        /*
         * Enable the fpu, and wait until it is enabled before
diff -r 18d9e1ef78b6 -r 0b99e6ec75e6 sys/arch/arm/vfp/vfp_init.c
--- a/sys/arch/arm/vfp/vfp_init.c       Mon Jul 13 16:53:06 2020 +0000
+++ b/sys/arch/arm/vfp/vfp_init.c       Mon Jul 13 16:54:03 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.67 2020/07/13 16:53:06 riastradh Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.68 2020/07/13 16:54:03 riastradh Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
 #include "opt_cputypes.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.67 2020/07/13 16:53:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.68 2020/07/13 16:54:03 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -668,7 +668,6 @@
 void
 fpu_kern_enter(void)
 {
-       struct lwp *l = curlwp;
        struct cpu_info *ci;
        uint32_t fpexc;
        int s;
@@ -686,14 +685,8 @@
        KASSERT(ci->ci_kfpu_spl == -1);
        ci->ci_kfpu_spl = s;
 
-       /*
-        * If we are in a softint and have a pinned lwp, the fpu state
-        * is that of the pinned lwp, so save it there.
-        */
-       if ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL))
-               l = l->l_switchto;
-       if (vfp_used_p(l))
-               vfp_savecontext(l);
+       /* Save any fpu state on the current CPU.  */
+       pcu_save_all_on_cpu();
 
        /* Enable the fpu.  */
        fpexc = armreg_fpexc_read();



Home | Main Index | Thread Index | Old Index