Show a patch.

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

{
    "id": 42297,
    "url": "http://patches.dpdk.org/api/patches/42297/",
    "web_url": "http://patches.dpdk.org/patch/42297/",
    "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-5-git-send-email-jia.guo@intel.com>",
    "date": "2018-07-05T07:38:51",
    "name": "[V5,4/7] bus/pci: implement sigbus handler operation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "81276a22b162018b4f2600bfbefc7030c01d5482",
    "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/42297/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/42297/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42297/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 DCB601BE9D;\n\tThu,  5 Jul 2018 09:41:18 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id B95641BEB3\n\tfor <dev@dpdk.org>; Thu,  5 Jul 2018 09:41:16 +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:16 -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:13 -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-5-git-send-email-jia.guo@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,311,1526367600\"; d=\"scan'208\";a=\"52144064\"",
        "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:51 +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 4/7] bus/pci: implement sigbus handler\n\toperation"
    },
    "content": "This patch implements the ops of sigbus handler for PCI bus, it is\nfunctional to find the corresponding pci device which is be hotplug out.\nand then handle the hotplug failure for this device.\n\nSigned-off-by: Jeff Guo <jia.guo@intel.com>\n---\nv5->v4:\nno change\n---\n drivers/bus/pci/pci_common.c | 49 ++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 49 insertions(+)",
    "diff": "diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex bc3bcac..f065271 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -407,6 +407,32 @@ pci_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,\n \treturn NULL;\n }\n \n+/* check the failure address belongs to which device. */\n+static struct rte_pci_device *\n+pci_find_device_by_addr(const void *failure_addr)\n+{\n+\tstruct rte_pci_device *pdev = NULL;\n+\tint i;\n+\n+\tFOREACH_DEVICE_ON_PCIBUS(pdev) {\n+\t\tfor (i = 0; i != RTE_DIM(pdev->mem_resource); i++) {\n+\t\t\tif ((uint64_t)(uintptr_t)failure_addr >=\n+\t\t\t    (uint64_t)(uintptr_t)pdev->mem_resource[i].addr &&\n+\t\t\t    (uint64_t)(uintptr_t)failure_addr <\n+\t\t\t    (uint64_t)(uintptr_t)pdev->mem_resource[i].addr +\n+\t\t\t    pdev->mem_resource[i].len) {\n+\t\t\t\tRTE_LOG(INFO, EAL, \"Failure address \"\n+\t\t\t\t\t\"%16.16\"PRIx64\" belongs to \"\n+\t\t\t\t\t\"device %s!\\n\",\n+\t\t\t\t\t(uint64_t)(uintptr_t)failure_addr,\n+\t\t\t\t\tpdev->device.name);\n+\t\t\t\treturn pdev;\n+\t\t\t}\n+\t\t}\n+\t}\n+\treturn NULL;\n+}\n+\n static int\n pci_hotplug_failure_handler(struct rte_device *dev)\n {\n@@ -435,6 +461,28 @@ pci_hotplug_failure_handler(struct rte_device *dev)\n }\n \n static int\n+pci_sigbus_handler(const void *failure_addr)\n+{\n+\tstruct rte_pci_device *pdev = NULL;\n+\tint ret = 0;\n+\n+\tpdev = pci_find_device_by_addr(failure_addr);\n+\tif (!pdev) {\n+\t\t/* It is a generic sigbus error, no bus would handle it. */\n+\t\tret = 1;\n+\t} else {\n+\t\t/* The sigbus error is caused of hot removal. */\n+\t\tret = pci_hotplug_failure_handler(&pdev->device);\n+\t\tif (ret) {\n+\t\t\tRTE_LOG(ERR, EAL, \"Failed to handle hot plug for \"\n+\t\t\t\t\"device %s\", pdev->name);\n+\t\t\tret = -1;\n+\t\t}\n+\t}\n+\treturn ret;\n+}\n+\n+static int\n pci_plug(struct rte_device *dev)\n {\n \treturn pci_probe_all_drivers(RTE_DEV_TO_PCI(dev));\n@@ -465,6 +513,7 @@ struct rte_pci_bus rte_pci_bus = {\n \t\t.parse = pci_parse,\n \t\t.get_iommu_class = rte_pci_get_iommu_class,\n \t\t.hotplug_failure_handler = pci_hotplug_failure_handler,\n+\t\t.sigbus_handler = pci_sigbus_handler,\n \t},\n \t.device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list),\n \t.driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),\n",
    "prefixes": [
        "V5",
        "4/7"
    ]
}