From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8952EA054C for ; Fri, 14 Feb 2020 18:04:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 76C511DB9; Fri, 14 Feb 2020 18:04:13 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 660171DB9 for ; Fri, 14 Feb 2020 18:04:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581699850; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+Nqieg6kBjAY62FzbrRfyv/AcJHDcOHCGxiDnJH0qY4=; b=NZfvPvZFhJPr7DqBz8Sq8kxPrZ8gpSiaGI87rRHzgdIL1BRhXSPRoHwHaR4BQM/bDBwd5W DVuYbTlorkDTiVztSSRwD2dG2ipNdN/abYP49Z7v+9p4tVjsmYH7Zam3jS8ETXFVBnVYLS vrsI3M1poWFu8un8PHsSXIMu9ai79v8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-113-xpaYRRgtPeGS1wrl9DYN3w-1; Fri, 14 Feb 2020 12:04:08 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 725DD800D5F; Fri, 14 Feb 2020 17:04:07 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CC358AC4C; Fri, 14 Feb 2020 17:04:02 +0000 (UTC) From: Kevin Traynor To: Maxime Coquelin Cc: Tiwei Bie , Eelco Chaudron , dpdk stable Date: Fri, 14 Feb 2020 17:02:57 +0000 Message-Id: <20200214170337.25093-3-ktraynor@redhat.com> In-Reply-To: <20200214170337.25093-1-ktraynor@redhat.com> References: <20200214170337.25093-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: xpaYRRgtPeGS1wrl9DYN3w-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'vhost: fix deadlock on port deletion' has been queued to LTS release 18.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/20/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/c21000078301fe3535= 00546d53ef6d53bc1c5c05 Thanks. Kevin. --- >From c21000078301fe353500546d53ef6d53bc1c5c05 Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Tue, 14 Jan 2020 19:53:57 +0100 Subject: [PATCH] vhost: fix deadlock on port deletion [ upstream commit 5efb18e85f7fdb436d3e56591656051c16802066 ] If the vhost-user application (e.g. OVS) deletes the vhost-user port while Qemu sends a vhost-user request, a deadlock can happen if the request handler tries to acquire vhost-user's global mutex, which is also locked by the vhost-user port deletion API (rte_vhost_driver_unregister). This patch prevents the deadlock by making rte_vhost_driver_unregister() to release the mutex and try again if a request is being handled to give a chance to the request handler to complete. Fixes: 8b4b949144b8 ("vhost: fix dead lock on closing in server mode") Fixes: 5fbb3941da9f ("vhost: introduce driver features related APIs") Signed-off-by: Maxime Coquelin Reviewed-by: Tiwei Bie Acked-by: Eelco Chaudron --- lib/librte_vhost/socket.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 27bfd21fc4..ea2fdb5529 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -999,7 +999,8 @@ again: =20 =09=09=09=09/* -=09=09=09=09 * If r/wcb is executing, release the -=09=09=09=09 * conn_mutex lock, and try again since -=09=09=09=09 * the r/wcb may use the conn_mutex lock. +=09=09=09=09 * If r/wcb is executing, release vsocket's +=09=09=09=09 * conn_mutex and vhost_user's mutex locks, and +=09=09=09=09 * try again since the r/wcb may use the +=09=09=09=09 * conn_mutex and mutex locks. =09=09=09=09 */ =09=09=09=09if (fdset_try_del(&vhost_user.fdset, @@ -1022,6 +1023,15 @@ again: =20 =09=09=09if (vsocket->is_server) { -=09=09=09=09fdset_del(&vhost_user.fdset, -=09=09=09=09=09=09vsocket->socket_fd); +=09=09=09=09/* +=09=09=09=09 * If r/wcb is executing, release vhost_user's +=09=09=09=09 * mutex lock, and try again since the r/wcb +=09=09=09=09 * may use the mutex lock. +=09=09=09=09 */ +=09=09=09=09if (fdset_try_del(&vhost_user.fdset, +=09=09=09=09=09=09vsocket->socket_fd) =3D=3D -1) { +=09=09=09=09=09pthread_mutex_unlock(&vhost_user.mutex); +=09=09=09=09=09goto again; +=09=09=09=09} + =09=09=09=09close(vsocket->socket_fd); =09=09=09=09unlink(path); --=20 2.21.1 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092020-02-14 17:02:37.224255194 +0000 +++ 0003-vhost-fix-deadlock-on-port-deletion.patch=092020-02-14 17:02:36.90= 9408814 +0000 @@ -1 +1 @@ -From 5efb18e85f7fdb436d3e56591656051c16802066 Mon Sep 17 00:00:00 2001 +From c21000078301fe353500546d53ef6d53bc1c5c05 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5efb18e85f7fdb436d3e56591656051c16802066 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -29 +30 @@ -index 8bc1e3a03c..9740fb3403 100644 +index 27bfd21fc4..ea2fdb5529 100644 @@ -32 +33 @@ -@@ -1053,7 +1053,8 @@ again: +@@ -999,7 +999,8 @@ again: @@ -44 +45 @@ -@@ -1076,6 +1077,15 @@ again: +@@ -1022,6 +1023,15 @@ again: