Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/129803/?format=api
http://patches.dpdk.org/api/patches/129803/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230802031600.23631-2-lihuisong@huawei.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": "<20230802031600.23631-2-lihuisong@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230802031600.23631-2-lihuisong@huawei.com", "date": "2023-08-02T03:15:56", "name": "[RESEND,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": "http://patches.dpdk.org/api/people/2085/?format=api", "name": "lihuisong (C)", "email": "lihuisong@huawei.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230802031600.23631-2-lihuisong@huawei.com/mbox/", "series": [ { "id": 29084, "url": "http://patches.dpdk.org/api/series/29084/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29084", "date": "2023-08-02T03:15:58", "name": "app/testpmd: support multiple process attach and detach port", "version": 6, "mbox": "http://patches.dpdk.org/series/29084/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/129803/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/129803/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 85E7042FB3;\n\tWed, 2 Aug 2023 05:19:13 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 066D643268;\n\tWed, 2 Aug 2023 05:18:52 +0200 (CEST)", "from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])\n by mails.dpdk.org (Postfix) with ESMTP id 8C2074161A\n for <dev@dpdk.org>; Wed, 2 Aug 2023 05:18:45 +0200 (CEST)", "from kwepemm600004.china.huawei.com (unknown [172.30.72.55])\n by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RFxtd3WYtztRlP;\n Wed, 2 Aug 2023 11:15:21 +0800 (CST)", "from localhost.localdomain (10.69.192.56) 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.27; Wed, 2 Aug 2023 11:18: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>, <fengchengwen@huawei.com>,\n <liudongdong3@huawei.com>, <liuyonglong@huawei.com>, <lihuisong@huawei.com>", "Subject": "[PATCH RESEND v6 1/5] drivers/bus: restore driver assignment at front\n of probing", "Date": "Wed, 2 Aug 2023 11:15:56 +0800", "Message-ID": "<20230802031600.23631-2-lihuisong@huawei.com>", "X-Mailer": "git-send-email 2.33.0", "In-Reply-To": "<20230802031600.23631-1-lihuisong@huawei.com>", "References": "<20220825024425.10534-1-lihuisong@huawei.com>\n <20230802031600.23631-1-lihuisong@huawei.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Originating-IP": "[10.69.192.56]", "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>\nAcked-by: Chengwen Feng <fengchengwen@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 29f99342a7..6313684b8f 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 52404ab0fe..c0d9e959ea 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 95f3ad78bc..df63eaeaf9 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": [ "RESEND", "v6", "1/5" ] }{ "id": 129803, "url": "