summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-06-24 15:48:02 +0000
committerjake <jake@FreeBSD.org>2002-06-24 15:48:02 +0000
commite102a9b6dd829c7b39358e1bed4ae6be3a6758d7 (patch)
tree1a54d6235cda96b2ca3034521ce9b0b528207189 /sys
parentfcf509a309739f81379da3e12a817b78746521b8 (diff)
downloadFreeBSD-src-e102a9b6dd829c7b39358e1bed4ae6be3a6758d7.zip
FreeBSD-src-e102a9b6dd829c7b39358e1bed4ae6be3a6758d7.tar.gz
Add an MD callout like cpu_exit, but which is called after sched_lock is
obtained, when all other scheduling activity is suspended. This is needed on sparc64 to deactivate the vmspace of the exiting process on all cpus. Otherwise if another unrelated process gets the exact same vmspace structure allocated to it (same address), its address space will not be activated properly. This seems to fix some spontaneous signal 11 problems with smp on sparc64.
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/vm_machdep.c6
-rw-r--r--sys/amd64/amd64/vm_machdep.c6
-rw-r--r--sys/i386/i386/vm_machdep.c6
-rw-r--r--sys/ia64/ia64/vm_machdep.c6
-rw-r--r--sys/kern/kern_exit.c1
-rw-r--r--sys/powerpc/aim/vm_machdep.c6
-rw-r--r--sys/powerpc/powerpc/vm_machdep.c6
-rw-r--r--sys/sparc64/sparc64/vm_machdep.c22
-rw-r--r--sys/sys/proc.h1
9 files changed, 60 insertions, 0 deletions
diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c
index 4209cce..e57593c 100644
--- a/sys/alpha/alpha/vm_machdep.c
+++ b/sys/alpha/alpha/vm_machdep.c
@@ -248,6 +248,12 @@ cpu_exit(td)
}
void
+cpu_sched_exit(td)
+ register struct thread *td;
+{
+}
+
+void
cpu_wait(p)
struct proc *p;
{
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index a7e852a..5dc2e14 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -283,6 +283,12 @@ cpu_exit(td)
}
void
+cpu_sched_exit(td)
+ register struct thread *td;
+{
+}
+
+void
cpu_wait(p)
struct proc *p;
{
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index a7e852a..5dc2e14 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -283,6 +283,12 @@ cpu_exit(td)
}
void
+cpu_sched_exit(td)
+ register struct thread *td;
+{
+}
+
+void
cpu_wait(p)
struct proc *p;
{
diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c
index 7a5c327..24ea100 100644
--- a/sys/ia64/ia64/vm_machdep.c
+++ b/sys/ia64/ia64/vm_machdep.c
@@ -314,6 +314,12 @@ cpu_exit(td)
}
void
+cpu_sched_exit(td)
+ register struct thread *td;
+{
+}
+
+void
cpu_wait(p)
struct proc *p;
{
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index d35b3e1..fab9437 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -448,6 +448,7 @@ exit1(td, rv)
binuptime(PCPU_PTR(switchtime));
PCPU_SET(switchticks, ticks);
+ cpu_sched_exit(td);
cpu_throw();
panic("exit1");
}
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
index 12aeaf2..fe9cab7 100644
--- a/sys/powerpc/aim/vm_machdep.c
+++ b/sys/powerpc/aim/vm_machdep.c
@@ -209,6 +209,12 @@ cpu_exit(td)
}
void
+cpu_sched_exit(td)
+ register struct thread *td;
+{
+}
+
+void
cpu_wait(td)
struct proc *td;
{
diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c
index 12aeaf2..fe9cab7 100644
--- a/sys/powerpc/powerpc/vm_machdep.c
+++ b/sys/powerpc/powerpc/vm_machdep.c
@@ -209,6 +209,12 @@ cpu_exit(td)
}
void
+cpu_sched_exit(td)
+ register struct thread *td;
+{
+}
+
+void
cpu_wait(td)
struct proc *td;
{
diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c
index 9fd910b..a896754 100644
--- a/sys/sparc64/sparc64/vm_machdep.c
+++ b/sys/sparc64/sparc64/vm_machdep.c
@@ -86,6 +86,28 @@ cpu_exit(struct thread *td)
}
}
+void
+cpu_sched_exit(struct thread *td)
+{
+ struct vmspace *vm;
+ struct pcpu *pc;
+ struct proc *p;
+
+ mtx_assert(&sched_lock, MA_OWNED);
+
+ p = td->td_proc;
+ vm = p->p_vmspace;
+ if (vm->vm_refcnt > 1)
+ return;
+ SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+ if (pc->pc_vmspace == vm) {
+ vm->vm_pmap.pm_active &= ~pc->pc_cpumask;
+ vm->vm_pmap.pm_context[pc->pc_cpuid] = -1;
+ pc->pc_vmspace = NULL;
+ }
+ }
+}
+
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the pcb, set up the stack so that the child
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 9f37898..f37ade7 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -752,6 +752,7 @@ void userret(struct thread *, struct trapframe *, u_int);
void maybe_resched(struct thread *);
void cpu_exit(struct thread *);
+void cpu_sched_exit(struct thread *);
void exit1(struct thread *, int) __dead2;
void cpu_fork(struct thread *, struct proc *, struct thread *, int);
void cpu_set_fork_handler(struct thread *, void (*)(void *), void *);
OpenPOWER on IntegriCloud