From: kettenis Date: Fri, 18 Jun 2021 21:52:47 +0000 (+0000) Subject: When we do a context switch, always set the FPU to "off" for the old proc. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=36fde14f95495f263442c45d119f7f3f44f04018;p=openbsd When we do a context switch, always set the FPU to "off" for the old proc. Disable the optimization to mark the new proc "clean" since it causes random failures in regress. Hopefully we can revisit this soon. ok drahn@ --- diff --git a/sys/arch/riscv64/riscv64/machdep.c b/sys/arch/riscv64/riscv64/machdep.c index 43cdba3c04a..71fa65a19eb 100644 --- a/sys/arch/riscv64/riscv64/machdep.c +++ b/sys/arch/riscv64/riscv64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.20 2021/06/13 16:27:15 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.21 2021/06/18 21:52:47 kettenis Exp $ */ /* * Copyright (c) 2014 Patrick Wildt @@ -304,16 +304,20 @@ cpu_switchto(struct proc *old, struct proc *new) if ((tf->tf_sstatus & SSTATUS_FS_MASK) == SSTATUS_FS_DIRTY) { fpu_save(old, tf); } + tf->tf_sstatus &= ~SSTATUS_FS_MASK; } cpu_switchto_asm(old, new); pcb = ci->ci_curpcb; tf = new->p_addr->u_pcb.pcb_tf; +#if 0 + /* XXX this optimization is subtly broken */ if (pcb->pcb_fpcpu == ci && ci->ci_fpuproc == new) { /* If fpu state is already loaded, allow it to be used */ tf->tf_sstatus |= SSTATUS_FS_CLEAN; } +#endif } /*