Module Name:    src
Committed By:   riastradh
Date:           Mon Jul 20 16:43:03 UTC 2020

Modified Files:
        src/sys/arch/x86/x86: fpu.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/x86/x86/fpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.71 src/sys/arch/x86/x86/fpu.c:1.72
--- src/sys/arch/x86/x86/fpu.c:1.71	Mon Jul 20 16:41:18 2020
+++ src/sys/arch/x86/x86/fpu.c	Mon Jul 20 16:43:03 2020
@@ -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 @@ fpu_kern_enter(void)
 	 * 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 --

Reply via email to