get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 96960,
    "url": "http://patchwork.dpdk.org/api/patches/96960/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210817032723.3997054-3-jerinj@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20210817032723.3997054-3-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210817032723.3997054-3-jerinj@marvell.com",
    "date": "2021-08-17T03:27:19",
    "name": "[v2,2/6] eal: oops handling API implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "66d93edafd800543b648c9843709daa0b196fd31",
    "submitter": {
        "id": 1188,
        "url": "http://patchwork.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210817032723.3997054-3-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 18300,
            "url": "http://patchwork.dpdk.org/api/series/18300/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18300",
            "date": "2021-08-17T03:27:17",
            "name": "support oops handling",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/18300/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/96960/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/96960/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 7547EA0548;\n\tTue, 17 Aug 2021 05:30:08 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A95D54116F;\n\tTue, 17 Aug 2021 05:30:06 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 15C214116D\n for <dev@dpdk.org>; Tue, 17 Aug 2021 05:30:04 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id\n 17H2lc0j006745;\n Mon, 16 Aug 2021 20:30:01 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com with ESMTP id 3ag4n0r3tj-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Mon, 16 Aug 2021 20:30:01 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Mon, 16 Aug 2021 20:29:59 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend\n Transport; Mon, 16 Aug 2021 20:29:59 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id B19323F707C;\n Mon, 16 Aug 2021 20:29:55 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=5RpELlI32r1Pi0dH3d3A14asnRfqhUepn/PBA9xuMfA=;\n b=LPdAymZlUmSdP2u79TU7uYBWI6KCthR8zIo8hihP+vl1XStucM9TQ25S81s/wY3fUiZh\n NFnU3V6CAU4Lidz1tywZLgE/amwRv8HHS4/rigGxZOEhZMHOpoQ9kFg6MFLfrqyscNsK\n rorTVRqbZI42OaTyfUVOyAwpvOkvwoozHS+EVRhxyAT2AsANwMmsMXkYE58AVvI1Ycl8\n oJPqKkq9BbkYqglMQdmS4N1gOv7KU9HwMbvuiygQg6n3MzlV2ljdu1lU3X+r/HUbEov0\n KbGEGTWIOeEWaVwhgaY5rJeunctXddcZR1NQsaIkbo25FsT6DmyYcjM8qROX+L2qX63v AA==",
        "From": "<jerinj@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<thomas@monjalon.net>, <david.marchand@redhat.com>,\n <bruce.richardson@intel.com>, <dmitry.kozliuk@gmail.com>,\n <navasile@linux.microsoft.com>, <dmitrym@microsoft.com>,\n <pallavi.kadam@intel.com>, <konstantin.ananyev@intel.com>,\n <ruifeng.wang@arm.com>, <viktorin@rehivetech.com>,\n <drc@linux.vnet.ibm.com>, Jerin Jacob <jerinj@marvell.com>",
        "Date": "Tue, 17 Aug 2021 08:57:19 +0530",
        "Message-ID": "<20210817032723.3997054-3-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210817032723.3997054-1-jerinj@marvell.com>",
        "References": "<20210730084938.2426128-2-jerinj@marvell.com>\n <20210817032723.3997054-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "DU0Gl0EwgOeE9UgfwOgUXbXRw9glZNkb",
        "X-Proofpoint-ORIG-GUID": "DU0Gl0EwgOeE9UgfwOgUXbXRw9glZNkb",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475\n definitions=2021-08-17_01,2021-08-16_02,2020-04-07_01",
        "Subject": "[dpdk-dev] [PATCH v2 2/6] eal: oops handling API implementation",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Jerin Jacob <jerinj@marvell.com>\n\nImplement the base oops handling APIs.\n\nSigned-off-by: Jerin Jacob <jerinj@marvell.com>\n---\n lib/eal/unix/eal_oops.c | 176 ++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 169 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/eal/unix/eal_oops.c b/lib/eal/unix/eal_oops.c\nindex 53b580f733..7b12cfd5f5 100644\n--- a/lib/eal/unix/eal_oops.c\n+++ b/lib/eal/unix/eal_oops.c\n@@ -2,35 +2,197 @@\n  * Copyright(C) 2021 Marvell.\n  */\n \n+#include <inttypes.h>\n+#include <signal.h>\n+#include <ucontext.h>\n+#include <unistd.h>\n \n+#include <rte_byteorder.h>\n+#include <rte_debug.h>\n+#include <rte_log.h>\n #include <rte_oops.h>\n \n #include \"eal_private.h\"\n \n-void\n-rte_oops_decode(int sig, siginfo_t *info, ucontext_t *uc)\n+#define oops_print(...) rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL, __VA_ARGS__)\n+\n+static int oops_signals[] = {SIGSEGV, SIGBUS, SIGILL, SIGABRT, SIGFPE, SIGSYS};\n+\n+struct oops_signal {\n+\tint sig;\n+\tbool enabled;\n+\tstruct sigaction sa;\n+};\n+\n+static struct oops_signal signals_db[RTE_DIM(oops_signals)];\n+\n+static void\n+back_trace_dump(ucontext_t *context)\n+{\n+\tRTE_SET_USED(context);\n+\n+\trte_dump_stack();\n+}\n+static void\n+siginfo_dump(int sig, siginfo_t *info)\n+{\n+\toops_print(\"PID:           %\" PRIdMAX \"\\n\", (intmax_t)getpid());\n+\n+\tif (info == NULL)\n+\t\treturn;\n+\tif (sig != info->si_signo)\n+\t\toops_print(\"Invalid signal info\\n\");\n+\n+\toops_print(\"Signal number: %d\\n\", info->si_signo);\n+\toops_print(\"Fault address: %p\\n\", info->si_addr);\n+}\n+\n+static void\n+mem32_dump(void *ptr)\n+{\n+\tuint32_t *p = ptr;\n+\tint i;\n+\n+\tfor (i = 0; i < 16; i++)\n+\t\toops_print(\"%p: 0x%x\\n\", p + i, rte_be_to_cpu_32(p[i]));\n+}\n+\n+static void\n+stack_dump_header(void)\n+{\n+\toops_print(\"Stack dump:\\n\");\n+\toops_print(\"----------\\n\");\n+}\n+\n+static void\n+code_dump_header(void)\n+{\n+\toops_print(\"Code dump:\\n\");\n+\toops_print(\"----------\\n\");\n+}\n+\n+static void\n+stack_code_dump(void *stack, void *code)\n+{\n+\tif (stack == NULL || code == NULL)\n+\t\treturn;\n+\n+\toops_print(\"\\n\");\n+\tstack_dump_header();\n+\tmem32_dump(stack);\n+\toops_print(\"\\n\");\n+\n+\tcode_dump_header();\n+\tmem32_dump(code);\n+\toops_print(\"\\n\");\n+}\n+static void\n+archinfo_dump(ucontext_t *uc)\n {\n-\tRTE_SET_USED(sig);\n-\tRTE_SET_USED(info);\n \tRTE_SET_USED(uc);\n \n+\tstack_code_dump(NULL, NULL);\n+}\n+\n+static void\n+default_signal_handler_invoke(int sig)\n+{\n+\tunsigned int idx;\n+\n+\tfor (idx = 0; idx < RTE_DIM(oops_signals); idx++) {\n+\t\t/* Skip disabled signals */\n+\t\tif (signals_db[idx].sig != sig)\n+\t\t\tcontinue;\n+\t\tif (!signals_db[idx].enabled)\n+\t\t\tcontinue;\n+\t\t/* Replace with stored handler */\n+\t\tsigaction(sig, &signals_db[idx].sa, NULL);\n+\t\tkill(getpid(), sig);\n+\t}\n+}\n+\n+void\n+rte_oops_decode(int sig, siginfo_t *info, ucontext_t *uc)\n+{\n+\toops_print(\"Signal info:\\n\");\n+\toops_print(\"------------\\n\");\n+\tsiginfo_dump(sig, info);\n+\toops_print(\"\\n\");\n+\n+\toops_print(\"Backtrace:\\n\");\n+\toops_print(\"----------\\n\");\n+\tback_trace_dump(uc);\n+\toops_print(\"\\n\");\n+\n+\toops_print(\"Arch info:\\n\");\n+\toops_print(\"----------\\n\");\n+\tif (uc)\n+\t\tarchinfo_dump(uc);\n+}\n+\n+static void\n+eal_oops_handler(int sig, siginfo_t *info, void *ctx)\n+{\n+\tucontext_t *uc = ctx;\n+\n+\trte_oops_decode(sig, info, uc);\n+\tdefault_signal_handler_invoke(sig);\n }\n \n int\n rte_oops_signals_enabled(int *signals)\n {\n-\tRTE_SET_USED(signals);\n+\tint count = 0, sig[RTE_OOPS_SIGNALS_MAX];\n+\tunsigned int idx = 0;\n \n-\treturn 0;\n+\tfor (idx = 0; idx < RTE_DIM(oops_signals); idx++) {\n+\t\tif (signals_db[idx].enabled) {\n+\t\t\tsig[count] = signals_db[idx].sig;\n+\t\t\tcount++;\n+\t\t}\n+\t}\n+\tif (signals)\n+\t\tmemcpy(signals, sig, sizeof(*signals) * count);\n+\n+\treturn count;\n }\n \n int\n eal_oops_init(void)\n {\n-\treturn 0;\n+\tunsigned int idx, rc = 0;\n+\tstruct sigaction sa;\n+\n+\tRTE_BUILD_BUG_ON(RTE_DIM(oops_signals) > RTE_OOPS_SIGNALS_MAX);\n+\n+\tsigemptyset(&sa.sa_mask);\n+\tsa.sa_sigaction = &eal_oops_handler;\n+\tsa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;\n+\n+\tfor (idx = 0; idx < RTE_DIM(oops_signals); idx++) {\n+\t\tsignals_db[idx].sig = oops_signals[idx];\n+\t\t/* Get exiting sigaction */\n+\t\trc = sigaction(signals_db[idx].sig, NULL, &signals_db[idx].sa);\n+\t\tif (rc)\n+\t\t\tcontinue;\n+\t\t/* Replace with oops handler */\n+\t\trc = sigaction(signals_db[idx].sig, &sa, NULL);\n+\t\tif (rc)\n+\t\t\tcontinue;\n+\t\tsignals_db[idx].enabled = true;\n+\t}\n+\treturn rc;\n }\n \n void\n eal_oops_fini(void)\n {\n+\tunsigned int idx;\n+\n+\tfor (idx = 0; idx < RTE_DIM(oops_signals); idx++) {\n+\t\tif (!signals_db[idx].enabled)\n+\t\t\tcontinue;\n+\t\t/* Replace with stored handler */\n+\t\tsigaction(signals_db[idx].sig, &signals_db[idx].sa, NULL);\n+\t}\n }\n",
    "prefixes": [
        "v2",
        "2/6"
    ]
}