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 E1A1711D4 for ; Tue, 22 May 2018 11:20:12 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 56FFB21B2A; Tue, 22 May 2018 05:20:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 22 May 2018 05:20:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=QWkMD6ce5mdyarxP54iEZFlUcW m7l2m4ggH0mp/tPOc=; b=JlX4jL30hfvm5XRb1k6+DVUMSH2+B/Z+VYiLn3vInt vjBLbP0vCwzjHEx6CK2uclkcwPqAPa2MZTSvw09dIYmV6C/K1Sa7QjlE57r75lEa TLo2kPzxQopas2cxyHL+lTwhkyrO2lGFWdX53ZN+Rn8sAm9s+HPBXAxQr6gY4Y3b 0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=QWkMD6 ce5mdyarxP54iEZFlUcWm7l2m4ggH0mp/tPOc=; b=K2D/wulFgMkI344cytHr7I oZ07az6DCGApqieJ7aNKY41UcJ+Yh45Ubf0irDiJ/iUWkjl3/+gbx/RG/+HNxeqi YwvzC+WMwwb3xGA1awg1ymBHMU/22cnk5P6XNEBMNpP6H6muhihFMPVTN9nI4wSu T3YcabL8Arvstpd34SXHC2hSVEttHGVhRfl1Yh1xoTrLF3qQiiEhVJSwoRHwmtlb H83DW2Q6Zd+ANx3Ly9lEqipThDwvNFnmYWVtWrK4HBLUlknv0n+bPs3piQOrRoQQ 28+WGzJhJtuWcHzYITfCVNrTHViJYvxA/QquYJEi1ZtOCvioMVjmiMzLK765ymyA == X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 95C18E4434; Tue, 22 May 2018 05:20:11 -0400 (EDT) From: Thomas Monjalon To: "Burakov, Anatoly" Cc: dev@dpdk.org, matan@mellanox.com, ferruh.yigit@intel.com Date: Tue, 22 May 2018 11:20:10 +0200 Message-ID: <2833093.uzJjkH71XI@xps> In-Reply-To: <8f0eb83d-5090-c7c8-5c3d-c4eecb96e596@intel.com> References: <20180521161156.25724-1-thomas@monjalon.net> <8f0eb83d-5090-c7c8-5c3d-c4eecb96e596@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [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: Tue, 22 May 2018 09:20:13 -0000 22/05/2018 11:05, Burakov, Anatoly: > On 21-May-18 5:11 PM, Thomas Monjalon wrote: > > 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 > > Without that lock, all of this would be racy - find_dev would iterate a > tailq that might change under its feet, and tailq_remove may be called > with a pointer that has already been removed. > > How about changing the lock to a recursive lock? Failsafe would be > removing devices from within the same thread, correct? Yes it could work. I will give it a try.