Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/39546/?format=api
https://patches.dpdk.org/api/patches/39546/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180509094337.26112-8-thomas@monjalon.net/", "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": "<20180509094337.26112-8-thomas@monjalon.net>", "list_archive_url": "https://inbox.dpdk.org/dev/20180509094337.26112-8-thomas@monjalon.net", "date": "2018-05-09T09:43:33", "name": "[dpdk-dev,07/11] ethdev: add lock to port allocation check", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "93ef13b6fdfb5474699c90a75e74a9ad699861a1", "submitter": { "id": 685, "url": "https://patches.dpdk.org/api/people/685/?format=api", "name": "Thomas Monjalon", "email": "thomas@monjalon.net" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180509094337.26112-8-thomas@monjalon.net/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/39546/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/39546/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 0F41AEE33;\n\tWed, 9 May 2018 11:44:03 +0200 (CEST)", "from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com\n\t[66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 77D8BAABE;\n\tWed, 9 May 2018 11:43:50 +0200 (CEST)", "from compute1.internal (compute1.nyi.internal [10.202.2.41])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 244DE22581;\n\tWed, 9 May 2018 05:43:50 -0400 (EDT)", "from mailfrontend1 ([10.202.2.162])\n\tby compute1.internal (MEProxy); Wed, 09 May 2018 05:43:50 -0400", "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id 64420E508F;\n\tWed, 9 May 2018 05:43:49 -0400 (EDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n\tcc:date:from:in-reply-to:message-id:references:subject:to\n\t:x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=uZ/g3UiDaJzeLy\n\tVJBuSRf1yifcYuatvIyjWBYakPNF0=; b=nohIMAXls9YHzHXHClzujIueZkHu0+\n\t3If+o1Vd4PxtE6i+zkYrL7gF3q1rWyTnkOPTtuqMEZ25oPRGx8dJRddSxX/a8yIz\n\t6vUtiUUQqbm9wLS/MUcP6oDcZAntIhwBMtek2g2bEWYdVivohKsjV40MxUNk+JYV\n\tSZ1qY0icgifCI=", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:date:from:in-reply-to:message-id\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=\n\tfm2; bh=uZ/g3UiDaJzeLyVJBuSRf1yifcYuatvIyjWBYakPNF0=; b=X7CBoThS\n\t2ciJavLV4B62lDh98GSVMb74IF1EoTPCVpckcLaqukgagVUYdyHAMFED5QbXIw2q\n\tdIArZJfZ9n5SaNJzeDVjUCFzqtkPPBJSezC05KBs0g0snMW4TqfHr1fXZAcsllVU\n\tTtidWCT73S3IXy57kDe1feUE3f8RyzubXm3sIiRrUvX9nl+gAdFjgVjTCU6xplnu\n\txoF6pQYnG6EU8Ybyl5Xu5YPTAJB85uLx+V76ZGtGH2disKmnK3cF52w2ypLi1nbp\n\tt8x9q3O5+AZvBx8/x9yzCJnDzlOG7TYwZp4EI1a6XD7T+d1HgmXvK2b3JOP3liKu\n\tUMOxsaiIYlCydA==" ], "X-ME-Sender": "<xms:1sLyWgw2M2eYpydVt0ZyylizoASVXUHib6uB6hS2LitWGNLl5x1QDw>", "From": "Thomas Monjalon <thomas@monjalon.net>", "To": "dev@dpdk.org", "Cc": "Matan Azrad <matan@mellanox.com>,\n\tstable@dpdk.org", "Date": "Wed, 9 May 2018 11:43:33 +0200", "Message-Id": "<20180509094337.26112-8-thomas@monjalon.net>", "X-Mailer": "git-send-email 2.16.2", "In-Reply-To": "<20180509094337.26112-1-thomas@monjalon.net>", "References": "<20180509094337.26112-1-thomas@monjalon.net>", "Subject": "[dpdk-dev] [PATCH 07/11] ethdev: add lock to port allocation check", "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Matan Azrad <matan@mellanox.com>\n\nWhen comparing the port name, there can be a race condition with\na thread allocating a new port and writing the name at the same time.\nIt can lead to match with a partial name by error.\n\nThe check of the port is now considered as a critical section\nprotected with locks.\n\nThis fix will be even more required for multi-process when the\nport availability will rely only on the name, in a following patch.\n\nFixes: 84934303a17c (\"ethdev: synchronize port allocation\")\nCc: stable@dpdk.org\n\nSigned-off-by: Matan Azrad <matan@mellanox.com>\nAcked-by: Thomas Monjalon <thomas@monjalon.net>\n---\n lib/librte_ethdev/rte_ethdev.c | 22 +++++++++++++++++++---\n 1 file changed, 19 insertions(+), 3 deletions(-)", "diff": "diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex ae86d0ba7..357be2dca 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -227,8 +227,8 @@ rte_eth_dev_shared_data_prepare(void)\n \trte_spinlock_unlock(&rte_eth_shared_data_lock);\n }\n \n-struct rte_eth_dev *\n-rte_eth_dev_allocated(const char *name)\n+static struct rte_eth_dev *\n+rte_eth_dev_allocated_lock_free(const char *name)\n {\n \tunsigned i;\n \n@@ -240,6 +240,22 @@ rte_eth_dev_allocated(const char *name)\n \treturn NULL;\n }\n \n+struct rte_eth_dev *\n+rte_eth_dev_allocated(const char *name)\n+{\n+\tstruct rte_eth_dev *ethdev;\n+\n+\trte_eth_dev_shared_data_prepare();\n+\n+\trte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);\n+\n+\tethdev = rte_eth_dev_allocated_lock_free(name);\n+\n+\trte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);\n+\n+\treturn ethdev;\n+}\n+\n static uint16_t\n rte_eth_dev_find_free_port(void)\n {\n@@ -286,7 +302,7 @@ rte_eth_dev_allocate(const char *name)\n \t\tgoto unlock;\n \t}\n \n-\tif (rte_eth_dev_allocated(name) != NULL) {\n+\tif (rte_eth_dev_allocated_lock_free(name) != NULL) {\n \t\tethdev_log(ERR,\n \t\t\t\"Ethernet Device with name %s already allocated!\",\n \t\t\tname);\n", "prefixes": [ "dpdk-dev", "07/11" ] }{ "id": 39546, "url": "