From 4a89454dcd75ebc44e557012c2d007934836f9de Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 10 Aug 2001 22:53:32 +0000 Subject: - 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) --- sys/powerpc/aim/trap.c | 2 +- sys/powerpc/include/cpu.h | 2 -- sys/powerpc/powerpc/trap.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'sys/powerpc') diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c index 213fe29..43c754f 100644 --- a/sys/powerpc/aim/trap.c +++ b/sys/powerpc/aim/trap.c @@ -76,7 +76,7 @@ trap(struct trapframe *frame) #if 0 /* XXX: This code hasn't been reworked yet. */ struct proc *p; int type; - u_quad_t sticks; + u_int sticks; p = curproc; type = frame->exc; diff --git a/sys/powerpc/include/cpu.h b/sys/powerpc/include/cpu.h index 0a541a2..37ca02b 100644 --- a/sys/powerpc/include/cpu.h +++ b/sys/powerpc/include/cpu.h @@ -56,8 +56,6 @@ extern void delay __P((unsigned)); extern int want_resched; extern int astpending; -#define need_proftick(p) ((p)->p_flag |= PS_OWEUPC, astpending = 1) - extern char bootpath[]; #if defined(_KERNEL) || defined(_STANDALONE) diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 213fe29..43c754f 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -76,7 +76,7 @@ trap(struct trapframe *frame) #if 0 /* XXX: This code hasn't been reworked yet. */ struct proc *p; int type; - u_quad_t sticks; + u_int sticks; p = curproc; type = frame->exc; -- cgit v1.1