Module Name:    src
Committed By:   martin
Date:           Thu Jun 20 11:02:17 UTC 2024

Modified Files:
        src/sys/arch/x86/x86 [netbsd-10]: fpu.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #701):

        sys/arch/x86/x86/fpu.c: revision 1.88

Workaround 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.79.4.2 -r1.79.4.3 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.79.4.2 src/sys/arch/x86/x86/fpu.c:1.79.4.3
--- src/sys/arch/x86/x86/fpu.c:1.79.4.2	Tue Jul 25 11:41:42 2023
+++ src/sys/arch/x86/x86/fpu.c	Thu Jun 20 11:02:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.79.4.2 2023/07/25 11:41:42 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin 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.79.4.2 2023/07/25 11:41:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.79.4.3 2024/06/20 11:02:16 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -603,6 +603,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