Module Name:    src
Committed By:   maxv
Date:           Sun Jun 17 06:03:41 UTC 2018

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

Log Message:
No, I meant to put the panic in fpudna not fputrap. Also appease it: panic
only if the fpu already has a state. We're fine with getting a DNA, what
we're not fine with is if the DNA is received while the FPU is busy.

I believe (even though I couldn't trigger it) that the panic would
otherwise fire if PT_SETFPREGS is used. And also ACPI sleep/wakeup,
probably.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.36 src/sys/arch/x86/x86/fpu.c:1.37
--- src/sys/arch/x86/x86/fpu.c:1.36	Sat Jun 16 17:11:13 2018
+++ src/sys/arch/x86/x86/fpu.c	Sun Jun 17 06:03:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.36 2018/06/16 17:11:13 maxv Exp $	*/
+/*	$NetBSD: fpu.c,v 1.37 2018/06/17 06:03:40 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.36 2018/06/16 17:11:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.37 2018/06/17 06:03:40 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -397,10 +397,6 @@ fputrap(struct trapframe *frame)
 	if (!USERMODE(frame->tf_cs))
 		panic("fpu trap from kernel, trapframe %p\n", frame);
 
-	if (__predict_false(x86_fpu_eager)) {
-		panic("%s: got DNA with EagerFPU enabled", __func__);
-	}
-
 	/*
 	 * At this point, fpcurlwp should be curlwp.  If it wasn't, the TS bit
 	 * should be set, and we should have gotten a DNA exception.
@@ -473,6 +469,11 @@ fpudna(struct trapframe *frame)
 	pcb = lwp_getpcb(l);
 	fl = ci->ci_fpcurlwp;
 	if (fl != NULL) {
+		if (__predict_false(x86_fpu_eager)) {
+			panic("%s: FPU busy with EagerFPU enabled",
+			    __func__);
+		}
+
 		/*
 		 * It seems we can get here on Xen even if we didn't
 		 * switch lwp.  In this case do nothing
@@ -488,6 +489,11 @@ fpudna(struct trapframe *frame)
 
 	/* Save our state if on a remote CPU. */
 	if (pcb->pcb_fpcpu != NULL) {
+		if (__predict_false(x86_fpu_eager)) {
+			panic("%s: LWP busy with EagerFPU enabled",
+			    __func__);
+		}
+
 		/* Explicitly disable preemption before dropping spl. */
 		kpreempt_disable();
 		splx(s);

Reply via email to