[POWERPC] spufs: make state_mutex interruptible
Make most places that use spu_acquire/spu_acquire_saved interruptible,
this allows getting out of the spufs code when e.g. pressing ctrl+c.
There are a few places where we get called e.g. from spufs teardown
routines were we can't simply err out so these are left with a comment.
For now I've also not touched the poll routines because it's open what
libspe would expect in terms of interrupted system calls.
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 2775c16..eee7cef 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -705,7 +705,9 @@
static void spu_schedule(struct spu *spu, struct spu_context *ctx)
{
- spu_acquire(ctx);
+ /* not a candidate for interruptible because it's called either
+ from the scheduler thread or from spu_deactivate */
+ mutex_lock(&ctx->state_mutex);
__spu_schedule(spu, ctx);
spu_release(ctx);
}
@@ -823,7 +825,9 @@
else {
spu_release(ctx);
spu_schedule(spu, new);
- spu_acquire(ctx);
+ /* this one can't easily be made
+ interruptible */
+ mutex_lock(&ctx->state_mutex);
}
}
}
@@ -867,7 +871,8 @@
struct spu *spu = NULL;
u32 status;
- spu_acquire(ctx);
+ if (spu_acquire(ctx))
+ BUG(); /* a kernel thread never has signals pending */
if (ctx->state != SPU_STATE_RUNNABLE)
goto out;