get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 242,
    "url": "http://patchwork.ozlabs.org/api/patches/242/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/48C972E3.7040507@am.sony.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": "<48C972E3.7040507@am.sony.com>",
    "list_archive_url": null,
    "date": "2008-09-11T19:34:59",
    "name": "MARS: Workload queue api add set flag",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "fbbf0b559847463cf27990d17e2f60e5e60a9384",
    "submitter": {
        "id": 127,
        "url": "http://patchwork.ozlabs.org/api/people/127/?format=api",
        "name": "Yuji Mano",
        "email": "yuji.mano@am.sony.com"
    },
    "delegate": {
        "id": 26,
        "url": "http://patchwork.ozlabs.org/api/users/26/?format=api",
        "username": "ymano",
        "first_name": "Yuji",
        "last_name": "Mano",
        "email": "yuji.mano@am.sony.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/48C972E3.7040507@am.sony.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/242/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/242/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 19FBADE8DD\n\tfor <patchwork@ozlabs.org>; Fri, 12 Sep 2008 06:38:32 +1000 (EST)",
            "from VA3EHSOBE004.bigfish.com (outbound-va3.frontbridge.com\n\t[216.32.180.16]) by ozlabs.org (Postfix) with ESMTP id 49D15DE31A\n\tfor <cbe-oss-dev@ozlabs.org>; Fri, 12 Sep 2008 06:37:16 +1000 (EST)",
            "from mail161-va3-R.bigfish.com (10.7.14.254) by\n\tVA3EHSOBE004.bigfish.com (10.7.40.24) with Microsoft SMTP Server id\n\t8.1.291.1; Thu, 11 Sep 2008 20:37:12 +0000",
            "from mail161-va3 (localhost.localdomain [127.0.0.1])\tby\n\tmail161-va3-R.bigfish.com (Postfix) with ESMTP id F405B7909E7\tfor\n\t<cbe-oss-dev@ozlabs.org>; Thu, 11 Sep 2008 20:37:12 +0000 (UTC)",
            "by mail161-va3 (MessageSwitch) id 1221165430844719_7667;\n\tThu, 11 Sep 2008 20:37:10 +0000 (UCT)",
            "from mail8.fw-bc.sony.com (mail8.fw-bc.sony.com [160.33.98.75])\tby\n\tmail161-va3.bigfish.com (Postfix) with ESMTP id B96CB510054\tfor\n\t<cbe-oss-dev@ozlabs.org>; Thu, 11 Sep 2008 20:37:10 +0000 (UTC)",
            "from mail3.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com\n\t[43.134.1.211])\tby mail8.fw-bc.sony.com (8.14.2/8.14.2) with ESMTP id\n\tm8BKbA1o025079\tfor <cbe-oss-dev@ozlabs.org>;\n\tThu, 11 Sep 2008 20:37:10 GMT",
            "from USSDIXIM01.am.sony.com (ussdixim01.am.sony.com\n\t[43.130.140.33])\n\tby mail3.sjc.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id\n\tm8BKb9gO021764\n\tfor <cbe-oss-dev@ozlabs.org>; Thu, 11 Sep 2008 20:37:09 GMT",
            "from ussdixms03.am.sony.com ([43.130.140.23]) by\n\tUSSDIXIM01.am.sony.com with Microsoft SMTPSVC(5.0.2195.6713);\n\tThu, 11 Sep 2008 13:37:09 -0700",
            "from [43.135.148.175] ([43.135.148.175]) by ussdixms03.am.sony.com\n\twith Microsoft SMTPSVC(5.0.2195.6713);\n\tThu, 11 Sep 2008 13:37:09 -0700"
        ],
        "X-BigFish": "VS-10(zz3166M936fQzz10c0j10d3izz1497iz2dh6bh62h)",
        "X-Spam-TCS-SCL": "1:0",
        "X-FB-SS": "5,",
        "Message-ID": "<48C972E3.7040507@am.sony.com>",
        "Date": "Thu, 11 Sep 2008 12:34:59 -0700",
        "From": "Yuji Mano <yuji.mano@am.sony.com>",
        "User-Agent": "Thunderbird 2.0.0.5 (X11/20070719)",
        "MIME-Version": "1.0",
        "To": "CBE Development <cbe-oss-dev@ozlabs.org>",
        "X-Enigmail-Version": "0.95.7",
        "X-OriginalArrivalTime": "11 Sep 2008 20:37:09.0194 (UTC)\n\tFILETIME=[296F62A0:01C9144E]",
        "X-SEL-encryption-scan": "scanned",
        "Subject": "[Cbe-oss-dev] [PATCH 08/11]MARS: Workload queue api add set flag",
        "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": "This adds a new internal API workload_queue_exit that sets the exit flag inside\nthe workload queue header.\n\nPreviously this was done inside the workload_queue_finalize function, but since\nthe MARS context must first join all mpu context threads before finalizing the\nworkload queue, a separate function to set the exit flag for those threads is\nrequired.\n\nSigned-off-by: Yuji Mano <yuji.mano@am.sony.com>",
    "diff": "--- a/include/common/mars/mars_kernel_types.h\n+++ b/include/common/mars/mars_kernel_types.h\n@@ -44,9 +44,6 @@ extern \"C\" {\n \n #include <stdint.h>\n \n-#define MARS_FLAG_NONE\t\t\t0x0\n-#define MARS_FLAG_EXIT\t\t\t0x1\n-\n #define MARS_KERNEL_PARAMS_ALIGN\t128\n \n /* mars kernel parameters */\n--- a/include/common/mars/mars_workload_types.h\n+++ b/include/common/mars/mars_workload_types.h\n@@ -64,8 +64,8 @@ extern \"C\" {\n #define MARS_WORKLOAD_COUNTER_MIN\t\t0x0000\t/* minimum counter */\n #define MARS_WORKLOAD_COUNTER_MAX\t\t0xffff\t/* maximum counter */\n \n-#define MARS_WORKLOAD_SIGNAL_ON\t\t\t0x1\t/* signal set on */\n #define MARS_WORKLOAD_SIGNAL_OFF\t\t0x0\t/* signal set off */\n+#define MARS_WORKLOAD_SIGNAL_ON\t\t\t0x1\t/* signal set on */\n \n #define MARS_WORKLOAD_PER_BLOCK\t\t\t15\t/* wl/block */\n #define MARS_WORKLOAD_NUM_BLOCKS\t\t100\t/* total blocks */\n@@ -73,10 +73,14 @@ extern \"C\" {\n \n #define MARS_WORKLOAD_CONTEXT_SIZE\t\t128\t/* size of 128 bytes */\n #define MARS_WORKLOAD_CONTEXT_ALIGN\t\t128\t/* align to 128 bytes */\n+\n #define MARS_WORKLOAD_QUEUE_ALIGN\t\t128\t/* align to 128 bytes */\n #define MARS_WORKLOAD_QUEUE_HEADER_ALIGN\t128\t/* align to 128 bytes */\n #define MARS_WORKLOAD_QUEUE_BLOCK_ALIGN\t\t128\t/* align to 128 bytes */\n \n+#define MARS_WORKLOAD_QUEUE_FLAG_NONE\t\t0x0\t/* no flag set */\n+#define MARS_WORKLOAD_QUEUE_FLAG_EXIT\t\t0x1\t/* exit flag */\n+\n /*\n  * MARS workload queue block bits\n  * ----------------------------------------------------------------------------\n--- a/include/host/mars/mars_workload_queue.h\n+++ b/include/host/mars/mars_workload_queue.h\n@@ -46,6 +46,7 @@ extern \"C\" {\n \n int workload_queue_initialize(struct mars_workload_queue *queue);\n int workload_queue_finalize(struct mars_workload_queue *queue);\n+int workload_queue_exit(struct mars_workload_queue *queue);\n \n int workload_queue_add_begin(struct mars_workload_queue *queue, uint16_t *id,\n \t\t\t\tuint8_t type,\n--- a/src/host/lib/mars_context.c\n+++ b/src/host/lib/mars_context.c\n@@ -116,6 +116,10 @@ static int destroy_mpu_contexts(struct m\n \tvoid *p_ret;\n \tunsigned int i;\n \n+\t/* shutdown the workload queue so mpu context threads exit */\n+\tret = workload_queue_exit(mars->workload_queue);\n+\tMARS_CHECK_RET(ret == MARS_SUCCESS, ret);\n+\n \t/* join all mpu context threads */\n \tfor (i = 0; i < mars->mpu_context_count; i++) {\n \t\tret = pthread_join(mars->mpu_context_threads[i], &p_ret);\n@@ -155,16 +159,16 @@ int mars_initialize(struct mars_context \n \tMARS_CHECK_CLEANUP_RET(mars->workload_queue, mars_finalize(mars),\n \t\t\t\tMARS_ERROR_MEMORY);\n \n-\t/* initialize workload queue */\n-\tret = workload_queue_initialize(mars->workload_queue);\n-\tMARS_CHECK_CLEANUP_RET(ret == MARS_SUCCESS, mars_finalize(mars), ret);\n-\n \t/* allocate mpu context thread array */\n \tmars->mpu_context_threads = (pthread_t *)\n \t\tmalloc(sizeof(pthread_t) * num_mpus);\n \tMARS_CHECK_CLEANUP_RET(mars->mpu_context_threads, mars_finalize(mars),\n \t\t\t\tMARS_ERROR_MEMORY);\n \n+\t/* initialize workload queue */\n+\tret = workload_queue_initialize(mars->workload_queue);\n+\tMARS_CHECK_CLEANUP_RET(ret == MARS_SUCCESS, mars_finalize(mars), ret);\n+\n \t/* create contexts */\n \tret = create_mpu_contexts(mars, num_mpus);\n \tMARS_CHECK_CLEANUP_RET(ret == MARS_SUCCESS, mars_finalize(mars), ret);\n@@ -178,22 +182,22 @@ int mars_finalize(struct mars_context *m\n \n \tint ret;\n \n-\t/* finalize workload queue */\n-\tif (mars->workload_queue) {\n-\t\tret = workload_queue_finalize(mars->workload_queue);\n-\t\tMARS_CHECK_RET(ret == MARS_SUCCESS, ret);\n-\t}\n-\n \t/* destroy contexts */\n \tif (mars->mpu_context_count) {\n \t\tret = destroy_mpu_contexts(mars);\n \t\tMARS_CHECK_RET(ret == MARS_SUCCESS, ret);\n \t}\n \n+\t/* finalize workload queue */\n+\tif (mars->workload_queue) {\n+\t\tret = workload_queue_finalize(mars->workload_queue);\n+\t\tMARS_CHECK_RET(ret == MARS_SUCCESS, ret);\n+\t}\n+\n \t/* free allocated memory */\n-\tfree(mars->kernel_params);\n-\tfree(mars->workload_queue);\n \tfree(mars->mpu_context_threads);\n+\tfree(mars->workload_queue);\n+\tfree(mars->kernel_params);\n \n \t/* zero context */\n \tmemset(mars, 0, sizeof(struct mars_context));\n--- a/src/host/lib/mars_workload_queue.c\n+++ b/src/host/lib/mars_workload_queue.c\n@@ -51,9 +51,9 @@ int workload_queue_initialize(struct mar\n \tint block;\n \tint index;\n \n+\tqueue->header.flag = MARS_WORKLOAD_QUEUE_FLAG_NONE;\n \tqueue->header.queue_ea = (uint64_t)(uintptr_t)queue;\n \tqueue->header.context_ea = (uint64_t)(uintptr_t)&queue->context;\n-\tqueue->header.flag = MARS_FLAG_NONE;\n \n \t/* initialize workload queue blocks */\n \tfor (block = 0; block < MARS_WORKLOAD_NUM_BLOCKS; block++) {\n@@ -109,7 +109,14 @@ int workload_queue_finalize(struct mars_\n \t/* found some task left in workload queue */\n \tMARS_CHECK_RET(id < MARS_WORKLOAD_MAX, MARS_ERROR_STATE);\n \n-\tqueue->header.flag = MARS_FLAG_EXIT;\n+\treturn MARS_SUCCESS;\n+}\n+\n+int workload_queue_exit(struct mars_workload_queue *queue)\n+{\n+\tMARS_CHECK_RET(queue, MARS_ERROR_NULL);\n+\n+\tqueue->header.flag = MARS_WORKLOAD_QUEUE_FLAG_EXIT;\n \n \treturn MARS_SUCCESS;\n }\n--- a/src/mpu/kernel/mars_kernel_scheduler.c\n+++ b/src/mpu/kernel/mars_kernel_scheduler.c\n@@ -244,7 +244,7 @@ int scheduler(void)\n \t\t\tMARS_DMA_TAG);\n \n \t/* return exit status if exit flag is set from host */\n-\tif (queue_header.flag == MARS_FLAG_EXIT)\n+\tif (queue_header.flag == MARS_WORKLOAD_QUEUE_FLAG_EXIT)\n \t\treturn MARS_KERNEL_STATUS_EXIT;\n \n \t/* reserve next workload to run or return idle status if none found */\n",
    "prefixes": []
}