diff options
author | Christoph Hellwig <hch@lst.de> | 2007-12-20 02:39:59 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-12-21 03:46:21 -0500 |
commit | c9101bdb1b0c56a75a4618542d368fe5013946b9 (patch) | |
tree | 93c131fd8239bf537e383c29c2eb90d7346e426f /arch/powerpc/platforms/cell/spufs/run.c | |
parent | 197b1a8263bf365d2ca8aba532352036ff95e04d (diff) |
[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) | |||
292 | u32 ls_pointer, npc; | 292 | u32 ls_pointer, npc; |
293 | void __iomem *ls; | 293 | void __iomem *ls; |
294 | long spu_ret; | 294 | long spu_ret; |
295 | int ret; | 295 | int ret, ret2; |
296 | 296 | ||
297 | /* get syscall block from local store */ | 297 | /* get syscall block from local store */ |
298 | npc = ctx->ops->npc_read(ctx) & ~3; | 298 | npc = ctx->ops->npc_read(ctx) & ~3; |
@@ -314,9 +314,11 @@ static int spu_process_callback(struct spu_context *ctx) | |||
314 | if (spu_ret <= -ERESTARTSYS) { | 314 | if (spu_ret <= -ERESTARTSYS) { |
315 | ret = spu_handle_restartsys(ctx, &spu_ret, &npc); | 315 | ret = spu_handle_restartsys(ctx, &spu_ret, &npc); |
316 | } | 316 | } |
317 | spu_acquire(ctx); | 317 | ret2 = spu_acquire(ctx); |
318 | if (ret == -ERESTARTSYS) | 318 | if (ret == -ERESTARTSYS) |
319 | return ret; | 319 | return ret; |
320 | if (ret2) | ||
321 | return -EINTR; | ||
320 | } | 322 | } |
321 | 323 | ||
322 | /* write result, jump over indirect pointer */ | 324 | /* write result, jump over indirect pointer */ |
@@ -338,7 +340,9 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event) | |||
338 | spu_enable_spu(ctx); | 340 | spu_enable_spu(ctx); |
339 | ctx->event_return = 0; | 341 | ctx->event_return = 0; |
340 | 342 | ||
341 | spu_acquire(ctx); | 343 | ret = spu_acquire(ctx); |
344 | if (ret) | ||
345 | goto out_unlock; | ||
342 | 346 | ||
343 | spu_update_sched_info(ctx); | 347 | spu_update_sched_info(ctx); |
344 | 348 | ||
@@ -414,6 +418,7 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event) | |||
414 | 418 | ||
415 | out: | 419 | out: |
416 | *event = ctx->event_return; | 420 | *event = ctx->event_return; |
421 | out_unlock: | ||
417 | mutex_unlock(&ctx->run_mutex); | 422 | mutex_unlock(&ctx->run_mutex); |
418 | return ret; | 423 | return ret; |
419 | } | 424 | } |