diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-07-21 14:08:10 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-07-21 14:08:10 +0000 |
commit | 9131a6ee5832d2c6f2b1e83160310041b9c09dcf (patch) | |
tree | 1a05bdaa2c84f812a3b1073ea54c3111d16c6996 /sys/arch/amd64 | |
parent | 1e391320a89a368a6bd23e358164aedbe4b983ce (diff) |
Make sure that the FPU IPIs shoot down the right FPU context and not the FPU
context of some random process that happened to be switched onto the FPU
after the decision was made to send the IPI.
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/fpu.c | 5 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/ipifuncs.c | 8 | ||||
-rw-r--r-- | sys/arch/amd64/include/cpu.h | 3 |
3 files changed, 10 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/fpu.c b/sys/arch/amd64/amd64/fpu.c index 51515478f97..fdc075365f1 100644 --- a/sys/arch/amd64/amd64/fpu.c +++ b/sys/arch/amd64/amd64/fpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpu.c,v 1.16 2010/06/29 21:13:43 thib Exp $ */ +/* $OpenBSD: fpu.c,v 1.17 2010/07/21 14:08:09 kettenis Exp $ */ /* $NetBSD: fpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /*- @@ -312,8 +312,9 @@ fpusave_proc(struct proc *p, int save) fpusave_cpu(ci, save); splx(s); } else { + oci->ci_fpsaveproc = p; x86_send_ipi(oci, - save ? X86_IPI_SYNCH_FPU : X86_IPI_FLUSH_FPU); + save ? X86_IPI_SYNCH_FPU : X86_IPI_FLUSH_FPU); while (p->p_addr->u_pcb.pcb_fpcpu != NULL) SPINLOCK_SPIN_HOOK; } diff --git a/sys/arch/amd64/amd64/ipifuncs.c b/sys/arch/amd64/amd64/ipifuncs.c index 73fed196631..5738f9df091 100644 --- a/sys/arch/amd64/amd64/ipifuncs.c +++ b/sys/arch/amd64/amd64/ipifuncs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipifuncs.c,v 1.12 2010/06/26 15:56:40 mlarkin Exp $ */ +/* $OpenBSD: ipifuncs.c,v 1.13 2010/07/21 14:08:09 kettenis Exp $ */ /* $NetBSD: ipifuncs.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /*- @@ -110,13 +110,15 @@ x86_64_ipi_halt(struct cpu_info *ci) void x86_64_ipi_flush_fpu(struct cpu_info *ci) { - fpusave_cpu(ci, 0); + if (ci->ci_fpsaveproc == ci->ci_fpcurproc) + fpusave_cpu(ci, 0); } void x86_64_ipi_synch_fpu(struct cpu_info *ci) { - fpusave_cpu(ci, 1); + if (ci->ci_fpsaveproc == ci->ci_fpcurproc) + fpusave_cpu(ci, 1); } #if NMTRR > 0 diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 71286c5b7d1..c9730702f2f 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.51 2009/12/09 14:27:34 oga Exp $ */ +/* $OpenBSD: cpu.h,v 1.52 2010/07/21 14:08:09 kettenis Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -74,6 +74,7 @@ struct cpu_info { u_int64_t ci_scratch; struct proc *ci_fpcurproc; + struct proc *ci_fpsaveproc; int ci_fpsaving; struct pcb *ci_curpcb; |