diff options
author | Christoph Hellwig <hch@lst.de> | 2007-12-20 10:39:59 +0300 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-12-21 11:46:21 +0300 |
commit | c9101bdb1b0c56a75a4618542d368fe5013946b9 (patch) | |
tree | 93c131fd8239bf537e383c29c2eb90d7346e426f /arch/powerpc/platforms/cell/spufs/run.c | |
parent | 197b1a8263bf365d2ca8aba532352036ff95e04d (diff) | |
download | linux-c9101bdb1b0c56a75a4618542d368fe5013946b9.tar.xz |
[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>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs/run.c')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/run.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index b380050cdbc7..c01a09da1e56 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c @@ -292,7 +292,7 @@ static int spu_process_callback(struct spu_context *ctx) u32 ls_pointer, npc; void __iomem *ls; long spu_ret; - int ret; + int ret, ret2; /* get syscall block from local store */ npc = ctx->ops->npc_read(ctx) & ~3; @@ -314,9 +314,11 @@ static int spu_process_callback(struct spu_context *ctx) if (spu_ret <= -ERESTARTSYS) { ret = spu_handle_restartsys(ctx, &spu_ret, &npc); } - spu_acquire(ctx); + ret2 = spu_acquire(ctx); if (ret == -ERESTARTSYS) return ret; + if (ret2) + return -EINTR; } /* write result, jump over indirect pointer */ @@ -338,7 +340,9 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event) spu_enable_spu(ctx); ctx->event_return = 0; - spu_acquire(ctx); + ret = spu_acquire(ctx); + if (ret) + goto out_unlock; spu_update_sched_info(ctx); @@ -414,6 +418,7 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event) out: *event = ctx->event_return; +out_unlock: mutex_unlock(&ctx->run_mutex); return ret; } |