[Cbe-oss-dev] spu sched problems

Christoph Hellwig hch at lst.de
Wed Mar 7 02:30:13 EST 2007


On Tue, Mar 06, 2007 at 09:57:30PM +0900, Ishizaki Kou wrote:
> Hi,
> 
> We met two problems about spu scheduler when we tested
> atomic_op_sample in CellSDK 2.0.
> 
> We tested on a hardware that has only 7 spus. These problems occur
> when number of spu threads is greater than number of physical spus.
> 
> 
> Case #1 BUG: soft lockup detected
> 
> When spu_run syscall is executed and spu scheduler cannot find idle
> spu, the calling thread falls in busy loop in spu_activate() and
> it causes 'BUG: soft lockup detected'.

This should be fixed in Arnd's current tree.  The actual patch is
attached below.

-------------- next part --------------
Index: linux-2.6.20/arch/powerpc/platforms/cell/spufs/sched.c
===================================================================
--- linux-2.6.20.orig/arch/powerpc/platforms/cell/spufs/sched.c	2007-02-24 07:27:59.000000000 +0100
+++ linux-2.6.20/arch/powerpc/platforms/cell/spufs/sched.c	2007-02-24 07:34:49.000000000 +0100
@@ -429,7 +429,7 @@
 	if (ctx->spu)
 		return 0;
 
-	do {
+	for (;;) {
 		struct spu *spu;
 
 		spu = spu_get_idle(ctx);
@@ -445,12 +445,18 @@
 		}
 
 		spu_add_to_rq(ctx);
-		if (!(flags & SPU_ACTIVATE_NOWAKE))
+		if (!(flags & SPU_ACTIVATE_NOWAKE)) {
 			spu_prio_wait(ctx);
-		spu_del_from_rq(ctx);
-	} while (!signal_pending(current));
+			spu_del_from_rq(ctx);
+		}
+		
+		if (signal_pending(current)) {
+			if (flags & SPU_ACTIVATE_NOWAKE)
+				spu_del_from_rq(ctx);
+			return -ERESTARTSYS;
+		}
+	}
 
-	return -ERESTARTSYS;
 }
 
 /**


More information about the cbe-oss-dev mailing list