summary refs log tree commit diff
path: root/arch/powerpc
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-04-23 14:24:27 +1000
committerJeremy Kerr <jk@ozlabs.org>2008-05-05 13:33:43 +1000
commitc0bace5c7029ef7cbb6e6ffaa0469a3c042e5029 (patch)
tree0c8183cd4dbcea455c9d4adf61a947c79696b9b3 /arch/powerpc
parent55d7cd74d44e7e0597f95db25c12f3e6c5e7916f (diff)
downloadlinux-c0bace5c7029ef7cbb6e6ffaa0469a3c042e5029.tar.gz
[POWERPC] spufs: update master runcntl with context lock held
Currently, we update the SPU master run control bit (ie,
spu_enable_spu) in spufs_run_spu before we grab the context mutex. This
can result in races with other processes accessing this context's
resources.

This change moves the spu_enable_spu to after we have acquired the
context lock.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index a9c35b7b719f..0634fecfe54c 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -343,13 +343,14 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event)
 	if (mutex_lock_interruptible(&ctx->run_mutex))
 		return -ERESTARTSYS;
 
-	spu_enable_spu(ctx);
 	ctx->event_return = 0;
 
 	ret = spu_acquire(ctx);
 	if (ret)
 		goto out_unlock;
 
+	spu_enable_spu(ctx);
+
 	spu_update_sched_info(ctx);
 
 	ret = spu_run_init(ctx, npc);