From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7EF34A0096 for ; Fri, 12 Apr 2019 10:11:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D769554AE; Fri, 12 Apr 2019 10:11:26 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 402775323 for ; Fri, 12 Apr 2019 10:11:24 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190412081123euoutp01d2649a58641cf0be069cbb2903278ba7~Uq9CmC9500899208992euoutp01D for ; Fri, 12 Apr 2019 08:11:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190412081123euoutp01d2649a58641cf0be069cbb2903278ba7~Uq9CmC9500899208992euoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555056684; bh=wGJyHY9n2DIaFt1cN5zKTnjGi7pSR+ozcbQfQtH/By4=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=jes6FOsgh47A4Y2F18+KCJ7eihTWatWQrA1blQM33vgECEvKdRBC3mU9Lm7qMFgOf u+qnj1VmKexXKyTGX16W1MwOFmOD4qDC8BeOSchF4an7y3j2B52q37wEFuXQmk7Gqy tdmqRWHrV6tOy1D2WvjW7Pa96S2zVh/PiqNbI6e8= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190412081123eucas1p1163a50f0d3e9555dd1c8dd22847b360c~Uq9CHB_W72007420074eucas1p1m; Fri, 12 Apr 2019 08:11:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 3D.5A.04377.B2840BC5; Fri, 12 Apr 2019 09:11:23 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190412081122eucas1p1abcf54925245060e7fc13ac6eb950874~Uq9BXGOdi2007420074eucas1p1l; Fri, 12 Apr 2019 08:11:22 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190412081122eusmtrp268cd64daac9bb9bc24eefbb3114fcdac~Uq9BJCtVH1828018280eusmtrp2x; Fri, 12 Apr 2019 08:11:22 +0000 (GMT) X-AuditID: cbfec7f4-5632c9c000001119-3a-5cb0482b5271 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id BE.C2.04146.A2840BC5; Fri, 12 Apr 2019 09:11:22 +0100 (BST) Received: from [106.109.129.180] (unknown [106.109.129.180]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190412081121eusmtip118a0a121e72e03b8a3f2959767a96b0e~Uq9Aq1gfx1576515765eusmtip1o; Fri, 12 Apr 2019 08:11:21 +0000 (GMT) To: Tiwei Bie Cc: dev@dpdk.org, Maxime Coquelin , Jens Freimann , Dariusz Stojaczyk , David Marchand , stable@dpdk.org From: Ilya Maximets Message-ID: Date: Fri, 12 Apr 2019 11:11:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190412043938.GB15935@dpdk-tbie.sh.intel.com> Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLKsWRmVeSWpSXmKPExsWy7djPc7raHhtiDB4/5LRYtr+VxWL7ii42 i3eftjNZXGn/yW5xbs1SFotjnXtYLP51/GG32Nrwn8mBw+PXgqWsHov3vGTyeL/vKptH35ZV jAEsUVw2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XKD6YuRi4OIYGljBJ9z3oYIRJSEj9+XWCFsIUl /lzrYoMoes8o8Wf/JRaQhLCAj8Sf84vAikQElCW+nZnJClLELHCTUWLaq2VQYw8ySpxc/pAJ pIpNQEfi1OojYCt4Bewktp96C9bNIqAqcfXpRDYQW1QgQuLM+xUsEDWCEidnPgGzOQVsJD5e bAerZxZQl/gz7xIzhC0u0fRlJVRcXmL72znMExiFZiFpn4WkZRaSlllIWhYwsqxiFEktLc5N zy021CtOzC0uzUvXS87P3cQIjL1tx35u3sF4aWPwIUYBDkYlHt4Aq/UxQqyJZcWVuYcYJTiY lUR4Q1iAQrwpiZVVqUX58UWlOanFhxhNgZ6byCwlmpwPTAt5JfGGpobmFpaG5sbmxmYWSuK8 5w0qo4QE0hNLUrNTUwtSi2D6mDg4pRoY206u8hJttUqWt8iaHnl7d3Lon30sIhu7lO9WCwSU WKg2ftlukLxxc1lkwLw1C3OZbPwv/Ipd+KTgicfnl8wBv5+oLikSKGbmd1zluF7qmMqO7DXL G9bqrXPm3CYzVWU37zYn8TU13y7ciFvzp47/T2tu1hO9sPzilartf60DX9R0z/rO851ZiaU4 I9FQi7moOBEAi/XKidMCAAA= X-CMS-MailID: 20190412081122eucas1p1abcf54925245060e7fc13ac6eb950874 X-Msg-Generator: CA Content-Type: text/plain; charset="UTF-8" X-RootMTR: 20190409133629eucas1p2ecfe7c4771bb6add694596cf75cf3e70 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190409133629eucas1p2ecfe7c4771bb6add694596cf75cf3e70 References: <20190409133622.14729-1-i.maximets@samsung.com> <20190412043938.GB15935@dpdk-tbie.sh.intel.com> Subject: Re: [dpdk-dev] [PATCH] vhost: fix passing destroyed device to destroy callback 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190412081121.Q6Qade8wybbovv9FozcehDhWvn2eRRlCzJZXRX5pHdw@z> On 12.04.2019 7:39, Tiwei Bie wrote: > On Tue, Apr 09, 2019 at 04:36:22PM +0300, Ilya Maximets wrote: >> Application should be able to obtain information like 'ifname' from >> the 'vid' passed to 'destroy_connection' callback. Currently, all the >> API calls with passed 'vid' fails with 'device not found'. >> >> Fixes: efba12a78ddf ("vhost: add user callbacks for socket open/close") >> Cc: stable@dpdk.org >> >> Signed-off-by: Ilya Maximets >> --- >> lib/librte_vhost/socket.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c >> index 3da9de62c..43f091d10 100644 >> --- a/lib/librte_vhost/socket.c >> +++ b/lib/librte_vhost/socket.c >> @@ -297,11 +297,12 @@ vhost_user_read_cb(int connfd, void *dat, int *remove) >> if (ret < 0) { >> close(connfd); >> *remove = 1; >> - vhost_destroy_device(conn->vid); >> >> if (vsocket->notify_ops->destroy_connection) >> vsocket->notify_ops->destroy_connection(conn->vid); >> >> + vhost_destroy_device(conn->vid); > > By design, notify_ops->destroy_device() should be called before > notify_ops->destroy_connection(). I.e. something like: > > vhost_destroy_device_notify(...); // device stop > > if (vsocket->notify_ops->destroy_connection) // socket close > vsocket->notify_ops->destroy_connection(conn->vid); > > vhost_destroy_device(conn->vid); // free > > As destroy_device() callback means device stop (which also > happens in e.g. GET_VRING_BASE). Agree. Thanks. Will send v2. > > >> + >> pthread_mutex_lock(&vsocket->conn_mutex); >> TAILQ_REMOVE(&vsocket->conn_list, conn, next); >> pthread_mutex_unlock(&vsocket->conn_mutex); >> -- >> 2.17.1 >> > >