[SSI] openssi/kernel/cluster/ssi/vproc dvp_pvpops.c, 1.41, 1.42 dvp_vpops.c, 1.41, 1.42 pproc_subr.c, 1.12, 1.13 rproc_cli_pproc.c, 1.23, 1.24 rproc_svr_pproc.c, 1.26, 1.27
Roger Tsang <[email protected]>
| Newsgroups | gmane.linux.cluster.ssic.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10005/kernel/cluster/ssi/vproc
Modified Files:
Tag: OPENSSI-FC
dvp_pvpops.c dvp_vpops.c pproc_subr.c rproc_cli_pproc.c
rproc_svr_pproc.c
Log Message:
MOSIX:
- Fix race over elements in mosix_task struct. Use task_lock() to protect mosix_task->dctime, pages_i_bring, etc.
- Code clean up: choose(), consider(), mosix_calc_load().
- Fix release_migrations() using wrong lock for mosix_task->load.
- Remove unused pagetime, migpages in struct mosix_task.
- run_over_dirty_pages() to hold down_read(&mmap_sem) to avoid possible race. (#ifdef SSI_BALANCE_MEMORY)
VPROC:
- Use BKL to protect tty_old_pgrp in VProc context. (#ifdef PPROC_SETCTTY_SIGLOCK)
Index: dvp_vpops.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_vpops.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- dvp_vpops.c 27 Oct 2009 03:18:29 -0000 1.41
+++ dvp_vpops.c 18 Nov 2009 06:16:53 -0000 1.42
@@ -681,7 +681,7 @@
if (ssi_roundrobin)
goto rr;
#endif
- consider(BALANCE, NULL, node);
+ consider(BALANCE, node);
#endif /* CONFIG_MOSIX_LL */
#ifdef CONFIG_SSI_RR_DEBUG
rr:
@@ -2036,7 +2036,12 @@
* if the process is a pgrp ldr, pass it on to the members.
*
*/
-/* Might be called with tty_sem held */
+/* Might be called with following locks in descending order:
+ * lock_kernel()
+ * OR
+ * lock_kernel()
+ * down(&tty_sem)
+ */
int
vpop_setctty(
struct vproc *v, /* vproc of process getting the ctty */
@@ -2607,7 +2612,7 @@
return error;
}
-/* Called with tty_sem held */
+/* Called under BKL */
struct tty_struct *
ssi_release_tty(dev_t cttydev, clusternode_t cttynode, int exit)
{
Index: rproc_cli_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_cli_pproc.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- rproc_cli_pproc.c 27 Oct 2009 03:18:30 -0000 1.23
+++ rproc_cli_pproc.c 18 Nov 2009 06:16:53 -0000 1.24
@@ -160,6 +160,9 @@
return -ENOMEM;
}
+#ifdef PPROC_SETCTTY_SIGLOCK
+ lock_kernel(); /* protect tty_old_pgrp */
+#endif
spin_lock_irqsave(&t->sighand->siglock, flags);
error |= load_rvp_sigpending(sp, rsp);
@@ -169,13 +172,20 @@
if (!error)
break;
spin_unlock_irqrestore(&t->sighand->siglock, flags);
+#ifdef PPROC_SETCTTY_SIGLOCK
+ unlock_kernel();
+#endif
sigpending_remove_msg(rsp);
rsp = &comm_datap->comm_signal.rvp_ss_shared_pending;
sigpending_remove_msg(rsp);
}
- } else
- spin_lock_irqsave(¤t->sighand->siglock, flags);
+ } else {
+#ifdef PPROC_SETCTTY_SIGLOCK
+ lock_kernel(); /* protect tty_old_pgrp */
+#endif
+ spin_lock_irqsave(&t->sighand->siglock, flags);
+ }
comm_datap->comm_signal.rvp_ss_flags = t->signal->flags;
comm_datap->comm_signal.rvp_ss_tty_old_pgrp = t->signal->tty_old_pgrp;
@@ -201,6 +211,9 @@
spin_unlock_irqrestore(&t->sighand->siglock, flags);
+#ifdef PPROC_SETCTTY_SIGLOCK
+ unlock_kernel();
+#endif
return 0;
}
@@ -654,13 +667,16 @@
t->node_context : this_node;
#ifdef CONFIG_MOSIX_LL
/* load leveling information */
+ /* SSI_XXX: skipped task_rq_lock for mosix.dflags */
+ task_lock(t);
comm_datap->comm_dflags = (t->mosix.dflags & ~DPAGEIN);
comm_datap->comm_stay = t->mosix.stay;
- comm_datap->comm_dctime = t->mosix.dctime;
- comm_datap->comm_pagetime = t->mosix.pagetime;
- comm_datap->comm_pages_i_bring = t->mosix.pages_i_bring;
+ /* comm_datap->comm_pagetime = t->mosix.pagetime; */
comm_datap->comm_last_consider = t->mosix.last_consider;
comm_datap->comm_last_mconsider = t->mosix.last_mconsider;
+ comm_datap->comm_pages_i_bring = t->mosix.pages_i_bring;
+ comm_datap->comm_dctime = t->mosix.dctime;
+ task_unlock(t);
#endif
out:
Index: rproc_svr_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_svr_pproc.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rproc_svr_pproc.c 27 Oct 2009 03:18:30 -0000 1.26
+++ rproc_svr_pproc.c 18 Nov 2009 06:16:53 -0000 1.27
@@ -117,6 +117,9 @@
return -ENOMEM;
}
locked = 1;
+#ifdef PPROC_SETCTTY_SIGLOCK
+ lock_kernel(); /* protect tty_old_pgrp */
+#endif
spin_lock_irqsave(&t->sighand->siglock, flags);
pp = &t->pending;
flush_sigqueue(pp);
@@ -133,6 +136,9 @@
}
t->signal->flags = rsigp->rvp_ss_flags;
t->signal->tty_old_pgrp = rsigp->rvp_ss_tty_old_pgrp;
+#ifdef PPROC_SETCTTY_SIGLOCK
+ unlock_kernel();
+#endif
t->signal->leader = rsigp->rvp_ss_leader;
t->signal->cttydev = rsigp->rvp_ss_cttydev;
t->signal->cttynode = rsigp->rvp_ss_cttynode;
@@ -517,13 +523,15 @@
t->node_context = comm_datap->comm_node_context;
#ifdef CONFIG_MOSIX_LL
+ task_lock(t);
t->mosix.dflags = comm_datap->comm_dflags;
t->mosix.stay = comm_datap->comm_stay;
- t->mosix.pagetime = comm_datap->comm_pagetime;
+ /* t->mosix.pagetime = comm_datap->comm_pagetime; */
t->mosix.last_consider = comm_datap->comm_last_consider;
t->mosix.last_mconsider = comm_datap->comm_last_mconsider;
t->mosix.pages_i_bring = comm_datap->comm_pages_i_bring;
t->mosix.dctime = comm_datap->comm_dctime;
+ task_unlock(t);
#endif
out:
return error;
Index: pproc_subr.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/pproc_subr.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pproc_subr.c 27 Oct 2009 03:18:30 -0000 1.12
+++ pproc_subr.c 18 Nov 2009 06:16:53 -0000 1.13
@@ -126,6 +126,8 @@
* tasklist_lock (pproc_setctty)
* task_lock (pproc_setctty)
*/
+#else
+ lock_kernel(); /* protect tty_old_pgrp. see disassociate_ctty() */
#endif
read_lock(&tasklist_lock);
if (p->signal) {
@@ -152,6 +154,9 @@
task_unlock(p);
}
read_unlock(&tasklist_lock);
+#ifdef PPROC_SETCTTY_SIGLOCK
+ unlock_kernel();
+#endif
return 0;
}
@@ -287,6 +292,7 @@
* This function is called when the controlling process exits.
* The process is already single threaded at this point.
*/
+/* Might be called under BKL */
int
pps_release_ctty(dev_t cttydev, int exit, pid_t *pgidp)
{
Index: dvp_pvpops.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/dvp_pvpops.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- dvp_pvpops.c 27 Oct 2009 03:18:29 -0000 1.41
+++ dvp_pvpops.c 18 Nov 2009 06:16:53 -0000 1.42
@@ -3368,20 +3368,11 @@
(flags & VCTTY_CLEARCTTY)) {
PVPOP_SIGPROC(v, SIGHUP, SIGCONT, 0, VSIG_INTERNAL, NULL);
#ifdef VPROC_HOLD_ZERO_GET_TASK
- if (PV_IS_ALIVE(pvp)) {
- task_t *p = pvp->pvp_pproc;
-#ifdef PPROC_SETCTTY_SIGLOCK
- task_lock(p); /* see pproc_setctty() */
-#endif
- p->signal->tty_old_pgrp = pgid;
-#ifdef PPROC_SETCTTY_SIGLOCK
- task_unlock(p);
-#endif
- }
+ if (PV_IS_ALIVE(pvp))
#else
if (PVP(v)->pvp_pproc != NULL)
- PVP(v)->pvp_pproc->signal->tty_old_pgrp = pgid;
#endif
+ PVP(v)->pvp_pproc->signal->tty_old_pgrp = pgid;
}
/*
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july