PERFORCE change 127424 for review
Marko Zec
zec at FreeBSD.org
Fri Oct 12 04:55:35 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=127424
Change 127424 by zec at zec_tpx32 on 2007/10/12 11:55:17
Allow for a process in parent vprocg waiting for a child proc
executing in a child vprocg context to be woken up when the
child proc exits.
Affected files ...
.. //depot/projects/vimage/src/sys/kern/kern_exit.c#8 edit
.. //depot/projects/vimage/src/sys/kern/kern_prot.c#5 edit
.. //depot/projects/vimage/src/sys/kern/kern_vimage.c#40 edit
.. //depot/projects/vimage/src/sys/kern/sched_4bsd.c#13 edit
.. //depot/projects/vimage/src/sys/sys/vimage.h#41 edit
Differences ...
==== //depot/projects/vimage/src/sys/kern/kern_exit.c#8 (text+ko) ====
@@ -176,13 +176,8 @@
("exit1: proc %p exiting with %d threads", p, p->p_numthreads));
#ifdef VIMAGE
- /*
- * Switch back to vprocg of our parent so we can deliver
- * signals, otherwise we won't die - why?!? XXX
- *
- * XXX is PROC_UNLOCK()/PROC_LOCK() sequence safe here?
- */
- if (p->p_pptr && p->p_ucred->cr_vimage->v_procg !=
+ /* XXX is PROC_UNLOCK()/PROC_LOCK() sequence safe here? */
+ if (p->p_ucred->cr_vimage->v_procg !=
p->p_pptr->p_ucred->cr_vimage->v_procg) {
struct ucred *oldcred;
@@ -190,12 +185,12 @@
crhold(p->p_pptr->p_ucred);
oldcred = p->p_ucred;
p->p_ucred = p->p_pptr->p_ucred;
+ PROC_UNLOCK(p);
+ sx_xlock(&allproc_lock);
#ifdef SCHED_4BSD
sched_load_reassign(oldcred->cr_vimage->v_procg,
p->p_ucred->cr_vimage->v_procg);
#endif
- PROC_UNLOCK(p);
- sx_xlock(&allproc_lock);
oldcred->cr_vimage->v_procg->nprocs--;
p->p_ucred->cr_vimage->v_procg->nprocs++;
sx_xunlock(&allproc_lock);
==== //depot/projects/vimage/src/sys/kern/kern_prot.c#5 (text+ko) ====
@@ -46,6 +46,7 @@
#include "opt_compat.h"
#include "opt_mac.h"
+#include "opt_vimage.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -67,6 +68,7 @@
#include <sys/socketvar.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
+#include <sys/vimage.h>
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
@@ -1720,6 +1722,9 @@
KASSERT(td == curthread, ("%s: td not curthread", __func__));
PROC_LOCK_ASSERT(p, MA_OWNED);
+#ifdef VIMAGE
+ if (!vi_child_of(td->td_ucred->cr_vimage, p->p_ucred->cr_vimage))
+#endif
if ((error = prison_check(td->td_ucred, p->p_ucred)))
return (error);
#ifdef MAC
==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#40 (text+ko) ====
@@ -67,7 +67,6 @@
static void vnet_mod_complete_registration(struct vnet_modlink *);
static int vnet_mod_constructor(struct vnet_modlink *);
static int vnet_mod_destructor(struct vnet_modlink *);
-static int vi_child_of(struct vimage *, struct vimage *);
#ifdef VI_PREALLOC_SIZE
/*
@@ -517,7 +516,7 @@
/*
* XXX priv_check()?
* XXX refcounting ucred -> vimage ?
- * XXX change ucred for proc or thread, or both?
+ * XXX allow only a single td per proc here?
*/
newcred = crget();
PROC_LOCK(p);
==== //depot/projects/vimage/src/sys/kern/sched_4bsd.c#13 (text+ko) ====
@@ -239,7 +239,7 @@
INIT_VPROCG(td->td_ucred->cr_vimage->v_procg);
V_sched_tdcnt++;
- CTR1(KTR_SCHED, "global load: %d", sched_tdcnt);
+ CTR1(KTR_SCHED, "global load: %d", V_sched_tdcnt);
}
static __inline void
@@ -248,7 +248,7 @@
INIT_VPROCG(td->td_ucred->cr_vimage->v_procg);
V_sched_tdcnt--;
- CTR1(KTR_SCHED, "global load: %d", sched_tdcnt);
+ CTR1(KTR_SCHED, "global load: %d", V_sched_tdcnt);
}
#ifdef VIMAGE
@@ -1361,19 +1361,15 @@
thread_unlock(td);
}
+int
#ifdef VIMAGE
-int
sched_load(struct vprocg *vprocg)
-{
- return (V_sched_tdcnt);
-}
#else
-int
sched_load(void)
+#endif
{
- return (sched_tdcnt);
+ return (V_sched_tdcnt);
}
-#endif
int
sched_sizeof_proc(void)
==== //depot/projects/vimage/src/sys/sys/vimage.h#41 (text+ko) ====
@@ -318,6 +318,7 @@
int vi_symlookup(struct kld_sym_lookup *, char *);
struct vimage *vnet2vimage(struct vnet *);
char *vnet_name(struct vnet *);
+int vi_child_of(struct vimage *, struct vimage *);
LIST_HEAD(vimage_list_head, vimage);
extern struct vimage_list_head vimage_head;
More information about the p4-projects
mailing list