aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Detsch <adetsch@br.ibm.com>2008-09-04 17:16:27 -0400
committerJeremy Kerr <jk@ozlabs.org>2008-09-07 19:44:43 -0400
commitb2e601d14deb2083e2a537b47869ab3895d23a28 (patch)
tree302034680d5c7217c28d3b7dff025bd73eeee8c4
parentb65fe0356b5b732d7e1e0224c6a1cf2eb5255984 (diff)
powerpc/spufs: Fix possible scheduling of a context to multiple SPEs
We currently have a race when scheduling a context to a SPE - after we have found a runnable context in spusched_tick, the same context may have been scheduled by spu_activate(). This may result in a panic if we try to unschedule a context that has been freed in the meantime. This change exits spu_schedule() if the context has already been scheduled, so we don't end up scheduling it twice. Signed-off-by: Andre Detsch <adetsch@br.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 897c74061168..67595bc380dc 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -728,7 +728,8 @@ static void spu_schedule(struct spu *spu, struct spu_context *ctx)
728 /* not a candidate for interruptible because it's called either 728 /* not a candidate for interruptible because it's called either
729 from the scheduler thread or from spu_deactivate */ 729 from the scheduler thread or from spu_deactivate */
730 mutex_lock(&ctx->state_mutex); 730 mutex_lock(&ctx->state_mutex);
731 __spu_schedule(spu, ctx); 731 if (ctx->state == SPU_STATE_SAVED)
732 __spu_schedule(spu, ctx);
732 spu_release(ctx); 733 spu_release(ctx);
733} 734}
734 735