diff options
author | jhb <jhb@FreeBSD.org> | 2001-08-10 22:53:32 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-08-10 22:53:32 +0000 |
commit | 4a89454dcd75ebc44e557012c2d007934836f9de (patch) | |
tree | 1798843f61bbf42ad4e659497c23572b272969ca /sys/alpha | |
parent | 63014c2530236dbd3818166d675b28e0e61b427e (diff) | |
download | FreeBSD-src-4a89454dcd75ebc44e557012c2d007934836f9de.zip FreeBSD-src-4a89454dcd75ebc44e557012c2d007934836f9de.tar.gz |
- Close races with signals and other AST's being triggered while we are in
the process of exiting the kernel. The ast() function now loops as long
as the PS_ASTPENDING or PS_NEEDRESCHED flags are set. It returns with
preemption disabled so that any further AST's that arrive via an
interrupt will be delayed until the low-level MD code returns to user
mode.
- Use u_int's to store the tick counts for profiling purposes so that we
do not need sched_lock just to read p_sticks. This also closes a
problem where the call to addupc_task() could screw up the arithmetic
due to non-atomic reads of p_sticks.
- Axe need_proftick(), aston(), astoff(), astpending(), need_resched(),
clear_resched(), and resched_wanted() in favor of direct bit operations
on p_sflag.
- Fix up locking with sched_lock some. In addupc_intr(), use sched_lock
to ensure pr_addr and pr_ticks are updated atomically with setting
PS_OWEUPC. In ast() we clear pr_ticks atomically with clearing
PS_OWEUPC. We also do not grab the lock just to test a flag.
- Simplify the handling of Giant in ast() slightly.
Reviewed by: bde (mostly)
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/alpha/trap.c | 8 | ||||
-rw-r--r-- | sys/alpha/include/cpu.h | 14 |
2 files changed, 2 insertions, 20 deletions
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index 2fdb2a2..423d4a7 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -259,7 +259,7 @@ trap(a0, a1, a2, entry, framep) register struct proc *p; register int i; u_int64_t ucode; - u_quad_t sticks; + u_int sticks; int user; #ifdef SMP critical_t s; @@ -289,9 +289,7 @@ trap(a0, a1, a2, entry, framep) CTR5(KTR_TRAP, "%s trap: pid %d, (%lx, %lx, %lx)", user ? "user" : "kernel", p->p_pid, a0, a1, a2); if (user) { - mtx_lock_spin(&sched_lock); sticks = p->p_sticks; - mtx_unlock_spin(&sched_lock); p->p_frame = framep; } else { sticks = 0; /* XXX bogus -Wuninitialized warning */ @@ -654,7 +652,7 @@ syscall(code, framep) struct proc *p; int error = 0; u_int64_t opc; - u_quad_t sticks; + u_int sticks; u_int64_t args[10]; /* XXX */ u_int hidden = 0, nargs; #ifdef SMP @@ -685,9 +683,7 @@ syscall(code, framep) cnt.v_syscall++; p->p_frame = framep; opc = framep->tf_regs[FRAME_PC] - 4; - mtx_lock_spin(&sched_lock); sticks = p->p_sticks; - mtx_unlock_spin(&sched_lock); #ifdef DIAGNOSTIC alpha_fpstate_check(p); diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index e901cb1..69ed2ea 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -70,20 +70,6 @@ struct clockframe { #define CLKF_PC(framep) TRAPF_PC(&(framep)->cf_tf) /* - * Arrange to handle pending profiling ticks before returning to user mode. - * - * XXX this is now poorly named and implemented. It used to handle only a - * single tick and the PS_OWEUPC flag served as a counter. Now there is a - * counter in the proc table and flag isn't really necessary. - */ -#define need_proftick(p) do { \ - mtx_lock_spin(&sched_lock); \ - (p)->p_sflag |= PS_OWEUPC; \ - aston(p); \ - mtx_unlock_spin(&sched_lock); \ -} while (0) - -/* * CTL_MACHDEP definitions. */ #define CPU_CONSDEV 1 /* dev_t: console terminal device */ |