From patchwork Wed Dec 10 19:40:53 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Detsch X-Patchwork-Id: 13322 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id B88EEDDFB5 for ; Thu, 11 Dec 2008 06:48:29 +1100 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from igw1.br.ibm.com (igw1.br.ibm.com [32.104.18.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D8C4ADDF7B for ; Thu, 11 Dec 2008 06:41:14 +1100 (EST) Received: from d24relay01.br.ibm.com (unknown [9.8.31.16]) by igw1.br.ibm.com (Postfix) with ESMTP id 6193332C024 for ; Wed, 10 Dec 2008 17:37:01 -0200 (BRDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mBAKeaQL3764420 for ; Wed, 10 Dec 2008 17:40:36 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mBAJf1A6018204 for ; Wed, 10 Dec 2008 17:41:01 -0200 Received: from [9.8.13.23] ([9.8.13.23]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id mBAJegsh017084 for ; Wed, 10 Dec 2008 17:40:59 -0200 From: Andre Detsch To: cbe-oss-dev@ozlabs.org Date: Wed, 10 Dec 2008 17:40:53 -0200 User-Agent: KMail/1.9.6 References: <200812101719.42964.adetsch@br.ibm.com> In-Reply-To: <200812101719.42964.adetsch@br.ibm.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200812101740.53135.adetsch@br.ibm.com> Subject: [Cbe-oss-dev] [PATCH 07/18] powerpc/spufs: Allow gang to grow in size after it has been started X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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 Signed-off-by: Andre Detsch --- 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);