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 Add more KASSERTs.



details:   https://anonhg.NetBSD.org/src/rev/8dbe3d10de77
branches:  trunk
changeset: 991140:8dbe3d10de77
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Jun 29 19:34:35 2018 +0000

description:
Add more KASSERTs.

Should help PR/53399.

diffstat:

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

diffs (39 lines):

diff -r db76024df502 -r 8dbe3d10de77 sys/arch/x86/x86/fpu.c
--- a/sys/arch/x86/x86/fpu.c    Fri Jun 29 19:21:43 2018 +0000
+++ b/sys/arch/x86/x86/fpu.c    Fri Jun 29 19:34:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.43 2018/06/23 10:06:02 maxv Exp $    */
+/*     $NetBSD: fpu.c,v 1.44 2018/06/29 19:34:35 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.43 2018/06/23 10:06:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.44 2018/06/29 19:34:35 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -359,6 +359,20 @@
        int s;
 
        s = splhigh();
+#ifdef DIAGNOSTIC
+       if (oldlwp != NULL) {
+               struct pcb *pcb = lwp_getpcb(oldlwp);
+               struct cpu_info *ci = curcpu();
+               if (pcb->pcb_fpcpu == NULL) {
+                       KASSERT(ci->ci_fpcurlwp != oldlwp);
+               } else if (pcb->pcb_fpcpu == ci) {
+                       KASSERT(ci->ci_fpcurlwp == oldlwp);
+               } else {
+                       panic("%s: oldlwp's state installed elsewhere",
+                           __func__);
+               }
+       }
+#endif
        fpusave_cpu(true);
        if (!(newlwp->l_flag & LW_SYSTEM))
                fpu_eagerrestore(newlwp);



Home | Main Index | Thread Index | Old Index