[Cbe-oss-dev] [PATCH 2/6] spufs: fix timing dependent false return from spufs_run_spu

Luke Browning lukebr at linux.vnet.ibm.com
Thu Feb 7 04:43:29 EST 2008


Eliminate timing dependent false return from spufs_run_spu().

Stop bits are only valid when the running bit is not set.  Status bits carry 
over from one invocation of spufs_run_spu() to another, so the RUNNING bit 
gets added to the previous state of the register which may have been a remote
library call.  In this case, it looks like another library routine should be
invoked, but the spe is actually running.  This solves a problem with a 
testcase that exercises the scheduler.

Signed-off-by: Luke Browning <lukebrowning at us.ibm.com>
---

Index: spufs/arch/powerpc/platforms/cell/spufs/run.c
===================================================================
--- spufs.orig/arch/powerpc/platforms/cell/spufs/run.c	2008-02-06 12:44:55.000000000 -0200
+++ spufs/arch/powerpc/platforms/cell/spufs/run.c	2008-02-06 12:46:01.000000000 -0200
@@ -53,7 +53,7 @@
 
 	stopped = SPU_STATUS_INVALID_INSTR | SPU_STATUS_SINGLE_STEP |
 		SPU_STATUS_STOPPED_BY_HALT | SPU_STATUS_STOPPED_BY_STOP;
-	if (*stat & stopped)
+	if ((*stat & stopped) && !(*stat & SPU_STATUS_RUNNING))
 		return 1;
 
 	dsisr = ctx->csa.dsisr;





More information about the cbe-oss-dev mailing list