Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/42974/?format=api
http://patches.dpdk.org/api/patches/42974/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180712140144.18146-2-qi.z.zhang@intel.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": "<20180712140144.18146-2-qi.z.zhang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180712140144.18146-2-qi.z.zhang@intel.com", "date": "2018-07-12T14:01:41", "name": "[1/4] eal: fix hotplug add and hotplug remove", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "eae7ce9c2edc39a1a490506d39ed5917c5a5afca", "submitter": { "id": 504, "url": "http://patches.dpdk.org/api/people/504/?format=api", "name": "Qi Zhang", "email": "qi.z.zhang@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180712140144.18146-2-qi.z.zhang@intel.com/mbox/", "series": [ { "id": 549, "url": "http://patches.dpdk.org/api/series/549/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=549", "date": "2018-07-12T14:01:40", "name": "couple hotplug fix", "version": 1, "mbox": "http://patches.dpdk.org/series/549/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/42974/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/42974/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 4B1801B450;\n\tThu, 12 Jul 2018 16:01:12 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 834C71B443;\n\tThu, 12 Jul 2018 16:01:08 +0200 (CEST)", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t12 Jul 2018 07:01:07 -0700", "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga008.jf.intel.com with ESMTP; 12 Jul 2018 07:01:06 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,343,1526367600\"; d=\"scan'208\";a=\"56361024\"", "From": "Qi Zhang <qi.z.zhang@intel.com>", "To": "thomas@monjalon.net, anatoly.burakov@intel.com, gaetan.rivet@6wind.com", "Cc": "dev@dpdk.org,\n\tQi Zhang <qi.z.zhang@intel.com>,\n\tstable@dpdk.org", "Date": "Thu, 12 Jul 2018 22:01:41 +0800", "Message-Id": "<20180712140144.18146-2-qi.z.zhang@intel.com>", "X-Mailer": "git-send-email 2.13.6", "In-Reply-To": "<20180712140144.18146-1-qi.z.zhang@intel.com>", "References": "<20180712140144.18146-1-qi.z.zhang@intel.com>", "Subject": "[dpdk-dev] [PATCH 1/4] eal: fix hotplug add and hotplug remove", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "If hotplug add an already plugged PCI device, it will\ncause rte_pci_device->device.name be corrupted due to unexpected\nrte_devargs_remove. Also if try to hotplug remove an already\nunplugged device, it will cause segment fault due to unexpected\nbus->unplug on a rte_device whose driver is NULL.\nThe patch fix these issues.\n\nFixes: 7e8b26650146 (\"eal: fix hotplug add / remove\")\nCc: stable@dpdk.org\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n lib/librte_eal/common/eal_common_dev.c | 26 ++++++++++++--------------\n 1 file changed, 12 insertions(+), 14 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c\nindex 61cb3b162..0fa8c815d 100644\n--- a/lib/librte_eal/common/eal_common_dev.c\n+++ b/lib/librte_eal/common/eal_common_dev.c\n@@ -42,18 +42,6 @@ static struct dev_event_cb_list dev_event_cbs;\n /* spinlock for device callbacks */\n static rte_spinlock_t dev_event_lock = RTE_SPINLOCK_INITIALIZER;\n \n-static int cmp_detached_dev_name(const struct rte_device *dev,\n-\tconst void *_name)\n-{\n-\tconst char *name = _name;\n-\n-\t/* skip attached devices */\n-\tif (dev->driver != NULL)\n-\t\treturn 1;\n-\n-\treturn strcmp(dev->name, name);\n-}\n-\n static int cmp_dev_name(const struct rte_device *dev, const void *_name)\n {\n \tconst char *name = _name;\n@@ -151,14 +139,19 @@ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devn\n \tif (ret)\n \t\tgoto err_devarg;\n \n-\tdev = bus->find_device(NULL, cmp_detached_dev_name, devname);\n+\tdev = bus->find_device(NULL, cmp_dev_name, devname);\n \tif (dev == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"Cannot find unplugged device (%s)\\n\",\n+\t\tRTE_LOG(ERR, EAL, \"Cannot find device (%s)\\n\",\n \t\t\tdevname);\n \t\tret = -ENODEV;\n \t\tgoto err_devarg;\n \t}\n \n+\tif (dev->driver != NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Device is already plugged\\n\");\n+\t\treturn -EEXIST;\n+\t}\n+\n \tret = bus->plug(dev);\n \tif (ret) {\n \t\tRTE_LOG(ERR, EAL, \"Driver cannot attach the device (%s)\\n\",\n@@ -200,6 +193,11 @@ rte_eal_hotplug_remove(const char *busname, const char *devname)\n \t\treturn -EINVAL;\n \t}\n \n+\tif (dev->driver == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Device is already unplugged\\n\");\n+\t\treturn -ENOENT;\n+\t}\n+\n \tret = bus->unplug(dev);\n \tif (ret)\n \t\tRTE_LOG(ERR, EAL, \"Driver cannot detach the device (%s)\\n\",\n", "prefixes": [ "1/4" ] }{ "id": 42974, "url": "