[Cbe-oss-dev] (no subject)

adetsch at br.ibm.com adetsch at br.ibm.com
Thu Dec 11 06:03:12 EST 2008


>From 8b8f035270a13b6802ed1196eecf980b07c1e3ae Mon Sep 17 00:00:00 2001
In-Reply-To: <200812101654.05091.adetsch at br.ibm.com>
References: <200812101654.05091.adetsch at br.ibm.com>
From: Andre Detsch <adetsch at br.ibm.com>
Date: Wed, 10 Dec 2008 16:03:12 -0300
Subject: [PATCH 07/18] powerpc/spufs: Allow gang to grow in size after it has been started
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200812101703.13053.adetsch at br.ibm.com>

Just deactivate it, add the new context, and let the calling thread
drives its reactivation.  It needs to be unscheduled, since it may
no longer fit or it may need to be migrated to a different node.

Signed-off-by: Luke Browning <lukebrowning at us.ibm.com>
Signed-off-by: Andre Detsch <adetsch at br.ibm.com>
---
 arch/powerpc/platforms/cell/spufs/context.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/context.c 
b/arch/powerpc/platforms/cell/spufs/context.c
index b810050..d3887fe 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -57,6 +57,17 @@ struct spu_context *alloc_spu_context(struct spu_gang 
*gang)
 	if (spu_init_csa(&ctx->csa))
 		goto out_free_gang;
 
+	/* If the gang is running, it needs to be stopped, since we have a
+	 * new context that needs to be gang scheduled.  Gangs are allowed
+	 * to grow and shrink over time, but they are unscheduled when it
+	 * happens as the gang may need to migrated to a different node.
+	 */
+	if (atomic_read(&gang->nstarted)) {
+		mutex_lock(&gang->mutex);
+		spu_deactivate(gang);
+		mutex_unlock(&gang->mutex);
+	}
+
 	spin_lock_init(&ctx->mmio_lock);
 	mutex_init(&ctx->mapping_lock);
 	kref_init(&ctx->kref);
-- 
1.5.4.3




More information about the cbe-oss-dev mailing list