[Cbe-oss-dev] [PATCH 3/6] spufs: fix starvation case with terminated spes

Jeremy Kerr jk at ozlabs.org
Thu Feb 7 17:59:23 EST 2008


Hi Luke,

> Fix spu starvation case with terminated ctxts.
>
> Terminated spe contexts need to yield the spu, so that the spufs
> scheduler can service the runqueue.  Can't rely on the libspe to
> destroy the context as it is not a trusted entity.  Fixes a testcase
> where a program creates 100 standalone contexts (ie. gang of one) and
> then waits for them to complete before it starts to destroy contexts.

Hm, good catch. However, I can still reproduce this bug with your patch, 
by doing 100 spu_create()s followed by 100 spu_run()s. Since libspe2 
isn't involved, the contexts aren't stopping with the 0x2000 stopcode 
(since we're just executing a zero-ed local store, the stop-code ends 
up being 0x0).

I've added a testcase to the spufs-testsuite:

  http://git.kernel.org/?p=linux/kernel/git/jk/spufs-testsuite.git

Is there a better way to detect the force case in spu_yield?

I've also made Christoph's suggested alterations, and unified into a 
single spu_yield() - I'm happy to implement any further updates to this 
patch.

Cheers,


Jeremy



More information about the cbe-oss-dev mailing list