[Cbe-oss-dev] PATCH [5/7] fix spu utilization

Luke Browning lukebr at linux.vnet.ibm.com
Thu Nov 1 11:07:21 EST 2007


Fix spu utilization.  Transitions must be made with the spu attached.
Add spuctx_switch_state transtions for ctxts that are queued.

Signed-off-by: Luke Browning <lukebr at linux.vnet.ibm.com>

---

Index: linux-2.6.22/arch/powerpc/platforms/cell/spufs/sched.c
===================================================================
--- linux-2.6.22.orig/arch/powerpc/platforms/cell/spufs/sched.c
+++ linux-2.6.22/arch/powerpc/platforms/cell/spufs/sched.c
@@ -746,7 +746,13 @@ spu_activate_top:
 	if (!spu && rt_prio(ctx->prio))
 		spu = find_victim(ctx);
 	if (spu) {
+		ulong runcntl;
+
+		runcntl = ctx->ops->runcntl_read(ctx);
 		__spu_schedule(spu, ctx);
+		if (runcntl & SPU_RUNCNTL_RUNNABLE)
+			spuctx_switch_state(ctx, SPUCTX_UTIL_USER);
+
 		return 0;
 	}
 
Index: linux-2.6.22/arch/powerpc/platforms/cell/spufs/run.c
===================================================================
--- linux-2.6.22.orig/arch/powerpc/platforms/cell/spufs/run.c
+++ linux-2.6.22/arch/powerpc/platforms/cell/spufs/run.c
@@ -205,13 +205,14 @@ static int spu_run_init(struct spu_conte
 
 		ctx->ops->npc_write(ctx, *npc);
 		ctx->ops->privcntl_write(ctx, privcntl);
-		spuctx_switch_state(ctx, SPUCTX_UTIL_USER);
 		ctx->ops->runcntl_write(ctx, runcntl);
 
 		if (ctx->state == SPU_STATE_SAVED) {
 			ret = spu_activate(ctx, 0);
 			if (ret)
 				return ret;
+		} else {
+			spuctx_switch_state(ctx, SPUCTX_UTIL_USER);
 		}
 	}
 





More information about the cbe-oss-dev mailing list