Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Fix fpu_kern_enter in a softint that interr...



details:   https://anonhg.NetBSD.org/src/rev/692dcb3555ee
branches:  trunk
changeset: 936181:692dcb3555ee
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jul 20 16:43:03 2020 +0000

description:
Fix fpu_kern_enter in a softint that interrupted a softint.

We need to find the lwp that was originally interrupted to save its
fpu state.

With this, fpu-heavy programs (like firefox) are once again stable,
at least under modest stress testing, on systems configured to use
wifi with WPA2 and CCMP.

diffstat:

 sys/arch/x86/x86/fpu.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (33 lines):

diff -r 483dfcc16026 -r 692dcb3555ee sys/arch/x86/x86/fpu.c
--- a/sys/arch/x86/x86/fpu.c    Mon Jul 20 16:41:18 2020 +0000
+++ b/sys/arch/x86/x86/fpu.c    Mon Jul 20 16:43:03 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.71 2020/07/20 16:41:18 riastradh Exp $       */
+/*     $NetBSD: fpu.c,v 1.72 2020/07/20 16:43:03 riastradh Exp $       */
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.71 2020/07/20 16:41:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.72 2020/07/20 16:43:03 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -380,11 +380,9 @@
         * 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)) {
-               fpu_save_lwp(l->l_switchto);
-       } else {
-               fpu_save_lwp(l);
-       }
+       while ((l->l_pflag & LP_INTR) && (l->l_switchto != NULL))
+               l = l->l_switchto;
+       fpu_save_lwp(l);
 
        /*
         * Clear CR0_TS, which fpu_save_lwp set if it saved anything --



Home | Main Index | Thread Index | Old Index