get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41512,
    "url": "http://patches.dpdk.org/api/patches/41512/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180626070832.3055-6-qi.z.zhang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20180626070832.3055-6-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180626070832.3055-6-qi.z.zhang@intel.com",
    "date": "2018-06-26T07:08:13",
    "name": "[v4,05/24] eal: support mp task be invoked in a separate task",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2151a33def111774951eec5b6076e1551ab9826e",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180626070832.3055-6-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 230,
            "url": "http://patches.dpdk.org/api/series/230/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=230",
            "date": "2018-06-26T07:08:08",
            "name": "enable hotplug on multi-process",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/230/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41512/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41512/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 75F6258FA;\n\tTue, 26 Jun 2018 09:08:21 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id E29FE4F98\n\tfor <dev@dpdk.org>; Tue, 26 Jun 2018 09:08:08 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t26 Jun 2018 00:08:08 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby fmsmga006.fm.intel.com with ESMTP; 26 Jun 2018 00:08:07 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,273,1526367600\"; d=\"scan'208\";a=\"240659979\"",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com",
        "Cc": "konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, \n\tferruh.yigit@intel.com, benjamin.h.shelton@intel.com,\n\tnarender.vangati@intel.com, Qi Zhang <qi.z.zhang@intel.com>",
        "Date": "Tue, 26 Jun 2018 15:08:13 +0800",
        "Message-Id": "<20180626070832.3055-6-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20180626070832.3055-1-qi.z.zhang@intel.com>",
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>\n\t<20180626070832.3055-1-qi.z.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 05/24] eal: support mp task be invoked in a\n\tseparate task",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "We know the limitation that sync IPC can't be invoked in mp handler\nitself which will cause deadlock, the patch introduce new API\nrte_eal_mp_task_add to support mp handler be delegated in a separate\ntask.\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n lib/librte_eal/common/eal_common_proc.c | 67 +++++++++++++++++++++++++++++++++\n lib/librte_eal/common/include/rte_eal.h | 31 +++++++++++++++\n 2 files changed, 98 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c\nindex fc0eb4d17..166bb0951 100644\n--- a/lib/librte_eal/common/eal_common_proc.c\n+++ b/lib/librte_eal/common/eal_common_proc.c\n@@ -27,6 +27,7 @@\n #include <rte_lcore.h>\n #include <rte_log.h>\n #include <rte_tailq.h>\n+#include <rte_spinlock.h>\n \n #include \"eal_private.h\"\n #include \"eal_filesystem.h\"\n@@ -738,6 +739,72 @@ void rte_mp_init_callback_cleanup(void)\n \t}\n }\n \n+struct mp_task {\n+\tTAILQ_ENTRY(mp_task) next;\n+\trte_eal_mp_task task;\n+\tvoid *args;\n+};\n+\n+TAILQ_HEAD(mp_task_list, mp_task);\n+static struct mp_task_list mp_task_list =\n+\tTAILQ_HEAD_INITIALIZER(mp_task_list);\n+static rte_spinlock_t mp_task_lock = RTE_SPINLOCK_INITIALIZER;\n+\n+static void *schedule_mp_task(void *args __rte_unused)\n+{\n+\tstruct mp_task *task;\n+\n+\trte_spinlock_lock(&mp_task_lock);\n+\twhile (!TAILQ_EMPTY(&mp_task_list)) {\n+\n+\t\ttask = TAILQ_FIRST(&mp_task_list);\n+\t\trte_spinlock_unlock(&mp_task_lock);\n+\n+\t\ttask->task(task->args);\n+\n+\t\trte_spinlock_lock(&mp_task_lock);\n+\t\tTAILQ_REMOVE(&mp_task_list, task, next);\n+\t\tif (task->args)\n+\t\t\tfree(task->args);\n+\t\tfree(task);\n+\t}\n+\n+\trte_spinlock_unlock(&mp_task_lock);\n+\treturn NULL;\n+}\n+\n+int __rte_experimental\n+rte_eal_mp_task_add(rte_eal_mp_task task, void *args)\n+{\n+\tstruct mp_task *t = calloc(1, sizeof(struct mp_task));\n+\tpthread_t tid;\n+\n+\tif (t == NULL)\n+\t\treturn -ENOMEM;\n+\n+\tt->task = task;\n+\tt->args = args;\n+\n+\trte_spinlock_lock(&mp_task_lock);\n+\n+\tif (TAILQ_EMPTY(&mp_task_list)) {\n+\t\tTAILQ_INSERT_TAIL(&mp_task_list, t, next);\n+\t\trte_spinlock_unlock(&mp_task_lock);\n+\n+\t\tif (rte_ctrl_thread_create(&tid,\n+\t\t\t\"rte_mp_handle\", NULL, schedule_mp_task, NULL) < 0) {\n+\t\t\tRTE_LOG(ERR, EAL, \"failed to create mp thead: %s\\n\",\n+\t\t\t\tstrerror(errno));\n+\t\t}\n+\t\treturn 0;\n+\t}\n+\n+\tTAILQ_INSERT_TAIL(&mp_task_list, t, next);\n+\trte_spinlock_unlock(&mp_task_lock);\n+\n+\treturn 0;\n+}\n+\n /**\n  * Return -1, as fail to send message and it's caused by the local side.\n  * Return 0, as fail to send message and it's caused by the remote side.\ndiff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h\nindex 506f17f34..0ce49668c 100644\n--- a/lib/librte_eal/common/include/rte_eal.h\n+++ b/lib/librte_eal/common/include/rte_eal.h\n@@ -546,6 +546,37 @@ typedef int (*rte_eal_mp_init_callback_t)(void);\n int __rte_experimental\n rte_eal_register_mp_init(rte_eal_mp_init_callback_t callback);\n \n+/**\n+ * Function to perform the task that handle mp request,\n+ * it will be scheduled on a separate task.\n+ *\n+ * @param args\n+ *   argument parse to the function point.\n+ */\n+typedef void (*rte_eal_mp_task)(void *args);\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Add a rte_eal_mp_task into a task list, it will invoked in a\n+ * separate task, the purpose is to prevent deadlock if sync IPC\n+ * is required in the task.\n+ *\n+ * @param task\n+ *   function point to perform the task.\n+ *\n+ * @param args\n+ *   argument parse to the function point.\n+ *\n+ * @return\n+ *  - 0 on success.\n+ *  - (<0) on failure.\n+ */\n+int __rte_experimental\n+rte_eal_mp_task_add(rte_eal_mp_task task, void *args);\n+\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "v4",
        "05/24"
    ]
}