From owner-p4-projects@FreeBSD.ORG Mon Oct 25 16:12:49 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B8FCA106567A; Mon, 25 Oct 2010 16:12:49 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B86B1065675 for ; Mon, 25 Oct 2010 16:12:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 675978FC1A for ; Mon, 25 Oct 2010 16:12:49 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9PGCnSo052341 for ; Mon, 25 Oct 2010 16:12:49 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9PGCnQ8052338 for perforce@freebsd.org; Mon, 25 Oct 2010 16:12:49 GMT (envelope-from jhb@freebsd.org) Date: Mon, 25 Oct 2010 16:12:49 GMT Message-Id: <201010251612.o9PGCnQ8052338@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185089 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 16:12:49 -0000 http://p4web.freebsd.org/@@185089?ac=10 Change 185089 by jhb@jhb_jhbbsd on 2010/10/25 16:12:41 Don't try to use the saved register flag in td_md after spinlock count drops to zero since a single stepping trap may clobber it. I think we also need to follow a similar rule in spinlock_enter() as well. Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/machdep.c#96 edit .. //depot/projects/smpng/sys/arm/arm/machdep.c#31 edit .. //depot/projects/smpng/sys/i386/i386/machdep.c#161 edit .. //depot/projects/smpng/sys/ia64/ia64/machdep.c#125 edit .. //depot/projects/smpng/sys/mips/mips/machdep.c#16 edit .. //depot/projects/smpng/sys/pc98/pc98/machdep.c#42 edit .. //depot/projects/smpng/sys/powerpc/aim/machdep.c#21 edit .. //depot/projects/smpng/sys/powerpc/booke/machdep.c#18 edit .. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#104 edit .. //depot/projects/smpng/sys/sun4v/sun4v/machdep.c#15 edit Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#96 (text+ko) ==== @@ -1773,12 +1773,14 @@ spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } /* ==== //depot/projects/smpng/sys/arm/arm/machdep.c#31 (text+ko) ==== @@ -505,12 +505,14 @@ spinlock_exit(void) { struct thread *td; + register_t cspr; td = curthread; critical_exit(); + cspr = td->td_md.md_saved_cspr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - restore_interrupts(td->td_md.md_saved_cspr); + restore_interrupts(cspr); } /* ==== //depot/projects/smpng/sys/i386/i386/machdep.c#161 (text+ko) ==== @@ -3008,12 +3008,14 @@ spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } #if defined(I586_CPU) && !defined(NO_F00F_HACK) ==== //depot/projects/smpng/sys/ia64/ia64/machdep.c#125 (text+ko) ==== @@ -525,12 +525,14 @@ spinlock_exit(void) { struct thread *td; + int intr; td = curthread; critical_exit(); + intr = td->td_md.md_saved_intr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_intr); + intr_restore(intr); } void ==== //depot/projects/smpng/sys/mips/mips/machdep.c#16 (text+ko) ==== @@ -462,12 +462,14 @@ spinlock_exit(void) { struct thread *td; + register_t intr; td = curthread; critical_exit(); + intr = td->td_md.md_saved_intr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_intr); + intr_restore(intr); } /* ==== //depot/projects/smpng/sys/pc98/pc98/machdep.c#42 (text+ko) ==== @@ -2340,12 +2340,14 @@ spinlock_exit(void) { struct thread *td; + register_t flags; td = curthread; critical_exit(); + flags = td->td_md.md_saved_flags; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_flags); + intr_restore(flags); } #if defined(I586_CPU) && !defined(NO_F00F_HACK) ==== //depot/projects/smpng/sys/powerpc/aim/machdep.c#21 (text+ko) ==== @@ -763,12 +763,14 @@ spinlock_exit(void) { struct thread *td; + register_t msr; td = curthread; critical_exit(); + msr = td->td_md.md_saved_msr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_msr); + intr_restore(msr); } /* ==== //depot/projects/smpng/sys/powerpc/booke/machdep.c#18 (text+ko) ==== @@ -528,12 +528,14 @@ spinlock_exit(void) { struct thread *td; + register_t msr; td = curthread; critical_exit(); + msr = td->td_md.md_saved_msr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_msr); + intr_restore(msr); } /* Shutdown the CPU as much as possible. */ ==== //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#104 (text+ko) ==== @@ -234,12 +234,14 @@ spinlock_exit(void) { struct thread *td; + register_t pil; td = curthread; critical_exit(); + pil = td->td_md.md_saved_pil; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - wrpr(pil, td->td_md.md_saved_pil, 0); + wrpr(pil, pil, 0); } static phandle_t ==== //depot/projects/smpng/sys/sun4v/sun4v/machdep.c#15 (text+ko) ==== @@ -279,14 +279,15 @@ spinlock_exit(void) { struct thread *td; + register_t pil; td = curthread; critical_exit(); + pil = td->td_md.md_saved_pil; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) { - intr_restore(td->td_md.md_saved_pil); + intr_restore(pil); } - } unsigned