diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-04-23 00:24:27 -0400 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-05-04 23:33:43 -0400 |
commit | c0bace5c7029ef7cbb6e6ffaa0469a3c042e5029 (patch) | |
tree | 0c8183cd4dbcea455c9d4adf61a947c79696b9b3 /arch/powerpc | |
parent | 55d7cd74d44e7e0597f95db25c12f3e6c5e7916f (diff) |
[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.c | 3 |
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) | |||
343 | if (mutex_lock_interruptible(&ctx->run_mutex)) | 343 | if (mutex_lock_interruptible(&ctx->run_mutex)) |
344 | return -ERESTARTSYS; | 344 | return -ERESTARTSYS; |
345 | 345 | ||
346 | spu_enable_spu(ctx); | ||
347 | ctx->event_return = 0; | 346 | ctx->event_return = 0; |
348 | 347 | ||
349 | ret = spu_acquire(ctx); | 348 | ret = spu_acquire(ctx); |
350 | if (ret) | 349 | if (ret) |
351 | goto out_unlock; | 350 | goto out_unlock; |
352 | 351 | ||
352 | spu_enable_spu(ctx); | ||
353 | |||
353 | spu_update_sched_info(ctx); | 354 | spu_update_sched_info(ctx); |
354 | 355 | ||
355 | ret = spu_run_init(ctx, npc); | 356 | ret = spu_run_init(ctx, npc); |