]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] spufs: update master runcntl with context lock held
authorJeremy Kerr <jk@ozlabs.org>
Wed, 23 Apr 2008 04:24:27 +0000 (14:24 +1000)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 5 May 2008 03:33:43 +0000 (13:33 +1000)
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>
arch/powerpc/platforms/cell/spufs/run.c

index a9c35b7b719fda3bd3850dc1dfdaa74d2e5acc6b..0634fecfe54c756df25e2f08c5c40b3f38d75bc7 100644 (file)
@@ -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);