Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/250/?format=api
{ "id": 250, "url": "http://patchwork.ozlabs.org/api/patches/250/?format=api", "web_url": "http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/200809112037.46439.adetsch@br.ibm.com/", "project": { "id": 1, "url": "http://patchwork.ozlabs.org/api/projects/1/?format=api", "name": "Cell Broadband Engine development", "link_name": "cbe-oss-dev", "list_id": "cbe-oss-dev.ozlabs.org", "list_email": "cbe-oss-dev@ozlabs.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<200809112037.46439.adetsch@br.ibm.com>", "list_archive_url": null, "date": "2008-09-11T23:37:46", "name": "powerpc/spufs: Add gang structure for standalone ctxts", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "51d9b2c1bcbe234a092cb35110c3077a6c76b1b7", "submitter": { "id": 93, "url": "http://patchwork.ozlabs.org/api/people/93/?format=api", "name": "Andre Detsch", "email": "adetsch@br.ibm.com" }, "delegate": { "id": 1, "url": "http://patchwork.ozlabs.org/api/users/1/?format=api", "username": "jk", "first_name": "Jeremy", "last_name": "Kerr", "email": "jk@ozlabs.org" }, "mbox": "http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/200809112037.46439.adetsch@br.ibm.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/250/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/250/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org>", "X-Original-To": [ "patchwork@ozlabs.org", "cbe-oss-dev@ozlabs.org" ], "Delivered-To": [ "patchwork@ozlabs.org", "cbe-oss-dev@ozlabs.org" ], "Received": [ "from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id 31E96DE073\n\tfor <patchwork@ozlabs.org>; Fri, 12 Sep 2008 09:39:32 +1000 (EST)", "from igw1.br.ibm.com (igw1.br.ibm.com [32.104.18.24])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client did not present a certificate)\n\tby ozlabs.org (Postfix) with ESMTPS id E1EBFDDFED;\n\tFri, 12 Sep 2008 09:38:40 +1000 (EST)", "from mailhub1.br.ibm.com (mailhub1 [9.18.232.109])\n\tby igw1.br.ibm.com (Postfix) with ESMTP id 132F832C139;\n\tThu, 11 Sep 2008 20:08:03 -0300 (BRT)", "from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47])\n\tby mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id\n\tm8BNcYCn1614134; Thu, 11 Sep 2008 20:38:39 -0300", "from d24av02.br.ibm.com (loopback [127.0.0.1])\n\tby d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id\n\tm8BNcRjp029481; Thu, 11 Sep 2008 20:38:27 -0300", "from [9.8.10.86] ([9.8.10.86])\n\tby d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id\n\tm8BNcRRw029478; Thu, 11 Sep 2008 20:38:27 -0300" ], "From": "Andre Detsch <adetsch@br.ibm.com>", "To": "cbe-oss-dev@ozlabs.org", "Date": "Thu, 11 Sep 2008 20:37:46 -0300", "User-Agent": "KMail/1.9.6", "References": "<200809111955.28780.adetsch@br.ibm.com>", "In-Reply-To": "<200809111955.28780.adetsch@br.ibm.com>", "MIME-Version": "1.0", "Content-Disposition": "inline", "Message-Id": "<200809112037.46439.adetsch@br.ibm.com>", "Cc": "LukeBrowning@us.ibm.com, Jeremy Kerr <jk@ozlabs.org>", "Subject": "[Cbe-oss-dev] [PATCH 02/11] powerpc/spufs: Add gang structure for\n\tstandalone ctxts", "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\n\t<cbe-oss-dev.ozlabs.org>", "List-Unsubscribe": "<https://ozlabs.org/mailman/options/cbe-oss-dev>,\n\t<mailto:cbe-oss-dev-request@ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://ozlabs.org/pipermail/cbe-oss-dev>", "List-Post": "<mailto:cbe-oss-dev@ozlabs.org>", "List-Help": "<mailto:cbe-oss-dev-request@ozlabs.org?subject=help>", "List-Subscribe": "<https://ozlabs.org/mailman/listinfo/cbe-oss-dev>,\n\t<mailto:cbe-oss-dev-request@ozlabs.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org", "Errors-To": "cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org" }, "content": "All contexts should have a gang structure to provide a common\ndata abstraction for scheduling. Standalone gangs are just gangs\nof one.\n\nSigned-off-by: Luke Browning <lukebrowning@us.ibm.com>\nSigned-off-by: Andre Detsch <adetsch@br.ibm.com>", "diff": "diff --git a/arch/powerpc/platforms/cell/spufs/context.c \nb/arch/powerpc/platforms/cell/spufs/context.c\nindex 6653ddb..ace2273 100644\n--- a/arch/powerpc/platforms/cell/spufs/context.c\n+++ b/arch/powerpc/platforms/cell/spufs/context.c\n@@ -35,14 +35,28 @@ atomic_t nr_spu_contexts = ATOMIC_INIT(0);\n struct spu_context *alloc_spu_context(struct spu_gang *gang)\n {\n \tstruct spu_context *ctx;\n+\n \tctx = kzalloc(sizeof *ctx, GFP_KERNEL);\n \tif (!ctx)\n \t\tgoto out;\n+\n+\t/* Allocate an anonymous gang if the caller did not explicitly\n+\t * create one so that a common data abstraction exists for\n+\t * the scheduler. Gangs are queued to the runqueue. In this case,\n+\t * the gang is a gang of one.\n+\t */\n+\tif (!gang) {\n+\t\tgang = alloc_spu_gang();\n+\t\tif (!gang)\n+\t\t\tgoto out_free;\n+\t}\n+\n \t/* Binding to physical processor deferred\n \t * until spu_activate().\n \t */\n \tif (spu_init_csa(&ctx->csa))\n-\t\tgoto out_free;\n+\t\tgoto out_free_gang;\n+\n \tspin_lock_init(&ctx->mmio_lock);\n \tmutex_init(&ctx->mapping_lock);\n \tkref_init(&ctx->kref);\n@@ -58,15 +72,16 @@ struct spu_context *alloc_spu_context(struct spu_gang \n*gang)\n \tctx->owner = get_task_mm(current);\n \tINIT_LIST_HEAD(&ctx->rq);\n \tINIT_LIST_HEAD(&ctx->aff_list);\n-\tif (gang)\n-\t\tspu_gang_add_ctx(gang, ctx);\n-\n+\tspu_gang_add_ctx(gang, ctx);\n \t__spu_update_sched_info(ctx);\n \tspu_set_timeslice(ctx);\n \tctx->stats.util_state = SPU_UTIL_IDLE_LOADED;\n \n \tatomic_inc(&nr_spu_contexts);\n \tgoto out;\n+\n+out_free_gang:\n+\tkfree(gang);\n out_free:\n \tkfree(ctx);\n \tctx = NULL;\n@@ -76,15 +91,18 @@ out:\n \n void destroy_spu_context(struct kref *kref)\n {\n+\tstruct spu_gang *gang;\n \tstruct spu_context *ctx;\n+\n \tctx = container_of(kref, struct spu_context, kref);\n+\tgang = ctx->gang;\n+\n \tspu_context_nospu_trace(destroy_spu_context__enter, ctx);\n \tmutex_lock(&ctx->state_mutex);\n \tspu_deactivate(ctx);\n \tmutex_unlock(&ctx->state_mutex);\n \tspu_fini_csa(&ctx->csa);\n-\tif (ctx->gang)\n-\t\tspu_gang_remove_ctx(ctx->gang, ctx);\n+\tspu_gang_remove_ctx(ctx->gang, ctx);\n \tif (ctx->prof_priv_kref)\n \t\tkref_put(ctx->prof_priv_kref, ctx->prof_priv_release);\n \tBUG_ON(!list_empty(&ctx->rq));\ndiff --git a/arch/powerpc/platforms/cell/spufs/inode.c \nb/arch/powerpc/platforms/cell/spufs/inode.c\nindex 690ca7b..cf97761 100644\n--- a/arch/powerpc/platforms/cell/spufs/inode.c\n+++ b/arch/powerpc/platforms/cell/spufs/inode.c\n@@ -261,18 +261,30 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, \nunsigned int flags,\n {\n \tint ret;\n \tstruct inode *inode;\n-\tstruct spu_context *ctx;\n+\tstruct spu_context *ctx, *gang_ctx;\n+\tstruct spu_gang *gang;\n \n \tret = -ENOSPC;\n \tinode = spufs_new_inode(dir->i_sb, mode | S_IFDIR);\n \tif (!inode)\n \t\tgoto out;\n \n+\t/* Can't mix sched and no-sched within the same gang. */\n+\tgang = SPUFS_I(dir)->i_gang;\n+\tif (gang) {\n+\t\tgang_ctx = list_first_entry(&gang->list, struct spu_context, gang_list);\n+\t\tif ((flags & SPU_CREATE_NOSCHED) ^\n+\t\t (gang_ctx->flags & SPU_CREATE_NOSCHED)) {\n+\t\t\tret = -EPERM;\n+\t\t\tgoto out_iput;\n+\t\t}\n+\t}\n+\n \tif (dir->i_mode & S_ISGID) {\n \t\tinode->i_gid = dir->i_gid;\n \t\tinode->i_mode &= S_ISGID;\n \t}\n-\tctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */\n+\tctx = alloc_spu_context(gang);\n \tSPUFS_I(inode)->i_ctx = ctx;\n \tif (!ctx)\n", "prefixes": [] }