[Cbe-oss-dev] Sanity check with using spu_stop

D. Herrendoerfer d.herrendoerfer at herrendoerfer.name
Tue Sep 22 01:25:31 EST 2009


Hi Phil,

starting and stopping a SPU like that is fine, but you need to
keep an eye on some constraints:

1. The start address of the program needs to be reset every time
   you start the SPU program if you want to start it from the beginning.
   If you just call spe_context_run again the program continues where
   it was stopped.

2. Some return values from si_stop or spu_stop have a meaning to
   libspe, they are used for stop-and-signal callbacks in newlib
   for example. If you use those your program will probably run into
   problems because the npc is set to skip over some signaling data
   depending on the code.

3. Using return codes between 1 and 0x1999 is ok, and should make
   spe_context_run return the proper value.

Regards,

Dirk

On Sep 11, 2009, at 11:28 PM, Philip Pratt-Szeliga wrote:

> Hello,
>
> I am the original poster of this problem on the IBM website:
> http://lists.ozlabs.org/pipermail/cbe-oss-dev/2008-June/004864.html
>
> I had an example where I ran spu_stop in a tight loop and I had events
> enabled on my context.  This would cause a pipe to fill
> up, (I think).  A fix is to disable events on a context.
>
> I am back to using spu_stop again on another project and I re-read the
> mailing list.  This time I want to have callbacks
> enabled for some things and use spu_stop for other things.  I have
> gathered that if I do something like the following it should work:
>
> do {
>
>  retval = spe_context_run(context_info->context,
> &(context_info->entry_point), 0, &transfer_work_item_info, NULL,
> &stopinfo);
>  /* consume the stop info so we don't get the spu_stop in loop  
> problem */
>  spe_stop_info_read(context_info->context, &stopinfo);
>
>  if(retval == 0x10) /* spu_stop(0x10) is sent from the spe when the
> loop is done */
>    break;
> } while (retval > 0); /* Run until exit or error */
>
>
> I made a small example that works, but when I integrate into my large
> example I get retvals other that 0x10.  I only send spu_stop(0x10)
> from the SPU (I am _very_ sure) and I have a main in the SPU that has
> a while(true) and never returns.
>
> Does anyone know how I could get retvals to be: 0, 2753 or 2817?
>
> I have looked through the spufs kernel code and the libspe2 code and I
> have ensured that the 0 is not a successful exit but actually an
> spu stop and signal. (Later I found that this could be checked with  
> stopinfo).
>
> If there is something wrong with the internals and I can figure out
> what it is, I am ready to make a patch.  I have the programming
> skills to do so and the funding and time.  (I am a phd student and the
> future direction of my research depends on getting this to work).
>
> Thanks for any help
> Phil Pratt-Szeliga
> Syracuse University, USA
> _______________________________________________
> cbe-oss-dev mailing list
> cbe-oss-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/cbe-oss-dev



More information about the cbe-oss-dev mailing list