Module Name:    src
Committed By:   manu
Date:           Fri May 17 00:37:14 UTC 2024

Modified Files:
        src/sys/arch/x86/x86: fpu.c

Log Message:
iWorkaround panic: fpudna from userland

i386 Xen PV domU get spurious fpudna traps from userland. Older eager FPU
contact switching code took care of ignoring them. When transitioning
from eager switching to awlays switching, this special handling was
removed, causing "fpudna from userland" panics.

This change restores the previosu behavior where fpudna traps from
userland are ignored on Xen PV domU.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/x86/x86/fpu.c

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/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.87 src/sys/arch/x86/x86/fpu.c:1.88
--- src/sys/arch/x86/x86/fpu.c:1.87	Tue Jul 18 12:34:25 2023
+++ src/sys/arch/x86/x86/fpu.c	Fri May 17 00:37:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.87 2023/07/18 12:34:25 riastradh Exp $	*/
+/*	$NetBSD: fpu.c,v 1.88 2024/05/17 00:37:14 manu Exp $	*/
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.87 2023/07/18 12:34:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.88 2024/05/17 00:37:14 manu Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -617,6 +617,15 @@ fputrap(struct trapframe *frame)
 void
 fpudna(struct trapframe *frame)
 {
+#ifdef XENPV
+	/*
+	 * Xen produes spurious fpudna traps, just do nothing.
+	 */
+	if (USERMODE(frame->tf_cs)) {
+		clts();
+		return;
+	} 
+#endif
 	panic("fpudna from %s, ip %p, trapframe %p",
 	    USERMODE(frame->tf_cs) ? "userland" : "kernel",
 	    (void *)X86_TF_RIP(frame), frame);

Reply via email to