From fa7fad8ab9132ad236a2a182db22f3782ce447c1 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 14 Jun 2018 10:33:26 +0000 Subject: [PATCH] Remove printf() in #NM handler. Give up and remove the almost useless informational message reporting that device not available exception occured while our state tracking indicates the current CPU has FPU context loaded for the current thread. It seems that this is recurring bug with some VM monitors. Sponsored by: The FreeBSD Foundation --- sys/amd64/amd64/fpu.c | 7 ++++++- sys/i386/i386/npx.c | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 3b5ffe8a3801..123dc78ece26 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -723,7 +723,12 @@ fpudna(void) KASSERT((curpcb->pcb_flags & PCB_FPUNOSAVE) == 0, ("fpudna while in fpu_kern_enter(FPU_KERN_NOCTX)")); if (PCPU_GET(fpcurthread) == td) { - printf("fpudna: fpcurthread == curthread\n"); + /* + * Some virtual machines seems to set %cr0.TS at + * arbitrary moments. Silently clear the TS bit + * regardless of the eager/lazy FPU context switch + * mode. + */ stop_emulating(); critical_exit(); return; diff --git a/sys/i386/i386/npx.c b/sys/i386/i386/npx.c index 2a56eb8e5ccb..7248da3d4b3a 100644 --- a/sys/i386/i386/npx.c +++ b/sys/i386/i386/npx.c @@ -826,9 +826,6 @@ restore_npx_curthread(struct thread *td, struct pcb *pcb) * and not necessarily for every context switch, but it is too hard to * access foreign pcb's. */ - -static int err_count = 0; - int npxdna(void) { @@ -839,8 +836,12 @@ npxdna(void) td = curthread; critical_enter(); if (PCPU_GET(fpcurthread) == td) { - printf("npxdna: fpcurthread == curthread %d times\n", - ++err_count); + /* + * Some virtual machines seems to set %cr0.TS at + * arbitrary moments. Silently clear the TS bit + * regardless of the eager/lazy FPU context switch + * mode. + */ stop_emulating(); critical_exit(); return (1);