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

Jeremy Kerr jk at ozlabs.org
Fri Aug 1 14:40:22 EST 2008


Currently, we don't want to call spu_acquire_saved on NOSCHED contexts,
as these contexts can't be spu_deactivated arbitrarily.

This change adds support for NOSCHED contexts in spu_acquire_saved - we
can call this on NOSCHED contexts, as long as the context is already
saved, or not being run.

Signed-off-by: Jeremy Kerr <jk at ozlabs.org>

---
 arch/powerpc/platforms/cell/spufs/context.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 6653ddb..4195476 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -158,6 +158,14 @@ int spu_acquire_saved(struct spu_context *ctx)
 	if (ret)
 		return ret;
 
+	/* if a context is running, we don't want to deschedule it */
+	if ((ctx->flags & SPU_CREATE_NOSCHED) &&
+			(ctx->state != SPU_STATE_SAVED) &&
+			test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags)) {
+		spu_release(ctx);
+		return -EBUSY;
+	}
+
 	if (ctx->state != SPU_STATE_SAVED) {
 		set_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags);
 		spu_deactivate(ctx);



More information about the cbe-oss-dev mailing list