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/ia64 | |
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/ia64')
-rw-r--r-- | sys/ia64/ia64/trap.c | 8 | ||||
-rw-r--r-- | sys/ia64/include/cpu.h | 13 |
2 files changed, 2 insertions, 19 deletions
diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c index 4028515..9baf9e1 100644 --- a/sys/ia64/ia64/trap.c +++ b/sys/ia64/ia64/trap.c @@ -180,7 +180,7 @@ trap(int vector, int imm, struct trapframe *framep) struct proc *p; int i; u_int64_t ucode; - u_quad_t sticks; + u_int sticks; int user; cnt.v_trap++; @@ -189,9 +189,7 @@ trap(int vector, int imm, struct trapframe *framep) user = ((framep->tf_cr_ipsr & IA64_PSR_CPL) == IA64_PSR_CPL_USER); 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 */ @@ -444,14 +442,12 @@ syscall(int code, u_int64_t *args, struct trapframe *framep) struct proc *p; int error = 0; u_int64_t oldip, oldri; - u_quad_t sticks; + u_int sticks; cnt.v_syscall++; p = curproc; p->p_frame = framep; - mtx_lock_spin(&sched_lock); sticks = p->p_sticks; - mtx_unlock_spin(&sched_lock); mtx_lock(&Giant); /* diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h index d8518c4..062bebc 100644 --- a/sys/ia64/include/cpu.h +++ b/sys/ia64/include/cpu.h @@ -70,19 +70,6 @@ struct clockframe { #define CLKF_PC(framep) TRAPF_PC(&(framep)->cf_tf) /* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the hp300, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#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 */ |