diff mbox

[17/18] powerpc/spufs: Reorder spu_gang_remove_ctx and spu_fini_csa operations

Message ID 200812101740.43108.adetsch@br.ibm.com
State RFC
Headers show

Commit Message

Andre Detsch Dec. 10, 2008, 7:40 p.m. UTC
It is not safe to destroy csa data before the context is removed from the
gang. In some rare situations, this could lead to the following problem
during context restore:

Unable to handle kernel paging request for data at address 0xd000000000000880
Faulting instruction address: 0xc00000000004935c
cpu 0x3: Vector: 300 (Data Access) at [c00000003ed1b670]
    pc: c00000000004935c: .spu_restore+0x7c/0x10dc
    lr: c000000000049320: .spu_restore+0x40/0x10dc
    sp: c00000003ed1b8f0
   msr: 9000000000009032
   dar: d000000000000880
 dsisr: 42000000
  current = 0xc00000003e183a30
  paca    = 0xc000000000853a80
    pid   = 2182, comm = affinity
enter ? for help
[c00000003ed1b9e0] c0000000000451dc .__spu_schedule+0x374/0x428
[c00000003ed1baa0] c000000000045db8 .spu_activate+0x43c/0x5d8
[c00000003ed1bbc0] c000000000047a6c .spufs_run_spu+0x510/0xb0c
[c00000003ed1bcc0] c000000000042f9c .do_spu_run+0xb0/0x17c
[c00000003ed1bd80] c00000000003bfdc .sys_spu_run+0x80/0xc8
[c00000003ed1be30] c0000000000076b4 syscall_exit+0x0/0x40
---
 arch/powerpc/platforms/cell/spufs/context.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index ef81894..a83c3bd 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -130,8 +130,8 @@  void destroy_spu_context(struct kref *kref)
 
 	spu_context_nospu_trace(destroy_spu_context__enter, ctx);
 
-	spu_fini_csa(&ctx->csa);
 	spu_gang_remove_ctx(ctx->gang, ctx);
+	spu_fini_csa(&ctx->csa);
 	if (ctx->prof_priv_kref)
 		kref_put(ctx->prof_priv_kref, ctx->prof_priv_release);
 	atomic_dec(&nr_spu_contexts);