Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 81151
b: refs/heads/master
c: c9101bd
h: refs/heads/master
i:
  81149: d575e26
  81147: bcba801
  81143: 8854e5a
  81135: 0ea7016
  81119: ac6bb28
  81087: 6efb234
  81023: 8ca99a4
  80895: 8751fd4
v: v3
  • Loading branch information
Christoph Hellwig authored and Paul Mackerras committed Dec 21, 2007
1 parent 92a1891 commit 3ef13a0
Show file tree
Hide file tree
Showing 8 changed files with 220 additions and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 197b1a8263bf365d2ca8aba532352036ff95e04d
refs/heads/master: c9101bdb1b0c56a75a4618542d368fe5013946b9
23 changes: 20 additions & 3 deletions trunk/arch/powerpc/platforms/cell/spufs/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,17 @@ int put_spu_context(struct spu_context *ctx)
void spu_forget(struct spu_context *ctx)
{
struct mm_struct *mm;
spu_acquire_saved(ctx);

/*
* This is basically an open-coded spu_acquire_saved, except that
* we don't acquire the state mutex interruptible.
*/
mutex_lock(&ctx->state_mutex);
if (ctx->state != SPU_STATE_SAVED) {
set_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags);
spu_deactivate(ctx);
}

mm = ctx->owner;
ctx->owner = NULL;
mmput(mm);
Expand Down Expand Up @@ -137,13 +147,20 @@ void spu_unmap_mappings(struct spu_context *ctx)
* spu_acquire_saved - lock spu contex and make sure it is in saved state
* @ctx: spu contex to lock
*/
void spu_acquire_saved(struct spu_context *ctx)
int spu_acquire_saved(struct spu_context *ctx)
{
spu_acquire(ctx);
int ret;

ret = spu_acquire(ctx);
if (ret)
return ret;

if (ctx->state != SPU_STATE_SAVED) {
set_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags);
spu_deactivate(ctx);
}

return 0;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions trunk/arch/powerpc/platforms/cell/spufs/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ int spufs_coredump_extra_notes_size(void)

fd = 0;
while ((ctx = coredump_next_context(&fd)) != NULL) {
spu_acquire_saved(ctx);
rc = spu_acquire_saved(ctx);
if (rc)
break;
rc = spufs_ctx_note_size(ctx, fd);
spu_release_saved(ctx);
if (rc < 0)
Expand Down Expand Up @@ -224,7 +226,9 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)

fd = 0;
while ((ctx = coredump_next_context(&fd)) != NULL) {
spu_acquire_saved(ctx);
rc = spu_acquire_saved(ctx);
if (rc)
return rc;

for (j = 0; spufs_coredump_read[j].name != NULL; j++) {
rc = spufs_arch_write_note(ctx, j, file, fd, foffset);
Expand Down
12 changes: 10 additions & 2 deletions trunk/arch/powerpc/platforms/cell/spufs/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int spufs_handle_class1(struct spu_context *ctx)
u64 ea, dsisr, access;
unsigned long flags;
unsigned flt = 0;
int ret;
int ret, ret2;

/*
* dar and dsisr get passed from the registers
Expand Down Expand Up @@ -146,7 +146,14 @@ int spufs_handle_class1(struct spu_context *ctx)
if (ret)
ret = spu_handle_mm_fault(current->mm, ea, dsisr, &flt);

spu_acquire(ctx);
/*
* If spu_acquire fails due to a pending signal we just want to return
* EINTR to userspace even if that means missing the dma restart or
* updating the page fault statistics.
*/
ret2 = spu_acquire(ctx);
if (ret2)
goto out;

/*
* Clear dsisr under ctxt lock after handling the fault, so that
Expand Down Expand Up @@ -177,6 +184,7 @@ int spufs_handle_class1(struct spu_context *ctx)
} else
spufs_handle_event(ctx, ea, SPE_EVENT_SPE_DATA_STORAGE);

out:
spuctx_switch_state(ctx, SPU_UTIL_SYSTEM);
return ret;
}
Loading

0 comments on commit 3ef13a0

Please sign in to comment.