[Cbe-oss-dev] Lifetime of SPE contexts & gangs

Jeremy Kerr jk at ozlabs.org
Wed May 9 14:45:56 EST 2007


Hi all,

I'm in the process of sorting out the issues we have with SPE gangs and 
contexts in spufs at the moment. For those that haven't come across 
this, if a process destroy a gang (ie, close its file descriptor) 
before destroying the gang's contexts, we hit a bug, mostly because we 
haven't set any explicit behaviour for this condition.

So, there are a couple of possible approaches to correct this:

* Each context within a gang holds a reference to the gang via the 
gang's refcount, and closing the gang fd decreases it. So, if you close 
the gang fd, the gang dir only gets removed when the last context is 
destroyed.

* Closing a gang causes the gang's contexts to be destroyed at the same 
time, regardless of whether the process holds an open file descriptor 
to any of the contexts.

* Destroying the gang causes its contexts to be reparented to the root 
of the spu filesystem. Libspe might get a little confused by this 
though..

I think the first may be the correct way to go, but it may be a little 
strange for users to see contexts that they have 'destroyed'. Anyone 
have particular opinions on this?

Cheers,


Jeremy



More information about the cbe-oss-dev mailing list