NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR/58561 CVS commit: [netbsd-9] src/sys/arch



The following reply was made to PR port-xen/58561; it has been noted by GNATS.

From: "Martin Husemann" <martin%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/58561 CVS commit: [netbsd-9] src/sys/arch
Date: Sun, 25 Jan 2026 16:41:14 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Jan 25 16:41:14 UTC 2026
 
 Modified Files:
 	src/sys/arch/amd64/amd64 [netbsd-9]: amd64_trap.S cpufunc.S locore.S
 	    spl.S
 	src/sys/arch/amd64/include [netbsd-9]: frameasm.h
 	src/sys/arch/i386/i386 [netbsd-9]: i386_trap.S locore.S spl.S
 	src/sys/arch/i386/include [netbsd-9]: frameasm.h
 	src/sys/arch/x86/x86 [netbsd-9]: fpu.c
 	src/sys/arch/xen/x86 [netbsd-9]: xen_intr.c
 
 Log Message:
 Pull up following revision(s) (requested by bouyer in ticket #1998):
 
 	sys/arch/amd64/include/frameasm.h: revision 1.56
 	sys/arch/xen/x86/xen_intr.c: revision 1.32
 	sys/arch/i386/include/frameasm.h: revision 1.36
 	sys/arch/i386/i386/locore.S: revision 1.206
 	sys/arch/amd64/amd64/cpufunc.S: revision 1.71
 	sys/arch/i386/i386/i386_trap.S: revision 1.25
 	sys/arch/i386/i386/spl.S: revision 1.59
 	sys/arch/amd64/amd64/locore.S: revision 1.236
 	sys/arch/amd64/amd64/spl.S: revision 1.50
 	sys/arch/x86/x86/fpu.c: revision 1.94
 	sys/arch/amd64/amd64/amd64_trap.S: revision 1.56
 	(all via patch)
 
 fputrap: enable interrupts before panic(), for consistency.
 noticed while working on PR port-xen/58561
 updating curcup()->ci_vcpu->evtchn_upcall_mask requires 2 intructions, e.g.
 movq CPUVAR(VCPU),%r ## temp_reg ;
 movb $1,EVTCHN_UPCALL_MASK(%r ## temp_reg);
 
 With preemption enabled we may be moved to another CPU between the
 2 intructions and we end up updating the evtchn_upcall_mask of another VCPU
 than the one we're now running on.
 
 Fix for Xen/amd64:
 - Add a CLI2 macro, which disables preemtion before the above sequence.
   Use it instead of CLI where preemtion may be enabled
 - Add DIAGNOSTIC code to check that preemtion is disabled in CLI
 - Add DIAGNOSTIC code to check that interrupts are disabled when calling STI
 while there, remove PUSHF/POPF macros which are unused
 
 Hopefully fixes PR port-xen/58561
 
 Thanks to Konrad Schroder for testing and Taylor R Campbell for review.
 
 Port amd64 fix for PR port-xen/58561 to i386, with one extra fix:
 with recent Xen (maybe since pvshim), traps handlers are called with
 interrupts enabled, so adjust the i386 assembly code for this.
 updating curcup()->ci_vcpu->evtchn_upcall_mask requires 2 intructions, e.g.
 movl CPUVAR(VCPU),reg
 movb $1,EVTCHN_UPCALL_MASK(reg)
 
 With preemption enabled we may be moved to another CPU between the
 2 intructions and we end up updating the evtchn_upcall_mask of another VCPU
 than the one we're now running on.
 
 Fix for Xen/i386:
 - Add a CLI2 macro, which disables preemtion before the above sequence.
   Use it instead of CLI where preemtion may be enabled
 - Add DIAGNOSTIC code to check that preemtion is disabled in CLI
 - Add DIAGNOSTIC code to check that interrupts are disabled when calling STI     and STIC
 - rename PUSHF to PUSHFCLI and change it to both read and disable
   EVTCHN_UPCALL_MASK with preemption disabled
 - remove the XENPVHVM version of STIC which is unused
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/arch/amd64/amd64/amd64_trap.S
 cvs rdiff -u -r1.43.2.1 -r1.43.2.2 src/sys/arch/amd64/amd64/cpufunc.S
 cvs rdiff -u -r1.185.2.1 -r1.185.2.2 src/sys/arch/amd64/amd64/locore.S
 cvs rdiff -u -r1.40 -r1.40.4.1 src/sys/arch/amd64/amd64/spl.S
 cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/arch/amd64/include/frameasm.h
 cvs rdiff -u -r1.18 -r1.18.4.1 src/sys/arch/i386/i386/i386_trap.S
 cvs rdiff -u -r1.168 -r1.168.2.1 src/sys/arch/i386/i386/locore.S
 cvs rdiff -u -r1.47 -r1.47.4.1 src/sys/arch/i386/i386/spl.S
 cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/arch/i386/include/frameasm.h
 cvs rdiff -u -r1.55.2.2 -r1.55.2.3 src/sys/arch/x86/x86/fpu.c
 cvs rdiff -u -r1.17.2.1 -r1.17.2.2 src/sys/arch/xen/x86/xen_intr.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 


Home | Main Index | Thread Index | Old Index