Skip to content

Commit

Permalink
[POWERPC] spufs: update master runcntl with context lock held
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeremy Kerr committed May 5, 2008
1 parent 55d7cd7 commit c0bace5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/powerpc/platforms/cell/spufs/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c0bace5

Please sign in to comment.