Show a patch.

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

{
    "id": 42298,
    "url": "http://patches.dpdk.org/api/patches/42298/",
    "web_url": "http://patches.dpdk.org/patch/42298/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1530776333-30318-6-git-send-email-jia.guo@intel.com>",
    "date": "2018-07-05T07:38:52",
    "name": "[V5,5/7] bus: add helper to handle sigbus",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "94fa20a1d1f6783537d9a8d5df941bcbfdde7db8",
    "submitter": {
        "id": 507,
        "url": "http://patches.dpdk.org/api/people/507/",
        "name": "Jeff Guo",
        "email": "jia.guo@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/patch/42298/mbox/",
    "series": [
        {
            "id": 412,
            "url": "http://patches.dpdk.org/api/series/412/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=412",
            "date": "2018-07-05T07:38:47",
            "name": "hot plug failure handle mechanism",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/412/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42298/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42298/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 2.7.4",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A5CF31BEB3;\n\tThu,  5 Jul 2018 09:41:21 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id D30CD1BEAF\n\tfor <dev@dpdk.org>; Thu,  5 Jul 2018 09:41:19 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Jul 2018 00:41:19 -0700",
            "from jeffguo-z170x-ud5.sh.intel.com (HELO localhost.localdomain)\n\t([10.67.104.10])\n\tby fmsmga007.fm.intel.com with ESMTP; 05 Jul 2018 00:41:16 -0700"
        ],
        "References": "<1498711073-42917-1-git-send-email-jia.guo@intel.com>\n\t<1530776333-30318-1-git-send-email-jia.guo@intel.com>",
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1530776333-30318-6-git-send-email-jia.guo@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,311,1526367600\"; d=\"scan'208\";a=\"52144072\"",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "Jeff Guo <jia.guo@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<1530776333-30318-1-git-send-email-jia.guo@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "stephen@networkplumber.org, bruce.richardson@intel.com,\n\tferruh.yigit@intel.com, konstantin.ananyev@intel.com,\n\tgaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net,\n\tmotih@mellanox.com, matan@mellanox.com, harry.van.haaren@intel.com,\n\tqi.z.zhang@intel.com, shaopeng.he@intel.com, bernard.iremonger@intel.com",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Thu,  5 Jul 2018 15:38:52 +0800",
        "Cc": "jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org,\n\tjia.guo@intel.com, helin.zhang@intel.com",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH V5 5/7] bus: add helper to handle sigbus"
    },
    "content": "This patch aim to add a helper to iterate all buses to find the\ncorresponding bus to handle the sigbus error.\n\nSigned-off-by: Jeff Guo <jia.guo@intel.com>\n---\nv5->v4:\nrefine the errno restore logic\n---\n lib/librte_eal/common/eal_common_bus.c | 36 +++++++++++++++++++++++++++++++++-\n lib/librte_eal/common/eal_private.h    | 12 ++++++++++++\n 2 files changed, 47 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c\nindex 0943851..c9f3566 100644\n--- a/lib/librte_eal/common/eal_common_bus.c\n+++ b/lib/librte_eal/common/eal_common_bus.c\n@@ -37,6 +37,7 @@\n #include <rte_bus.h>\n #include <rte_debug.h>\n #include <rte_string_fns.h>\n+#include <rte_errno.h>\n \n #include \"eal_private.h\"\n \n@@ -220,7 +221,6 @@ rte_bus_find_by_device_name(const char *str)\n \treturn rte_bus_find(NULL, bus_can_parse, name);\n }\n \n-\n /*\n  * Get iommu class of devices on the bus.\n  */\n@@ -242,3 +242,37 @@ rte_bus_get_iommu_class(void)\n \t}\n \treturn mode;\n }\n+\n+static int\n+bus_handle_sigbus(const struct rte_bus *bus,\n+\t\t\tconst void *failure_addr)\n+{\n+\tint ret;\n+\n+\tret = bus->sigbus_handler(failure_addr);\n+\trte_errno = ret;\n+\n+\treturn !(bus->sigbus_handler && ret <= 0);\n+}\n+\n+int\n+rte_bus_sigbus_handler(const void *failure_addr)\n+{\n+\tstruct rte_bus *bus;\n+\n+\tint ret = 0;\n+\tint old_errno = rte_errno;\n+\trte_errno = 0;\n+\n+\tbus = rte_bus_find(NULL, bus_handle_sigbus, failure_addr);\n+\t/* failed to handle the sigbus, pass the new errno. */\n+\tif (bus && rte_errno == -1)\n+\t\treturn -1;\n+\telse if (!bus)\n+\t\tret = 1;\n+\n+\t/* otherwise restore the old errno. */\n+\trte_errno = old_errno;\n+\n+\treturn ret;\n+}\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex bdadc4d..a91c4b5 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -258,4 +258,16 @@ int rte_mp_channel_init(void);\n  */\n void dev_callback_process(char *device_name, enum rte_dev_event_type event);\n \n+\n+/**\n+ * Iterate all buses to find the corresponding bus, to handle the sigbus error.\n+ * @param failure_addr\n+ *\tPointer of the fault address of the sigbus error.\n+ *\n+ * @return\n+ *\t 0 success to handle the sigbus.\n+ *\t-1 failed to handle the sigbus\n+ *\t 1 no bus can handler the sigbus\n+ */\n+int rte_bus_sigbus_handler(const void *failure_addr);\n #endif /* _EAL_PRIVATE_H_ */\n",
    "prefixes": [
        "V5",
        "5/7"
    ]
}