[Cbe-oss-dev] [PATCH 2/6] spufs: fix timing dependent falsereturn from spufs_run_spu
Masato Noguchi
Masato.Noguchi at jp.sony.com
Thu Feb 7 12:43:10 EST 2008
Hi Luke,
> 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.
I feel the attached patch I send the other day works for it.
Is this problem still there?
---
>From: Masato Noguchi [mailto:Masato.Noguchi at jp.sony.com]
Sent: Monday, February 04, 2008 11:29 AM
To: jk at ozlabs.org; cbe-oss-dev at ozlabs.org
Subject: Update SPU_Status[CISHP] bits together with R bit when spu_backing_runcntl_write is called
This patch changes spu_backing_runcntl_write to emulate real
SPU_Status register exactly. When the SPU Run Control register
is written with SPU_RunCntl[Run] set to '1' and the SPU become
running state, the physical SPU automatically set SPU_Status[R]
bit to '1' and SPU_Status[CISHP] bits to '0'.
Without this patch, the kernel may fail to restart a spe context
which is stopped once and swapped out.
Signed-off-by: Masato Noguchi <Masato.Noguchi at jp.sony.com>
---
arch/powerpc/platforms/cell/spufs/backing_ops.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: linux-2.6/arch/powerpc/platforms/cell/spufs/backing_ops.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/backing_ops.c
+++ linux-2.6/arch/powerpc/platforms/cell/spufs/backing_ops.c
@@ -288,6 +288,12 @@ static void spu_backing_runcntl_write(st
spin_lock(&ctx->csa.register_lock);
ctx->csa.prob.spu_runcntl_RW = val;
if (val & SPU_RUNCNTL_RUNNABLE) {
+ ctx->csa.prob.spu_status_R &=
+ ~SPU_STATUS_STOPPED_BY_STOP &
+ ~SPU_STATUS_STOPPED_BY_HALT &
+ ~SPU_STATUS_SINGLE_STEP &
+ ~SPU_STATUS_INVALID_INSTR &
+ ~SPU_STATUS_INVALID_CH;
ctx->csa.prob.spu_status_R |= SPU_STATUS_RUNNING;
} else {
ctx->csa.prob.spu_status_R &= ~SPU_STATUS_RUNNING;
More information about the cbe-oss-dev
mailing list