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 No, I meant to put the panic in fpudna not ...



details:   https://anonhg.NetBSD.org/src/rev/e75fccd46aa6
branches:  trunk
changeset: 319967:e75fccd46aa6
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jun 17 06:03:40 2018 +0000

description:
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.

diffstat:

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

diffs (53 lines):

diff -r c49996d90a81 -r e75fccd46aa6 sys/arch/x86/x86/fpu.c
--- a/sys/arch/x86/x86/fpu.c    Sun Jun 17 01:08:15 2018 +0000
+++ b/sys/arch/x86/x86/fpu.c    Sun Jun 17 06:03:40 2018 +0000
@@ -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 @@
        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 @@
        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 @@
 
        /* 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);



Home | Main Index | Thread Index | Old Index