[Cbe-oss-dev] [PATCH] cell: Remove SPU_CONTEXT_SWITCH_ACTIVE flag

Andre Detsch adetsch at br.ibm.com
Wed Feb 20 00:06:15 EST 2008


From: Andre Detsch <adetsch at br.ibm.com>
Subject: cell: Remove SPU_CONTEXT_SWITCH_ACTIVE flag

The SPU_CONTEXT_SWITCH_ACTIVE flag was only being used on two
sanity checks, which were based on the assumption that
__spu_trap_data_seg and __spu_trap_data_map are not called
during the whole save/restore process. That's not true, and
false errors were being reported when running some applications.

Signed-off-by: Andre Detsch <adetsch at br.ibm.com>

Index: linux-2.6.25-rc1/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6.25-rc1.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6.25-rc1/arch/powerpc/platforms/cell/spu_base.c
@@ -160,13 +160,6 @@ static int __spu_trap_data_seg(struct sp

 	pr_debug("%s\n", __FUNCTION__);

-	if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) {
-		/* SLBs are pre-loaded for context switch, so
-		 * we should never get here!
-		 */
-		printk("%s: invalid access during switch!\n", __func__);
-		return 1;
-	}
 	slb.esid = (ea & ESID_MASK) | SLB_ESID_V;

 	switch(REGION_ID(ea)) {
@@ -226,11 +219,6 @@ static int __spu_trap_data_map(struct sp
 		return 0;
 	}

-	if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) {
-		printk("%s: invalid access during switch!\n", __func__);
-		return 1;
-	}
-
 	spu->class_0_pending = 0;
 	spu->dar = ea;
 	spu->dsisr = dsisr;
Index: linux-2.6.25-rc1/arch/powerpc/platforms/cell/spufs/switch.c
===================================================================
--- linux-2.6.25-rc1.orig/arch/powerpc/platforms/cell/spufs/switch.c
+++ linux-2.6.25-rc1/arch/powerpc/platforms/cell/spufs/switch.c
@@ -720,8 +720,9 @@ static inline void set_switch_active(str
 	 * Restore, Step 23.
 	 *     Change the software context switch pending flag
 	 *     to context switch active.
+	 *
+	 *     This implementation does not uses a switch active flag.
 	 */
-	set_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
 	clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags);
 	mb();
 }
@@ -1739,9 +1740,8 @@ static inline void reset_switch_active(s
 {
 	/* Restore, Step 74:
 	 *     Reset the "context switch active" flag.
+	 *     Not performed by this implementation.
 	 */
-	clear_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
-	mb();
 }

 static inline void reenable_interrupts(struct spu_state *csa, struct spu *spu)
Index: linux-2.6.25-rc1/include/asm-powerpc/spu.h
===================================================================
--- linux-2.6.25-rc1.orig/include/asm-powerpc/spu.h
+++ linux-2.6.25-rc1/include/asm-powerpc/spu.h
@@ -98,9 +98,8 @@
 #define MFC_PRIV_ATTN_EVENT                 0x00000800
 #define MFC_MULTI_SRC_EVENT                 0x00001000

-/* Flags indicating progress during context switch. */
+/* Flag indicating progress during context switch. */
 #define SPU_CONTEXT_SWITCH_PENDING	0UL
-#define SPU_CONTEXT_SWITCH_ACTIVE	1UL

 struct spu_context;
 struct spu_runqueue;



More information about the cbe-oss-dev mailing list