Module Name: src Committed By: bouyer Date: Tue Jun 7 14:53:03 UTC 2011
Modified Files: src/sys/arch/i386/i386: machdep.c src/sys/arch/i386/isa: npx.c src/sys/arch/xen/include/i386: hypercalls.h Log Message: Don't call psignal() without holding proc_lock. This is the cause of the reboot of PR port-xen/45028 Now that Xen2 is gone, handle FPU context switches the same way as amd64. This makes all tests in /usr/tests/lib/libc/ieeefp pass. To generate a diff of this commit: cvs rdiff -u -r1.702 -r1.703 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.139 -r1.140 src/sys/arch/i386/isa/npx.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/include/i386/hypercalls.h 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/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.702 src/sys/arch/i386/i386/machdep.c:1.703 --- src/sys/arch/i386/i386/machdep.c:1.702 Tue Apr 26 15:51:23 2011 +++ src/sys/arch/i386/i386/machdep.c Tue Jun 7 14:53:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.702 2011/04/26 15:51:23 joerg Exp $ */ +/* $NetBSD: machdep.c,v 1.703 2011/06/07 14:53:03 bouyer Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.702 2011/04/26 15:51:23 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.703 2011/06/07 14:53:03 bouyer Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -527,7 +527,7 @@ #ifndef XEN lldt(pmap_kernel()->pm_ldt_sel); #else - HYPERVISOR_fpu_taskswitch(); + HYPERVISOR_fpu_taskswitch(1); XENPRINTF(("lwp tss sp %p ss %04x/%04x\n", (void *)pcb->pcb_esp0, GSEL(GDATA_SEL, SEL_KPL), @@ -552,7 +552,7 @@ pcb = lwp_getpcb(l); ci = curcpu(); if (ci->ci_fpused) { - HYPERVISOR_fpu_taskswitch(); + HYPERVISOR_fpu_taskswitch(1); ci->ci_fpused = 0; } Index: src/sys/arch/i386/isa/npx.c diff -u src/sys/arch/i386/isa/npx.c:1.139 src/sys/arch/i386/isa/npx.c:1.140 --- src/sys/arch/i386/isa/npx.c:1.139 Mon Dec 20 00:25:35 2010 +++ src/sys/arch/i386/isa/npx.c Tue Jun 7 14:53:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: npx.c,v 1.139 2010/12/20 00:25:35 matt Exp $ */ +/* $NetBSD: npx.c,v 1.140 2011/06/07 14:53:03 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.139 2010/12/20 00:25:35 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.140 2011/06/07 14:53:03 bouyer Exp $"); #if 0 #define IPRINTF(x) printf x @@ -159,8 +159,8 @@ static int npxdna(struct cpu_info *); #ifdef XEN -#define clts() -#define stts() +#define clts() HYPERVISOR_fpu_taskswitch(0) +#define stts() HYPERVISOR_fpu_taskswitch(1) #endif static enum npx_type npx_type; @@ -190,9 +190,7 @@ npxdna_empty(struct cpu_info *ci) { -#ifndef XEN panic("npxdna vector not initialized"); -#endif return 0; } @@ -507,7 +505,9 @@ * Currently, we treat this like an asynchronous interrupt, but * this has disadvantages. */ + mutex_enter(proc_lock); psignal(l->l_proc, SIGFPE); + mutex_exit(proc_lock); } kpreempt_enable(); Index: src/sys/arch/xen/include/i386/hypercalls.h diff -u src/sys/arch/xen/include/i386/hypercalls.h:1.11 src/sys/arch/xen/include/i386/hypercalls.h:1.12 --- src/sys/arch/xen/include/i386/hypercalls.h:1.11 Wed Mar 30 22:57:24 2011 +++ src/sys/arch/xen/include/i386/hypercalls.h Tue Jun 7 14:53:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hypercalls.h,v 1.11 2011/03/30 22:57:24 jym Exp $ */ +/* $NetBSD: hypercalls.h,v 1.12 2011/06/07 14:53:03 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -226,7 +226,6 @@ return ret; } -#if 0 static __inline int HYPERVISOR_fpu_taskswitch(int set) { @@ -238,19 +237,6 @@ return ret; } -#else /* 0 */ -/* Xen2 compat: always i38HYPERVISOR_fpu_taskswitch(1) */ -static __inline int -HYPERVISOR_fpu_taskswitch(void) -{ - long ret; - long ign1; - _hypercall(__HYPERVISOR_fpu_taskswitch, _harg("1" (1)), - _harg("=a" (ret), "=b" (ign1))); - - return ret; -} -#endif /* 0 */ static __inline int HYPERVISOR_update_descriptor(uint64_t ma, uint32_t word1, uint32_t word2)