get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127590,
    "url": "https://patches.dpdk.org/api/patches/127590/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230527021121.31647-2-lihuisong@huawei.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20230527021121.31647-2-lihuisong@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230527021121.31647-2-lihuisong@huawei.com",
    "date": "2023-05-27T02:11:17",
    "name": "[V6,1/5] drivers/bus: restore driver assignment at front of probing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "79ff6ef6a0951073003a1a1dd64eed4618ef9e2e",
    "submitter": {
        "id": 2085,
        "url": "https://patches.dpdk.org/api/people/2085/?format=api",
        "name": "lihuisong (C)",
        "email": "lihuisong@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230527021121.31647-2-lihuisong@huawei.com/mbox/",
    "series": [
        {
            "id": 28215,
            "url": "https://patches.dpdk.org/api/series/28215/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=28215",
            "date": "2023-05-27T02:11:19",
            "name": "app/testpmd: support multiple process attach and detach port",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/28215/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/127590/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/127590/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 8AA3142BB0;\n\tSat, 27 May 2023 04:13:52 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2059E42B8C;\n\tSat, 27 May 2023 04:13:48 +0200 (CEST)",
            "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id 4AFA540DFB\n for <dev@dpdk.org>; Sat, 27 May 2023 04:13:45 +0200 (CEST)",
            "from kwepemm600004.china.huawei.com (unknown [172.30.72.55])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QSld154QXzLq4l;\n Sat, 27 May 2023 10:10:45 +0800 (CST)",
            "from localhost.localdomain (10.28.79.22) by\n kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.23; Sat, 27 May 2023 10:13:42 +0800"
        ],
        "From": "Huisong Li <lihuisong@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<thomas@monjalon.net>, <ferruh.yigit@amd.com>,\n <andrew.rybchenko@oktetlabs.ru>, <liudongdong3@huawei.com>,\n <liuyonglong@huawei.com>, <fengchengwen@huawei.com>, <lihuisong@huawei.com>",
        "Subject": "[PATCH V6 1/5] drivers/bus: restore driver assignment at front of\n probing",
        "Date": "Sat, 27 May 2023 10:11:17 +0800",
        "Message-ID": "<20230527021121.31647-2-lihuisong@huawei.com>",
        "X-Mailer": "git-send-email 2.22.0",
        "In-Reply-To": "<20230527021121.31647-1-lihuisong@huawei.com>",
        "References": "<20220825024425.10534-1-lihuisong@huawei.com>\n <20230527021121.31647-1-lihuisong@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.28.79.22]",
        "X-ClientProxiedBy": "dggems704-chm.china.huawei.com (10.3.19.181) To\n kwepemm600004.china.huawei.com (7.193.23.242)",
        "X-CFilter-Loop": "Reflected",
        "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"
    },
    "content": "The driver assignment was moved back at the end of the device probing\nbecause there is no something to use rte_driver during the phase of\nprobing. See commit 391797f04208 (\"drivers/bus: move driver assignment\nto end of probing\")\n\nHowever, it is necessary for probing callback to reference rte_driver\nbefore probing. For example, probing callback may call some APIs which\naccess the rte_pci_driver::driver by the device::driver pointer to get\ndriver information. In this case, a segment fault will occur in probing\ncallback if there is not this assignment.\n\nFurther, some comments in code need to be updated if we do that. The\ndriver pointer in rte_device is set before probing and needs to be reset\nif probing failed. And rte_dev_is_probed can not be called inside probing.\n\nFixes: 391797f04208 (\"drivers/bus: move driver assignment to end of probing\")\nCc: stable@dpdk.org\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\n---\n drivers/bus/auxiliary/auxiliary_common.c |  9 +++++++--\n drivers/bus/dpaa/dpaa_bus.c              |  9 +++++++--\n drivers/bus/fslmc/fslmc_bus.c            |  8 +++++++-\n drivers/bus/ifpga/ifpga_bus.c            | 12 +++++++++---\n drivers/bus/pci/pci_common.c             |  9 +++++++--\n drivers/bus/vdev/vdev.c                  | 10 ++++++++--\n drivers/bus/vmbus/vmbus_common.c         |  9 +++++++--\n 7 files changed, 52 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c\nindex ff1369353a..13cb3fe0f8 100644\n--- a/drivers/bus/auxiliary/auxiliary_common.c\n+++ b/drivers/bus/auxiliary/auxiliary_common.c\n@@ -132,16 +132,21 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv,\n \t}\n \n \tdev->driver = drv;\n+\t/*\n+\t * Reference rte_driver before probing so as to this pointer can\n+\t * be used to get driver information in case of segment fault in\n+\t * probing callback.\n+\t */\n+\tdev->device.driver = &drv->driver;\n \n \tAUXILIARY_LOG(INFO, \"Probe auxiliary driver: %s device: %s (NUMA node %i)\",\n \t\t      drv->driver.name, dev->name, dev->device.numa_node);\n \tret = drv->probe(drv, dev);\n \tif (ret != 0) {\n \t\tdev->driver = NULL;\n+\t\tdev->device.driver = NULL;\n \t\trte_intr_instance_free(dev->intr_handle);\n \t\tdev->intr_handle = NULL;\n-\t} else {\n-\t\tdev->device.driver = &drv->driver;\n \t}\n \n \treturn ret;\ndiff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c\nindex e57159f5d8..f1b817e58c 100644\n--- a/drivers/bus/dpaa/dpaa_bus.c\n+++ b/drivers/bus/dpaa/dpaa_bus.c\n@@ -693,17 +693,22 @@ rte_dpaa_bus_probe(void)\n \t\t\t    (dev->device.devargs &&\n \t\t\t     dev->device.devargs->policy == RTE_DEV_BLOCKED))\n \t\t\t\tcontinue;\n-\n+\t\t\t/*\n+\t\t\t * Reference rte_driver before probing so as to this\n+\t\t\t * pointer can be used to get driver information in case\n+\t\t\t * of segment fault in probing callback.\n+\t\t\t */\n+\t\t\tdev->device.driver = &drv->driver;\n \t\t\tif (probe_all ||\n \t\t\t    (dev->device.devargs &&\n \t\t\t     dev->device.devargs->policy == RTE_DEV_ALLOWED)) {\n \t\t\t\tret = drv->probe(drv, dev);\n \t\t\t\tif (ret) {\n+\t\t\t\t\tdev->device.driver = NULL;\n \t\t\t\t\tDPAA_BUS_ERR(\"unable to probe:%s\",\n \t\t\t\t\t\t     dev->name);\n \t\t\t\t} else {\n \t\t\t\t\tdev->driver = drv;\n-\t\t\t\t\tdev->device.driver = &drv->driver;\n \t\t\t\t}\n \t\t\t}\n \t\t\tbreak;\ndiff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c\nindex 57bfb5111a..4bc0c6d3d4 100644\n--- a/drivers/bus/fslmc/fslmc_bus.c\n+++ b/drivers/bus/fslmc/fslmc_bus.c\n@@ -471,15 +471,21 @@ rte_fslmc_probe(void)\n \t\t\t\tcontinue;\n \t\t\t}\n \n+\t\t\t/*\n+\t\t\t * Reference rte_driver before probing so as to this\n+\t\t\t * pointer can be used to get driver information in case\n+\t\t\t * of segment fault in probing callback.\n+\t\t\t */\n+\t\t\tdev->device.driver = &drv->driver;\n \t\t\tif (probe_all ||\n \t\t\t   (dev->device.devargs &&\n \t\t\t    dev->device.devargs->policy == RTE_DEV_ALLOWED)) {\n \t\t\t\tret = drv->probe(drv, dev);\n \t\t\t\tif (ret) {\n+\t\t\t\t\tdev->device.driver = NULL;\n \t\t\t\t\tDPAA2_BUS_ERR(\"Unable to probe\");\n \t\t\t\t} else {\n \t\t\t\t\tdev->driver = drv;\n-\t\t\t\t\tdev->device.driver = &drv->driver;\n \t\t\t\t}\n \t\t\t}\n \t\t\tbreak;\ndiff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c\nindex ffb0c61214..bfe7077645 100644\n--- a/drivers/bus/ifpga/ifpga_bus.c\n+++ b/drivers/bus/ifpga/ifpga_bus.c\n@@ -294,13 +294,19 @@ ifpga_probe_one_driver(struct rte_afu_driver *drv,\n \n \t/* reference driver structure */\n \tafu_dev->driver = drv;\n+\t/*\n+\t * Reference rte_driver before probing so as to this pointer can\n+\t * be used to get driver information in case of segment fault in\n+\t * probing callback.\n+\t */\n+\tafu_dev->device.driver = &drv->driver;\n \n \t/* call the driver probe() function */\n \tret = drv->probe(afu_dev);\n-\tif (ret)\n+\tif (ret) {\n \t\tafu_dev->driver = NULL;\n-\telse\n-\t\tafu_dev->device.driver = &drv->driver;\n+\t\tafu_dev->device.driver = NULL;\n+\t}\n \n \treturn ret;\n }\ndiff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex e32a9d517a..ad3ab9e797 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -302,6 +302,12 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,\n \t\t\t\treturn ret;\n \t\t\t}\n \t\t}\n+\t\t/*\n+\t\t * Reference rte_driver before probing so as to this pointer can\n+\t\t * be used to get driver information in case of segment fault in\n+\t\t * probing callback.\n+\t\t */\n+\t\tdev->device.driver = &dr->driver;\n \t}\n \n \tRTE_LOG(INFO, EAL, \"Probe PCI driver: %s (%x:%x) device: \"PCI_PRI_FMT\" (socket %i)\\n\",\n@@ -314,6 +320,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,\n \t\treturn ret; /* no rollback if already succeeded earlier */\n \tif (ret) {\n \t\tdev->driver = NULL;\n+\t\tdev->device.driver = NULL;\n \t\tif ((dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) &&\n \t\t\t/* Don't unmap if device is unsupported and\n \t\t\t * driver needs mapped resources.\n@@ -325,8 +332,6 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,\n \t\tdev->vfio_req_intr_handle = NULL;\n \t\trte_intr_instance_free(dev->intr_handle);\n \t\tdev->intr_handle = NULL;\n-\t} else {\n-\t\tdev->device.driver = &dr->driver;\n \t}\n \n \treturn ret;\ndiff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c\nindex 7974b27295..286ba1fbf9 100644\n--- a/drivers/bus/vdev/vdev.c\n+++ b/drivers/bus/vdev/vdev.c\n@@ -207,9 +207,15 @@ vdev_probe_all_drivers(struct rte_vdev_device *dev)\n \t\treturn -1;\n \t}\n \n+\t/*\n+\t * Reference rte_driver before probing so as to this pointer can\n+\t * be used to get driver information in case of segment fault in\n+\t * probing callback.\n+\t */\n+\tdev->device.driver = &driver->driver;\n \tret = driver->probe(dev);\n-\tif (ret == 0)\n-\t\tdev->device.driver = &driver->driver;\n+\tif (ret != 0)\n+\t\tdev->device.driver = NULL;\n \treturn ret;\n }\n \ndiff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c\nindex 8d32d66504..feb1651984 100644\n--- a/drivers/bus/vmbus/vmbus_common.c\n+++ b/drivers/bus/vmbus/vmbus_common.c\n@@ -110,6 +110,12 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,\n \n \t/* reference driver structure */\n \tdev->driver = dr;\n+\t/*\n+\t * Reference rte_driver before probing so as to this pointer can\n+\t * be used to get driver information in case of segment fault in\n+\t * probing callback.\n+\t */\n+\tdev->device.driver = &dr->driver;\n \n \tif (dev->device.numa_node < 0 && rte_socket_count() > 1)\n \t\tVMBUS_LOG(INFO, \"Device %s is not NUMA-aware\", guid);\n@@ -119,9 +125,8 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,\n \tret = dr->probe(dr, dev);\n \tif (ret) {\n \t\tdev->driver = NULL;\n+\t\tdev->device.driver = NULL;\n \t\trte_vmbus_unmap_device(dev);\n-\t} else {\n-\t\tdev->device.driver = &dr->driver;\n \t}\n \n \treturn ret;\n",
    "prefixes": [
        "V6",
        "1/5"
    ]
}