[Cbe-oss-dev] [RFC, PATCH 1/2] powerpc/spufs: allow spu_acquire_saved to correctly handle NOSCHED contexts

Arnd Bergmann arnd at arndb.de
Sat Aug 2 22:53:15 EST 2008


On Saturday 02 August 2008, Jeremy Kerr wrote:
> Gi Arnd,
> 
> > What kind of benefit do you see from your patch, other than saving a
> > few lines of source code with the second patch?
> 
> libspe cannot use NOSCHED contexts at the moment, as it has no way to 
> set up the registers (for the inital stack frame). Allowing access to 
> the regs file at appropriate times is the main goal here.

In older versions of libspe, the initial registers were just set up
by the SPU itself, loaded from local store memory. Changing this has
somewhat simplified the startup in libspe2 but also caused performance
problems with multiple calls to spe_program_load(), which now always
needs to do a context save and restore.

If we can change libspe2 back to set up the parameter registers from
a trampoline on the stack, we would solve both problems. This would
also lift the restriction of the libspe2 NOSCHED feature to work
only on patched kernels.

> > We have users relying on the phys-id of the context not to change and
> > that can not accept the latencies of a context save/restore when
> > accessing the context.
> 
> OK, I think the expectation that we never *switch* a NOSCHED context 
> (rather than just never *scheduling* one out) is reasonable, so how 
> about something like:
> 
> 	/* if a context is running, we don't want to deschedule it */
> 	if ((ctx->flags & SPU_CREATE_NOSCHED) &&
> 			(ctx->state != SPU_STATE_SAVED) {
> 		spu_release(ctx);
> 		return -EBUSY;
> 	}
> 
> This will allow libspe to access the registers before the context is 
> loaded, but will never result in an unschedule.

Right, this is much better than the first one, I still find it rather
inconsistent and it means that we require a modern kernel for libspe2.

	Arnd <><



More information about the cbe-oss-dev mailing list