From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 7261D1B1C7 for ; Mon, 21 May 2018 18:12:05 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 08A4B22360; Mon, 21 May 2018 12:12:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 21 May 2018 12:12:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=mesmtp; bh=whg0DDgTVUF3OnqDCJJ1qP2L4kKDlRUz+OZ/xL QChqA=; b=CtWrsm07+7P3TAYn2ksx/W529i0Y5baVufsmXFTD2Zml4crFFPgxSs muow2j+pyrcQCk6QWRqPqW/cO8vv3he9kJTsfuQ0nnLxTF50BX3k6veCCik9nzuR 8NOXShd+bLfCxsYXqnpmaXB2SedOUNqHzpCNRwjPRdMdmazVG4u+I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=whg0DDgTVUF3OnqDC JJ1qP2L4kKDlRUz+OZ/xLQChqA=; b=CPWUAzazZMwB4+X2oIMrX3smqfdSJhzOh 2BC7wVAg4oCM600VwKY7w2578NuqArGvDKdwDT85nG4r91dDVTFNUnAtMV7dNHNG TPgFPhwOeZ2ZuQXfZTvdVNTXocD1G/ae9EnmtvBd6YY4N/vFaX4//H2gy4z6/SDO Oi/UfC7Rr6/NA2tzeeP7Pe+vchq5e46OkUE7Hxt58M2LSlkzobecW1Qn4fZMgOMb By/maBGFgo+aEwFCBjrAa1VwvCPJGpPrxNHF0BnG9xBdkz6wnlgaebCO/ZYA9sO1 cpxmzNieXtPKnUx3Zi8LObOBP0Tq3y5OCP76R33eM+ZsaE1lReVwQ== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from xps.monjalon.net (236.204.154.77.rev.sfr.net [77.154.204.236]) by mail.messagingengine.com (Postfix) with ESMTPA id 8945C1025E; Mon, 21 May 2018 12:12:03 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: matan@mellanox.com, ferruh.yigit@intel.com Date: Mon, 21 May 2018 18:11:56 +0200 Message-Id: <20180521161156.25724-1-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 Subject: [dpdk-dev] [PATCH] bus/vdev: reduce scope of device list lock X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 16:12:05 -0000 The lock vdev_device_list_lock was taken before calling "remove" function for the device. So it prevents to remove sub-devices (as in failsafe) inside its own "remove" function, because of a deadlock. The lock is now only protecting the device list inside the bus driver. Fixes: 35f462839b69 ("bus/vdev: add lock on device list") Signed-off-by: Thomas Monjalon --- drivers/bus/vdev/vdev.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 099b9ff85..2fbc86806 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -293,25 +293,23 @@ rte_vdev_uninit(const char *name) if (name == NULL) return -EINVAL; - rte_spinlock_lock(&vdev_device_list_lock); - dev = find_vdev(name); if (!dev) { ret = -ENOENT; - goto unlock; + return ret; } ret = vdev_remove_driver(dev); if (ret) - goto unlock; + return ret; + rte_spinlock_lock(&vdev_device_list_lock); TAILQ_REMOVE(&vdev_device_list, dev, next); devargs = dev->device.devargs; rte_devargs_remove(devargs->bus->name, devargs->name); free(dev); - -unlock: rte_spinlock_unlock(&vdev_device_list_lock); + return ret; } -- 2.16.2