diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-02-27 03:08:13 -0500 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-02-27 17:56:28 -0500 |
commit | 0111a701867a796a7ca6ecbc385e4befc9f35066 (patch) | |
tree | 941a3737fa3a0ee56fbdfc164a6a2f4411d08d6f | |
parent | d58831375d68a3bd39d5ebab9eca711fbb4ee108 (diff) |
[POWERPC] spufs: fix invalid scheduling of forgotten contexts
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>
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/context.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c index 133995ed5cc7..cf6c2c89211d 100644 --- a/arch/powerpc/platforms/cell/spufs/context.c +++ b/arch/powerpc/platforms/cell/spufs/context.c | |||
@@ -109,13 +109,12 @@ void spu_forget(struct spu_context *ctx) | |||
109 | 109 | ||
110 | /* | 110 | /* |
111 | * This is basically an open-coded spu_acquire_saved, except that | 111 | * This is basically an open-coded spu_acquire_saved, except that |
112 | * we don't acquire the state mutex interruptible. | 112 | * we don't acquire the state mutex interruptible, and we don't |
113 | * want this context to be rescheduled on release. | ||
113 | */ | 114 | */ |
114 | mutex_lock(&ctx->state_mutex); | 115 | mutex_lock(&ctx->state_mutex); |
115 | if (ctx->state != SPU_STATE_SAVED) { | 116 | if (ctx->state != SPU_STATE_SAVED) |
116 | set_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags); | ||
117 | spu_deactivate(ctx); | 117 | spu_deactivate(ctx); |
118 | } | ||
119 | 118 | ||
120 | mm = ctx->owner; | 119 | mm = ctx->owner; |
121 | ctx->owner = NULL; | 120 | ctx->owner = NULL; |