Changed the aston() family to operate on a specified process instead of

always on curproc.  This is needed to implement signal delivery properly
(see a future log message for kern_sig.c).

Debogotified the definition of aston().  aston() was defined in terms
of signotify() (perhaps because only the latter already operated on
a specified process), but aston() is the primitive.

Similar changes are needed in the ia64 versions of cpu.h and trap.c.
I didn't make them because the ia64 is missing the prerequisite changes
to make astpending and need_resched per-process and those changes are
too large to make without testing.
This commit is contained in:
Bruce Evans 2001-02-19 04:15:59 +00:00
parent 30f6482c54
commit 866546105a
9 changed files with 24 additions and 20 deletions

View File

@ -773,7 +773,7 @@ ast(framep)
* acquiring and releasing mutexes in assembly is not fun.
*/
mtx_lock_spin(&sched_lock);
if (!(astpending() || resched_wanted())) {
if (!(astpending(p) || resched_wanted())) {
mtx_unlock_spin(&sched_lock);
return;
}
@ -781,7 +781,7 @@ ast(framep)
sticks = p->p_sticks;
p->p_md.md_tf = framep;
astoff();
astoff(p);
cnt.v_soft++;
mtx_intr_enable(&sched_lock);
if (p->p_sflag & PS_OWEUPC) {

View File

@ -80,7 +80,7 @@ struct clockframe {
#define need_proftick(p) do { \
mtx_lock_spin(&sched_lock); \
(p)->p_sflag |= PS_OWEUPC; \
aston(); \
aston(p); \
mtx_unlock_spin(&sched_lock); \
} while (0)

View File

@ -1285,14 +1285,14 @@ ast(frame)
* acquiring and releasing mutexes in assembly is not fun.
*/
mtx_lock_spin(&sched_lock);
if (!(astpending() || resched_wanted())) {
if (!(astpending(p) || resched_wanted())) {
mtx_unlock_spin(&sched_lock);
return;
}
sticks = p->p_sticks;
astoff();
astoff(p);
mtx_intr_enable(&sched_lock);
atomic_add_int(&cnt.v_soft, 1);
if (p->p_sflag & PS_OWEUPC) {

View File

@ -79,7 +79,7 @@
#define need_proftick(p) do { \
mtx_lock_spin(&sched_lock); \
(p)->p_sflag |= PS_OWEUPC; \
aston(); \
aston(p); \
mtx_unlock_spin(&sched_lock); \
} while (0)

View File

@ -1285,14 +1285,14 @@ ast(frame)
* acquiring and releasing mutexes in assembly is not fun.
*/
mtx_lock_spin(&sched_lock);
if (!(astpending() || resched_wanted())) {
if (!(astpending(p) || resched_wanted())) {
mtx_unlock_spin(&sched_lock);
return;
}
sticks = p->p_sticks;
astoff();
astoff(p);
mtx_intr_enable(&sched_lock);
atomic_add_int(&cnt.v_soft, 1);
if (p->p_sflag & PS_OWEUPC) {

View File

@ -79,7 +79,7 @@
#define need_proftick(p) do { \
mtx_lock_spin(&sched_lock); \
(p)->p_sflag |= PS_OWEUPC; \
aston(); \
aston(p); \
mtx_unlock_spin(&sched_lock); \
} while (0)

View File

@ -172,14 +172,14 @@ hardclock(frame)
itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) {
mtx_lock_spin(&sched_lock);
p->p_sflag |= PS_ALRMPEND;
aston();
aston(p);
mtx_unlock_spin(&sched_lock);
}
if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) {
mtx_lock_spin(&sched_lock);
p->p_sflag |= PS_PROFPEND;
aston();
aston(p);
mtx_unlock_spin(&sched_lock);
}
}

View File

@ -1285,14 +1285,14 @@ ast(frame)
* acquiring and releasing mutexes in assembly is not fun.
*/
mtx_lock_spin(&sched_lock);
if (!(astpending() || resched_wanted())) {
if (!(astpending(p) || resched_wanted())) {
mtx_unlock_spin(&sched_lock);
return;
}
sticks = p->p_sticks;
astoff();
astoff(p);
mtx_intr_enable(&sched_lock);
atomic_add_int(&cnt.v_soft, 1);
if (p->p_sflag & PS_OWEUPC) {

View File

@ -396,22 +396,26 @@ sigonstack(size_t sp)
} while (0)
/*
* Notify the current process (p) that it has a signal pending,
* process as soon as possible.
* Schedule an Asynchronous System Trap (AST) on return to user mode.
*/
#define aston() signotify(CURPROC)
#define signotify(p) do { \
#define aston(p) do { \
mtx_assert(&sched_lock, MA_OWNED); \
(p)->p_sflag |= PS_ASTPENDING; \
} while (0)
#define astpending() (curproc->p_sflag & PS_ASTPENDING)
#define astpending(p) ((p)->p_sflag & PS_ASTPENDING)
#define astoff() do { \
#define astoff(p) do { \
mtx_assert(&sched_lock, MA_OWNED); \
CURPROC->p_sflag &= ~PS_ASTPENDING; \
(p)->p_sflag &= ~PS_ASTPENDING; \
} while (0)
/*
* Notify the current process (p) that it has a signal pending,
* process as soon as possible.
*/
#define signotify(p) aston(p)
/* Handy macro to determine if p1 can mangle p2. */
#define PRISON_CHECK(p1, p2) \
((p1)->p_prison == NULL || (p1)->p_prison == (p2)->p_prison)