Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/47875/?format=api
http://patches.dpdk.org/api/patches/47875/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1541484436-91320-3-git-send-email-jia.guo@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": "<1541484436-91320-3-git-send-email-jia.guo@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1541484436-91320-3-git-send-email-jia.guo@intel.com", "date": "2018-11-06T06:07:14", "name": "[2/3] vfio: fix to add handler lock for hot-unplug", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "83b7080676a9ae32fb7a0028abb3c946275e23a1", "submitter": { "id": 507, "url": "http://patches.dpdk.org/api/people/507/?format=api", "name": "Guo, Jia", "email": "jia.guo@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/1541484436-91320-3-git-send-email-jia.guo@intel.com/mbox/", "series": [ { "id": 2286, "url": "http://patches.dpdk.org/api/series/2286/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2286", "date": "2018-11-06T06:07:12", "name": "fix vfio hot-unplug issue", "version": 1, "mbox": "http://patches.dpdk.org/series/2286/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/47875/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/47875/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 CF11D4C92;\n\tTue, 6 Nov 2018 07:03:45 +0100 (CET)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 1C74D31FC\n\tfor <dev@dpdk.org>; Tue, 6 Nov 2018 07:03:43 +0100 (CET)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Nov 2018 22:03:43 -0800", "from jeffguo-s2600wt2.sh.intel.com (HELO localhost.localdomain)\n\t([10.67.110.10])\n\tby fmsmga005.fm.intel.com with ESMTP; 05 Nov 2018 22:03:41 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.54,470,1534834800\"; d=\"scan'208\";a=\"277430830\"", "From": "Jeff Guo <jia.guo@intel.com>", "To": "konstantin.ananyev@intel.com, anatoly.burakov@intel.com,\n\tthomas@monjalon.net, bernard.iremonger@intel.com, jingjing.wu@intel.com, \n\twenzhuo.lu@intel.com", "Cc": "ferruh.yigit@intel.com, dev@dpdk.org, jia.guo@intel.com,\n\thelin.zhang@intel.com, matan@mellanox.com, shaopeng.he@intel.com", "Date": "Tue, 6 Nov 2018 14:07:14 +0800", "Message-Id": "<1541484436-91320-3-git-send-email-jia.guo@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1541484436-91320-1-git-send-email-jia.guo@intel.com>", "References": "<1541484436-91320-1-git-send-email-jia.guo@intel.com>", "Subject": "[dpdk-dev] [PATCH 2/3] vfio: fix to add handler lock for hot-unplug", "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": "This patch add hot-unplug handler lock and unlock in device request\nhandler when process bus and device resource, in order to avoid the\nsynchronization issue when device be hot-unplugged.\n\nFixes: c115fd000c32 (\"vfio: handle hotplug request notifier\")\nSigned-off-by: Jeff Guo <jia.guo@intel.com>\n---\n drivers/bus/pci/linux/pci_vfio.c | 14 +++++++++++++-\n 1 file changed, 13 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex 305cc06..d2c8410 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -19,6 +19,7 @@\n #include <rte_vfio.h>\n #include <rte_eal.h>\n #include <rte_bus.h>\n+#include <rte_spinlock.h>\n \n #include \"eal_filesystem.h\"\n \n@@ -35,6 +36,14 @@\n * This file is only compiled if CONFIG_RTE_EAL_VFIO is set to \"y\".\n */\n \n+/*\n+ * spinlock for device hot-unplug failure handling. If it try to access bus or\n+ * device, such as handle sigbus on bus or handle memory failure for device\n+ * just need to use this lock. It could protect the bus and the device to avoid\n+ * race condition.\n+ */\n+static rte_spinlock_t failure_handle_lock = RTE_SPINLOCK_INITIALIZER;\n+\n #ifdef VFIO_PRESENT\n \n #ifndef PAGE_SIZE\n@@ -289,11 +298,12 @@ pci_vfio_req_handler(void *param)\n \tint ret;\n \tstruct rte_device *device = (struct rte_device *)param;\n \n+\trte_spinlock_lock(&failure_handle_lock);\n \tbus = rte_bus_find_by_device(device);\n \tif (bus == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot find bus for device (%s)\\n\",\n \t\t\tdevice->name);\n-\t\treturn;\n+\t\tgoto handle_end;\n \t}\n \n \t/*\n@@ -306,6 +316,8 @@ pci_vfio_req_handler(void *param)\n \t\tRTE_LOG(ERR, EAL,\n \t\t\t\"Can not handle hot-unplug for device (%s)\\n\",\n \t\t\tdevice->name);\n+handle_end:\n+\trte_spinlock_unlock(&failure_handle_lock);\n }\n \n /* enable notifier (only enable req now) */\n", "prefixes": [ "2/3" ] }{ "id": 47875, "url": "