get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/258/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 258,
    "url": "http://patchwork.ozlabs.org/api/patches/258/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/200809112038.27534.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": "<200809112038.27534.adetsch@br.ibm.com>",
    "list_archive_url": null,
    "date": "2008-09-11T23:38:27",
    "name": "powerpc/spufs: Implement SPU affinity on top of gang scheduling",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "040ba8c1575319a2fae675091fe318a0757defde",
    "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/200809112038.27534.adetsch@br.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/258/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/258/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 AA27ADEB54\n\tfor <patchwork@ozlabs.org>; Fri, 12 Sep 2008 09:40:41 +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 0FC75DE000;\n\tFri, 12 Sep 2008 09:39:17 +1000 (EST)",
            "from mailhub1.br.ibm.com (mailhub1 [9.18.232.109])\n\tby igw1.br.ibm.com (Postfix) with ESMTP id A69F532C124;\n\tThu, 11 Sep 2008 20:08:38 -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\tm8BNdFnN2478300; Thu, 11 Sep 2008 20:39:15 -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\tm8BNd8Tb030236; Thu, 11 Sep 2008 20:39:08 -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\tm8BNd8Ij030227; Thu, 11 Sep 2008 20:39:08 -0300"
        ],
        "From": "Andre Detsch <adetsch@br.ibm.com>",
        "To": "cbe-oss-dev@ozlabs.org",
        "Date": "Thu, 11 Sep 2008 20:38:27 -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": "<200809112038.27534.adetsch@br.ibm.com>",
        "Cc": "LukeBrowning@us.ibm.com, Jeremy Kerr <jk@ozlabs.org>",
        "Subject": "[Cbe-oss-dev] [PATCH 11/11] powerpc/spufs: Implement SPU affinity\n\ton top of gang scheduling",
        "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": "SPU affinity, originally implemented before we had gang\nscheduling, was disabled after gang scheduling was\nintroduced.\n\nThis patch re-enables SPU affinity, making it fit the new scheduling\nalgorithm.\n\nSigned-off-by: Andre Detsch <adetsch@br.ibm.com>",
    "diff": "diff --git a/arch/powerpc/platforms/cell/spufs/sched.c \nb/arch/powerpc/platforms/cell/spufs/sched.c\nindex 8326034..c34e53f 100644\n--- a/arch/powerpc/platforms/cell/spufs/sched.c\n+++ b/arch/powerpc/platforms/cell/spufs/sched.c\n@@ -443,31 +443,20 @@ static struct spu *ctx_location(struct spu *ref, int \noffset, int node)\n \treturn spu;\n }\n \n-/*\n- * affinity_check is called each time a context is going to be scheduled.\n- * It returns the spu ptr on which the context must run.\n- */\n-static int has_affinity(struct spu_gang *gang)\n+static void set_affinity(struct spu_gang *gang)\n {\n-\tif (list_empty(&gang->aff_list_head))\n-\t\treturn 0;\n-\n-\t/*\n-\t * TODO: fix SPU Affinity to work with gang scheduling.\n-\t */\n-\n-\tif (atomic_read(&gang->aff_sched_count) == 0)\n-\t\tgang->aff_ref_spu = NULL;\n+\tBUG_ON(list_empty(&gang->aff_list_head));\n \n-\tif (!gang->aff_ref_spu) {\n-\t\tif (!(gang->aff_flags & AFF_MERGED))\n-\t\t\taff_merge_remaining_ctxs(gang);\n-\t\tif (!(gang->aff_flags & AFF_OFFSETS_SET))\n-\t\t\taff_set_offsets(gang);\n-\t\taff_set_ref_point_location(gang);\n-\t}\n+\tif (!(gang->aff_flags & AFF_MERGED))\n+\t\taff_merge_remaining_ctxs(gang);\n+\tif (!(gang->aff_flags & AFF_OFFSETS_SET))\n+\t\taff_set_offsets(gang);\n+\taff_set_ref_point_location(gang);\n+}\n \n-\treturn gang->aff_ref_spu != NULL;\n+static int has_affinity(struct spu_gang *gang)\n+{\n+\treturn !list_empty(&gang->aff_list_head);\n }\n \n /**\n@@ -486,9 +475,6 @@ static void spu_unbind_context(struct spu *spu, struct \nspu_context *ctx)\n  \tif (spu->ctx->flags & SPU_CREATE_NOSCHED)\n \t\tatomic_dec(&cbe_spu_info[spu->node].reserved_spus);\n \n-\tif (ctx->gang)\n-\t\tatomic_dec_if_positive(&ctx->gang->aff_sched_count);\n-\n \tspu_switch_notify(spu, NULL);\n \tspu_unmap_mappings(ctx);\n \tspu_save(&ctx->csa, spu);\n@@ -582,6 +568,15 @@ static struct spu *spu_bind(struct spu_gang *gang,\n \t\tif (!node_allowed(gang, node))\n \t\t\tcontinue;\n \n+\t\tif (has_affinity(gang)) {\n+\t\t\tspin_lock(&cbe_spu_info[node].list_lock);\n+\t\t\tspu = ctx_location(gang->aff_ref_spu, ctx->aff_offset,\n+\t\t\t\t\t   node);\n+\t\t\tif (spu && spu->alloc_state == SPU_FREE)\n+\t\t\t\tgoto found;\n+\t\t\tspin_unlock(&cbe_spu_info[node].list_lock);\n+\t\t}\n+\n \t\tspin_lock(&cbe_spu_info[node].list_lock);\n \t\tlist_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {\n \t\t\tif ((spu->alloc_state == SPU_FREE) &&\n@@ -608,6 +603,9 @@ static void __spu_schedule(struct spu_gang *gang, int \nnode_chosen)\n \n \tspu_del_from_rq(gang);\n \n+\tif (has_affinity(gang))\n+\t\tset_affinity(gang);\n+\n \tlist_for_each_entry(ctx, &gang->list, gang_list) {\n \t\tmutex_lock(&ctx->state_mutex);\n \t\tBUG_ON(ctx->spu);\n@@ -657,6 +655,18 @@ static int spu_get_idle(struct spu_gang *gang, int node)\n \tspu_context_nospu_trace(spu_get_idle__enter, gang);\n \n \t/* TO DO: SPU affinity scheduling. */\n+#if 0\n+\tif (has_affinity(gang)) {\n+\t\taff_ref_spu = ctx->gang->aff_ref_spu;\n+\t\tnode = aff_ref_spu->node;\n+\n+\t\tmutex_lock(&cbe_spu_info[node].list_mutex);\n+\t\tspu = ctx_location(aff_ref_spu, ctx->aff_offset, node);\n+\t\tif (spu && spu->alloc_state == SPU_FREE)\n+\t\t\tgoto found;\n+\t\tmutex_unlock(&cbe_spu_info[node].list_mutex);\n+\t}\n+#endif\n \n \tmode = SPU_RESERVE;\n \ndiff --git a/arch/powerpc/platforms/cell/spufs/spufs.h \nb/arch/powerpc/platforms/cell/spufs/spufs.h\nindex 6afc514..907baf9 100644\n--- a/arch/powerpc/platforms/cell/spufs/spufs.h\n+++ b/arch/powerpc/platforms/cell/spufs/spufs.h\n@@ -178,7 +178,6 @@ struct spu_gang {\n \tstruct mutex aff_mutex;\n \tint aff_flags;\n \tstruct spu *aff_ref_spu;\n-\tatomic_t aff_sched_count;\n \n \t/* spu scheduler statistics for zombie ctxts */\n \tstruct {\n",
    "prefixes": []
}