]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] spufs: fix invalid scheduling of forgotten contexts
authorJeremy Kerr <jk@ozlabs.org>
Wed, 27 Feb 2008 08:08:13 +0000 (19:08 +1100)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 27 Feb 2008 22:56:28 +0000 (09:56 +1100)
At present, we have a situation where a context with no owner is
re-scheduled by spu_forget:

Thread 1: reading regs file Thread 2: context owner

spu_forget()
- ctx->owner = NULL
- set SPU_SCHED_WAS_ACTIVE

spu_acquire_saved()
- context is in saved state

spu_release_saved()
- SPU_SCHED_WAS_ACTIVE is set,
  so spu_activate() the context,
  which now has no owner

In spu_forget(), we shouldn't be requesting a re-schedule by setting
SPU_SCHED_WAS_ACTIVE. This change removes the set_bit in spu_forget(),
so that spu_release_saved() doesn't reinsert this destroyed context on
to the run queue.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
arch/powerpc/platforms/cell/spufs/context.c

index 133995ed5cc78c104745534915ec3331f6601ed6..cf6c2c89211d2dc2fe308e50404370d3ae9af418 100644 (file)
@@ -109,13 +109,12 @@ void spu_forget(struct spu_context *ctx)
 
        /*
         * This is basically an open-coded spu_acquire_saved, except that
-        * we don't acquire the state mutex interruptible.
+        * we don't acquire the state mutex interruptible, and we don't
+        * want this context to be rescheduled on release.
         */
        mutex_lock(&ctx->state_mutex);
-       if (ctx->state != SPU_STATE_SAVED) {
-               set_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags);
+       if (ctx->state != SPU_STATE_SAVED)
                spu_deactivate(ctx);
-       }
 
        mm = ctx->owner;
        ctx->owner = NULL;