From owner-cvs-all Sat Jan 5 0:47:20 2002 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0540B37B41B; Sat, 5 Jan 2002 00:47:14 -0800 (PST) Received: (from jhb@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g058lDu71491; Sat, 5 Jan 2002 00:47:13 -0800 (PST) (envelope-from jhb) Message-Id: <200201050847.g058lDu71491@freefall.freebsd.org> From: John Baldwin Date: Sat, 5 Jan 2002 00:47:13 -0800 (PST) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/alpha/alpha busdma_machdep.c interrupt.c src/sys/cam cam_xpt.c src/sys/dev/acpica/Osd OsdSchedule.c src/sys/dev/sio sio.c src/sys/i386/i386 busdma_machdep.c src/sys/i386/isa apic_vector.s cy.c icu_vector.s rc.c ... X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG jhb 2002/01/05 00:47:13 PST Modified files: sys/alpha/alpha busdma_machdep.c interrupt.c sys/cam cam_xpt.c sys/dev/acpica/Osd OsdSchedule.c sys/dev/sio sio.c sys/i386/i386 busdma_machdep.c sys/i386/isa apic_vector.s cy.c icu_vector.s rc.c sys/ia64/ia64 busdma_machdep.c interrupt.c sys/kern kern_clock.c kern_condvar.c kern_exit.c kern_intr.c kern_mutex.c kern_shutdown.c kern_sig.c kern_subr.c kern_synch.c subr_taskqueue.c subr_trap.c subr_witness.c sys/pc98/pc98 sio.c sys/sys interrupt.h lock.h mutex.h proc.h sys/vm vm_glue.c Log: Change the preemption code for software interrupt thread schedules and mutex releases to not require flags for the cases when preemption is not allowed: The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent switching to a higher priority thread on mutex releease and swi schedule, respectively when that switch is not safe. Now that the critical section API maintains a per-thread nesting count, the kernel can easily check whether or not it should switch without relying on flags from the programmer. This fixes a few bugs in that all current callers of swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from fast interrupt handlers and the swi_sched of softclock needed this flag. Note that to ensure that swi_sched()'s in clock and fast interrupt handlers do not switch, these handlers have to be explicitly wrapped in critical_enter/exit pairs. Presently, just wrapping the handlers is sufficient, but in the future with the fully preemptive kernel, the interrupt must be EOI'd before critical_exit() is called. (critical_exit() can switch due to a deferred preemption in a fully preemptive kernel.) I've tested the changes to the interrupt code on i386 and alpha. I have not tested ia64, but the interrupt code is almost identical to the alpha code, so I expect it will work fine. PowerPC and ARM do not yet have interrupt code in the tree so they shouldn't be broken. Sparc64 is broken, but that's been ok'd by jake and tmm who will be fixing the interrupt code for sparc64 shortly. Reviewed by: peter Tested on: i386, alpha Revision Changes Path 1.22 +2 -2 src/sys/alpha/alpha/busdma_machdep.c 1.60 +4 -0 src/sys/alpha/alpha/interrupt.c 1.121 +2 -2 src/sys/cam/cam_xpt.c 1.16 +1 -1 src/sys/dev/acpica/Osd/OsdSchedule.c 1.359 +4 -4 src/sys/dev/sio/sio.c 1.25 +2 -2 src/sys/i386/i386/busdma_machdep.c 1.75 +2 -0 src/sys/i386/isa/apic_vector.s 1.124 +10 -10 src/sys/i386/isa/cy.c 1.31 +3 -1 src/sys/i386/isa/icu_vector.s 1.65 +5 -5 src/sys/i386/isa/rc.c 1.9 +1 -1 src/sys/ia64/ia64/busdma_machdep.c 1.18 +4 -0 src/sys/ia64/ia64/interrupt.c 1.135 +1 -1 src/sys/kern/kern_clock.c 1.17 +9 -9 src/sys/kern/kern_condvar.c 1.145 +2 -2 src/sys/kern/kern_exit.c 1.66 +7 -6 src/sys/kern/kern_intr.c 1.76 +3 -11 src/sys/kern/kern_mutex.c 1.115 +1 -1 src/sys/kern/kern_shutdown.c 1.142 +4 -4 src/sys/kern/kern_sig.c 1.49 +2 -2 src/sys/kern/kern_subr.c 1.168 +6 -6 src/sys/kern/kern_synch.c 1.11 +1 -1 src/sys/kern/subr_taskqueue.c 1.205 +1 -1 src/sys/kern/subr_trap.c 1.95 +2 -14 src/sys/kern/subr_witness.c 1.160 +4 -4 src/sys/pc98/pc98/sio.c 1.21 +2 -4 src/sys/sys/interrupt.h 1.42 +0 -1 src/sys/sys/lock.h 1.48 +1 -12 src/sys/sys/mutex.h 1.197 +0 -2 src/sys/sys/proc.h 1.121 +2 -2 src/sys/vm/vm_glue.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message