get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 239,
    "url": "http://patchwork.ozlabs.org/api/patches/239/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/cbe-oss-dev/patch/48C972DB.1090900@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": "<48C972DB.1090900@am.sony.com>",
    "list_archive_url": null,
    "date": "2008-09-11T19:34:51",
    "name": "MARS: Add task exit code support",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "840bbb351db1f13f1883408c2a0646907379b9f8",
    "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/48C972DB.1090900@am.sony.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/239/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/239/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 59C42DE607\n\tfor <patchwork@ozlabs.org>; Fri, 12 Sep 2008 06:37:56 +1000 (EST)",
            "from WA4EHSOBE004.bigfish.com (outbound-wa4.frontbridge.com\n\t[216.32.181.16]) by ozlabs.org (Postfix) with ESMTP id 1A914DE01F\n\tfor <cbe-oss-dev@ozlabs.org>; Fri, 12 Sep 2008 06:37:15 +1000 (EST)",
            "from mail120-wa4-R.bigfish.com (10.8.14.246) by\n\tWA4EHSOBE004.bigfish.com (10.8.40.24) with Microsoft SMTP Server id\n\t8.1.291.1; Thu, 11 Sep 2008 20:37:12 +0000",
            "from mail120-wa4 (localhost.localdomain [127.0.0.1])\tby\n\tmail120-wa4-R.bigfish.com (Postfix) with ESMTP id 30862B811F\tfor\n\t<cbe-oss-dev@ozlabs.org>; Thu, 11 Sep 2008 20:37:12 +0000 (UTC)",
            "by mail120-wa4 (MessageSwitch) id 1221165429723181_20695; Thu, 11\n\tSep 2008 20:37:09 +0000 (UCT)",
            "from mail8.fw-sd.sony.com (mail8.fw-sd.sony.com [160.33.66.75])\tby\n\tmail120-wa4.bigfish.com (Postfix) with ESMTP id 9769FE4005A\tfor\n\t<cbe-oss-dev@ozlabs.org>; Thu, 11 Sep 2008 20:37:09 +0000 (UTC)",
            "from mail3.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com\n\t[43.134.1.211])\tby mail8.fw-sd.sony.com (8.14.2/8.14.2) with ESMTP id\n\tm8BKb9oc021159\tfor <cbe-oss-dev@ozlabs.org>;\n\tThu, 11 Sep 2008 20:37:09 GMT",
            "from USSDIXIM02.am.sony.com (ussdixim02.am.sony.com\n\t[43.130.140.34])\n\tby mail3.sjc.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id\n\tm8BKb7tB021726\n\tfor <cbe-oss-dev@ozlabs.org>; Thu, 11 Sep 2008 20:37:08 GMT",
            "from ussdixms03.am.sony.com ([43.130.140.23]) by\n\tUSSDIXIM02.am.sony.com with Microsoft SMTPSVC(5.0.2195.6713);\n\tThu, 11 Sep 2008 13:37:08 -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:07 -0700"
        ],
        "X-BigFish": "VS4(zzzz10c0j10d3izz1497iz2dh6bh61h)",
        "X-Spam-TCS-SCL": "0:0",
        "X-FB-SS": "5,",
        "Message-ID": "<48C972DB.1090900@am.sony.com>",
        "Date": "Thu, 11 Sep 2008 12:34:51 -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:07.0882 (UTC)\n\tFILETIME=[28A730A0:01C9144E]",
        "X-SEL-encryption-scan": "scanned",
        "Subject": "[Cbe-oss-dev] [PATCH 06/11]MARS: Add task exit code support",
        "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 support for the MARS task API to be able to return the exit_code\nreturned by mars_task_main or passed into mars_task_exit, to the user. The\nexit_code can be obtained when calling mars_task_wait. It is left up to the\nuser how they will handle any errors returned by the task program.\n\nSigned-off-by: Yuji Mano <yuji.mano@am.sony.com>",
    "diff": "--- a/include/common/mars/mars_task_types.h\n+++ b/include/common/mars/mars_task_types.h\n@@ -162,7 +162,8 @@ struct mars_task_context {\n \tuint32_t stack;\t\t\t/* stack pointer of exec */\n \tuint32_t context_save_size;\t/* context save size */\n \tuint64_t context_save_area;\t/* context save area */\n-\tuint8_t pad[24];\t\t/* padding */\n+\tint32_t exit_code;\t\t/* exit code */\n+\tuint8_t pad[20];\t\t/* padding */\n } __attribute__((aligned(MARS_TASK_CONTEXT_ALIGN)));\n \n #if defined(__cplusplus)\n--- a/include/host/mars/mars_task.h\n+++ b/include/host/mars/mars_task.h\n@@ -179,13 +179,14 @@ int mars_task_schedule(struct mars_task_\n  * This function will block until the scheduled task specified is finished.\n  *\n  * \\param[in] id\t\t- pointer to task id to wait for\n+ * \\param[in] exit_code\t\t- pointer to variable to store task exit code\n  * \\return\n  *\tMARS_SUCCESS\t\t- task execution finished\n  * \\n\tMARS_ERROR_NULL\t\t- null pointer specified\n  * \\n\tMARS_ERROR_PARAMS\t- bad task id specified\n  * \\n\tMARS_ERROR_STATE\t- task is in an invalid state\n  */\n-int mars_task_wait(struct mars_task_id *id);\n+int mars_task_wait(struct mars_task_id *id, int32_t *exit_code);\n \n /**\n  * \\ingroup group_mars_task\n@@ -195,6 +196,7 @@ int mars_task_wait(struct mars_task_id *\n  * or not and return immediately without blocking.\n  *\n  * \\param[in] id\t\t- pointer to task id to wait for\n+ * \\param[in] exit_code\t\t- pointer to variable to store task exit code\n  * \\return\n  *\tMARS_SUCCESS\t\t- task execution finished\n  * \\n\tMARS_ERROR_NULL\t\t- null pointer specified\n@@ -202,7 +204,7 @@ int mars_task_wait(struct mars_task_id *\n  * \\n\tMARS_ERROR_STATE\t- task is in an invalid state\n  * \\n\tMARS_ERROR_BUSY\t\t- task has not yet finished execution\n  */\n-int mars_task_try_wait(struct mars_task_id *id);\n+int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code);\n \n #if defined(__cplusplus)\n }\n--- a/include/mpu/mars/mars_task.h\n+++ b/include/mpu/mars/mars_task.h\n@@ -78,8 +78,10 @@ int mars_task_main(const struct mars_tas\n  * function will cause the task to enter the finished state, and will no\n  * longer be scheduled to run. This function does not need to be called when\n  * returning from \\ref mars_task_main since it is called automatically.\n+ *\n+ * \\param[in] exit_code\t\t- value to be returned to the task wait call\n  */\n-void mars_task_exit(void);\n+void mars_task_exit(int32_t exit_code);\n \n /**\n  * \\ingroup group_mars_task\n@@ -138,6 +140,7 @@ int mars_task_schedule(struct mars_task_\n  * This function will block until the scheduled task specified is finished.\n  *\n  * \\param[in] id\t\t- pointer to task id to wait for\n+ * \\param[in] exit_code\t\t- pointer to variable to store task exit code\n  * \\return\n  *\tMARS_SUCCESS\t\t- task execution finished\n  * \\n\tMARS_ERROR_NULL\t\t- null pointer specified\n@@ -145,7 +148,7 @@ int mars_task_schedule(struct mars_task_\n  * \\n\tMARS_ERROR_STATE\t- task is in an invalid state\n  * \\n\tMARS_ERROR_FORMAT\t- no context save area specified\n  */\n-int mars_task_wait(struct mars_task_id *id);\n+int mars_task_wait(struct mars_task_id *id, int32_t *exit_code);\n \n /**\n  * \\ingroup group_mars_task\n@@ -155,6 +158,7 @@ int mars_task_wait(struct mars_task_id *\n  * or not and return immediately without blocking.\n  *\n  * \\param[in] id\t\t- pointer to task id to wait for\n+ * \\param[in] exit_code\t\t- pointer to variable to store task exit code\n  * \\return\n  *\tMARS_SUCCESS\t\t- task execution finished\n  * \\n\tMARS_ERROR_NULL\t\t- null pointer specified\n@@ -162,7 +166,7 @@ int mars_task_wait(struct mars_task_id *\n  * \\n\tMARS_ERROR_STATE\t- task is in an invalid state\n  * \\n\tMARS_ERROR_BUSY\t\t- task has not yet finished execution\n  */\n-int mars_task_try_wait(struct mars_task_id *id);\n+int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code);\n \n /**\n  * \\ingroup group_mars_task\n--- a/src/host/lib/mars_task.c\n+++ b/src/host/lib/mars_task.c\n@@ -185,7 +185,7 @@ int mars_task_schedule(struct mars_task_\n \treturn MARS_SUCCESS;\n }\n \n-int mars_task_wait(struct mars_task_id *id)\n+int mars_task_wait(struct mars_task_id *id, int32_t *exit_code)\n {\n \tMARS_CHECK_RET(id, MARS_ERROR_NULL);\n \tMARS_CHECK_RET(id->mars_context_ea, MARS_ERROR_PARAMS);\n@@ -200,10 +200,14 @@ int mars_task_wait(struct mars_task_id *\n \t\t\t\t(struct mars_workload_context **)&task);\n \tMARS_CHECK_RET(ret == MARS_SUCCESS, ret);\n \n+\t/* exit_code requested so return it to caller */\n+\tif (exit_code)\n+\t\t*exit_code = task->exit_code;\n+\n \treturn MARS_SUCCESS;\n }\n \n-int mars_task_try_wait(struct mars_task_id *id)\n+int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code)\n {\n \tMARS_CHECK_RET(id, MARS_ERROR_NULL);\n \tMARS_CHECK_RET(id->mars_context_ea, MARS_ERROR_PARAMS);\n@@ -218,5 +222,9 @@ int mars_task_try_wait(struct mars_task_\n \t\t\t\t(struct mars_workload_context **)&task);\n \tMARS_CHECK_RET(ret == MARS_SUCCESS, ret);\n \n+\t/* exit_code requested so return it to caller */\n+\tif (exit_code)\n+\t\t*exit_code = task->exit_code;\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@@ -223,13 +223,10 @@ void release_workload(void)\n \tint block = workload_index / MARS_WORKLOAD_PER_BLOCK;\n \tint index = workload_index % MARS_WORKLOAD_PER_BLOCK;\n \n-\t/* dma updated workload context back to main memory if not finished */\n-\tif (workload_state != MARS_WORKLOAD_STATE_FINISHED) {\n-\t\tmars_dma_put_and_wait((void *)&workload,\n-\t\t\t\t\tworkload_ea,\n-\t\t\t\t\tsizeof(struct mars_workload_context),\n-\t\t\t\t\tMARS_DMA_TAG);\n-\t}\n+\tmars_dma_put_and_wait((void *)&workload,\n+\t\t\t\tworkload_ea,\n+\t\t\t\tsizeof(struct mars_workload_context),\n+\t\t\t\tMARS_DMA_TAG);\n \n \t/* release block reservation */\n \trelease_block(block, index);\n--- a/src/mpu/lib/mars_entry.S\n+++ b/src/mpu/lib/mars_entry.S\n@@ -80,4 +80,4 @@ mars_entry:\n \tbrsl\t$lr, mars_task_main\n \n \t/* call kernel syscall exit */\n-\tbr\tmars_exit\n+\tbr\tmars_task_exit\n--- a/src/mpu/lib/mars_task.c\n+++ b/src/mpu/lib/mars_task.c\n@@ -41,8 +41,15 @@\n #include \"mars/mars_error.h\"\n #include \"mars/mars_debug.h\"\n \n-void mars_task_exit(void)\n+void mars_task_exit(int32_t exit_code)\n {\n+\tstruct mars_task_context *task;\n+\n+\ttask = (struct mars_task_context *)mars_get_workload();\n+\n+\t/* save the exit code in the task context */\n+\ttask->exit_code = exit_code;\n+\n \tmars_exit();\n }\n \n@@ -61,8 +68,7 @@ int mars_task_yield(void)\n \treturn MARS_SUCCESS;\n }\n \n-int mars_task_schedule(struct mars_task_id *id,\n-\t\t\tstruct mars_task_args *args,\n+int mars_task_schedule(struct mars_task_id *id, struct mars_task_args *args,\n \t\t\tuint8_t priority)\n {\n \tMARS_CHECK_RET(id, MARS_ERROR_NULL);\n@@ -70,7 +76,7 @@ int mars_task_schedule(struct mars_task_\n \treturn mars_schedule(id->workload_id, args, priority);\n }\n \n-int mars_task_wait(struct mars_task_id *id)\n+int mars_task_wait(struct mars_task_id *id, int32_t *exit_code)\n {\n \tMARS_CHECK_RET(id, MARS_ERROR_NULL);\n \n@@ -88,14 +94,38 @@ int mars_task_wait(struct mars_task_id *\n \n \tmars_signal_wait();\n \n+\t/* exit code requested so get it from the task context and return it */\n+\tif (exit_code) {\n+\t\ttask = (struct mars_task_context *)\n+\t\t\tmars_get_workload_by_id(id->workload_id);\n+\t\tMARS_CHECK_RET(task, MARS_ERROR_INTERNAL);\n+\n+\t\t*exit_code = task->exit_code;\n+\t}\n+\n \treturn MARS_SUCCESS;\n }\n \n-int mars_task_try_wait(struct mars_task_id *id)\n+int mars_task_try_wait(struct mars_task_id *id, int32_t *exit_code)\n {\n \tMARS_CHECK_RET(id, MARS_ERROR_NULL);\n \n-\treturn mars_try_wait(id->workload_id);\n+\tint ret;\n+\tstruct mars_task_context *task;\n+\n+\tret = mars_try_wait(id->workload_id);\n+\tMARS_CHECK_RET(ret == MARS_SUCCESS, ret);\n+\n+\t/* exit code requested so get it from the task context and return it */\n+\tif (exit_code) {\n+\t\ttask = (struct mars_task_context *)\n+\t\t\tmars_get_workload_by_id(id->workload_id);\n+\t\tMARS_CHECK_RET(task, MARS_ERROR_INTERNAL);\n+\n+\t\t*exit_code = task->exit_code;\n+\t}\n+\n+\treturn MARS_SUCCESS;\n }\n \n uint32_t mars_task_get_kernel_id(void)\n",
    "prefixes": []
}