summaryrefslogtreecommitdiffstats
path: root/sys/dev/rc
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-01-05 08:47:13 +0000
committerjhb <jhb@FreeBSD.org>2002-01-05 08:47:13 +0000
commit1ce407b6755fc202866c4e1e2887b37a6fc09a9a (patch)
tree619ee98d73f5552ae93c3c8fee5af6b40ff37908 /sys/dev/rc
parent2f03379495e351d56fc8e84f79e7d2150f6b4b49 (diff)
downloadFreeBSD-src-1ce407b6755fc202866c4e1e2887b37a6fc09a9a.zip
FreeBSD-src-1ce407b6755fc202866c4e1e2887b37a6fc09a9a.tar.gz
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
Diffstat (limited to 'sys/dev/rc')
-rw-r--r--sys/dev/rc/rc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c
index 59e8dff..d9bd2ad 100644
--- a/sys/dev/rc/rc.c
+++ b/sys/dev/rc/rc.c
@@ -362,7 +362,7 @@ rcintr(unit)
optr++;
rc_scheduled_event++;
if (val != 0 && val == rc->rc_hotchar)
- swi_sched(rc_ih, SWI_NOSWITCH);
+ swi_sched(rc_ih, 0);
}
} else {
/* Store also status data */
@@ -393,7 +393,7 @@ rcintr(unit)
&& (rc->rc_tp->t_iflag & INPCK))))
val = 0;
else if (val != 0 && val == rc->rc_hotchar)
- swi_sched(rc_ih, SWI_NOSWITCH);
+ swi_sched(rc_ih, 0);
optr[0] = val;
optr[INPUT_FLAGS_SHIFT] = iack;
optr++;
@@ -440,7 +440,7 @@ rcintr(unit)
if ((iack & MCR_CDchg) && !(rc->rc_flags & RC_MODCHG)) {
rc_scheduled_event += LOTS_OF_EVENTS;
rc->rc_flags |= RC_MODCHG;
- swi_sched(rc_ih, SWI_NOSWITCH);
+ swi_sched(rc_ih, 0);
}
goto more_intrs;
}
@@ -481,7 +481,7 @@ rcintr(unit)
if (!(rc->rc_flags & RC_DOXXFER)) {
rc_scheduled_event += LOTS_OF_EVENTS;
rc->rc_flags |= RC_DOXXFER;
- swi_sched(rc_ih, SWI_NOSWITCH);
+ swi_sched(rc_ih, 0);
}
}
}
OpenPOWER on IntegriCloud