From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD43DA0543 for ; Tue, 21 Jun 2022 10:11:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AFC642B7E; Tue, 21 Jun 2022 10:10:57 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2040.outbound.protection.outlook.com [40.107.96.40]) by mails.dpdk.org (Postfix) with ESMTP id 59DB74280C for ; Tue, 21 Jun 2022 10:10:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ysz/PPm045+Rmiz81nq6Ee3QZhk+bEAJjge76/rQ2GkHQbeXIQtnER2V991SkbHysu3Odp5HQjnpSErglYDtE1IW2EoYA4Vv0+NNQaXIKuboidp8PCtXI8r4Yhg5pjTDTn1Wu3e4B+xDdTWNd/7ZgO77PQemzC++URMYUHt/kmlr3rDDFlctCTtQ3WfbZzwWdC80ZwrdNa4xcGAa6DbZgtAF0njDl1Fw94QY+gqJ1qole7hfEyN/ae6HY+lklG3e1TemEUvv2Yyb3ghPcDta4aefYWdNNp/NeZVS19FWVEkxWrLSmWVbdu+4oB82MugTWlWUuOovfVlBSb6pS6WKNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eZVKVbqu14HVGVvQHKGsWq1QMTWwUkB77hEBE4+3o3c=; b=EiGfewOAl1U6wPDTR2DPeNTzZvVRF0IDxUCaAVl9hYvmaLjxs9t6TVFejQniukZRuEaN+1B3fku8tNkPn2cGzOPFBukdr+7VjYRuMQ/ZpSTYcKhObocHniykPz3XvCQ4kU+iSYKhUimy6Vf0yZOMJsjN8oIBGrxQlCnZmTymXDFiB9TBNBm1AgTGS8Z3vBIeGchFKa0A/ewsA4AWe/51WdhbXYA4nzNoMddMDnyb8kblwDGatlpFqKQckIypaI1+sbiB4UXa+GT44GFqmyuuWVhXTgrUoEuJzEcvjBfrh1tQnZBZf1JTmM7NAIjbu1WooBOWIHjqgg59vdMvP63q6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eZVKVbqu14HVGVvQHKGsWq1QMTWwUkB77hEBE4+3o3c=; b=QRpTZMj5hUmg3HOyKL7K3XbLMz+cUOmshXieqd0fnVCQgu3tJxamlPd50Ce31XM5OwLZfcKaONn64b23oZUlQKZ1mq2ij/edjYLkJPtYxOhO11Te/zsWIF0E23Z9gZwICWj6ZZSuNKCL2HQEuEhH1sIb6WnbeacEFLzcsbp66WUtrz4PRBFIpP3bBm2CAlJfJHSBVlK1PJmaFckgYeRItDXtLLRiEEDX8Cipy+ZMfq0aros4PrQ611XD+JWGDX189jEmw2n7KrK1yXLsiee1uGaoxpIdTfvxiOyI1TeO4yWBXtWKl5DuUP2131zjgALJyE+MrRiD8iav/t8VfngWmg== Received: from BN8PR07CA0001.namprd07.prod.outlook.com (2603:10b6:408:ac::14) by DS7PR12MB5720.namprd12.prod.outlook.com (2603:10b6:8:73::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Tue, 21 Jun 2022 08:10:54 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ac:cafe::53) by BN8PR07CA0001.outlook.office365.com (2603:10b6:408:ac::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15 via Frontend Transport; Tue, 21 Jun 2022 08:10:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Tue, 21 Jun 2022 08:10:53 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 21 Jun 2022 08:10:51 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 21 Jun 2022 01:10:49 -0700 From: Xueming Li To: Wenwu Ma CC: Chenbo Xia , Wei Ling , "David Marchand" , dpdk stable Subject: patch 'vhost: fix deadlock when message handling failed' has been queued to stable release 20.11.6 Date: Tue, 21 Jun 2022 11:02:35 +0300 Message-ID: <20220621080301.2315720-90-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220621080301.2315720-1-xuemingl@nvidia.com> References: <20220621080301.2315720-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4fdc7066-7876-499e-0f92-08da535d8fdb X-MS-TrafficTypeDiagnostic: DS7PR12MB5720:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RLzfQx+5eUdyUc6zNImNbPgulylRN453Kdxbz1ek/3UUGbx5qzdAeLvvKVeV8bXB0KtMvboXJtgZhz+zstIVy61Re/Np4h26fUWlkrhiCVwZXCX/rvo3hxKvW92yMHvdplxBC3GWZpPjCRNzd2NkH3fy3LrLXZTJlhu5fi+Q0fqRO0K9HKdMW690LBFB0CBR+QJvOztATGWA9sQXYHT5CXUR0CaqXjgm446+BCq5c/tDOu7kjzdthJN0LMO4+8DQGR31nLc4HU4znIj5c/GpbvYrJQ1fXXge7qLUUyeJRRnoVIyj0IC3pd351q7EkH4GTlwFkh6NOy++aN60sK8uqSIo+tqp05WSSwDLU3UQI7LmLgaWAkIgnO4dhoncg6HqP4Tnq2DMFyhuGAc9xB4Sywc6XWjitTF2puBi1Unm9AhtYq1hWz6tegCsgNmtwHkEuoqgj2fTYh1eEcceQZhYSuTY3EXgeJPSIA88qgEwo5Fombk4itRGrz2I08qzkl8yn7tCmoZJXt7f2uS8jICd8TDr3RK1JTQLCSuaCvWSqoiyIIW96gizGWnftz7ERCVxAXqLCxag9GyrvoOECHJdzqJp8DeTs018gwqDGyOrDtpVq9q0iZ1wZT6bwOiJs7i4DHncCQYzWiB+0BhVhFxZ9LRuHhK9VR3N/Ij6sPCxTVNGuSVo0FTQ1GXVjOC5hPsXjHCMeQGprOWb5777U4u7//wSIW1mH7UQKcv6ndUFddTP5MB3ytjHk5Z4ObtJ6rFhDFZk04n98DNxQWfX2T9d6Vwj3CbU6kAcR5TAHBJMlQON1I9WT5lQDqIo5lg2Tq3adndQijm+QFXSPjWS5qa2Bscgo183TUuXJBOHBvkA/P0= X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(396003)(346002)(39860400002)(136003)(376002)(36840700001)(40470700004)(46966006)(41300700001)(16526019)(36756003)(2906002)(2616005)(426003)(40480700001)(356005)(82310400005)(26005)(40460700003)(15650500001)(83380400001)(1076003)(55016003)(186003)(5660300002)(70206006)(81166007)(336012)(6916009)(47076005)(6286002)(36860700001)(70586007)(478600001)(4326008)(8676002)(316002)(54906003)(6666004)(53546011)(8936002)(82740400003)(7696005)(966005)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:10:53.5190 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fdc7066-7876-499e-0f92-08da535d8fdb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5720 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 20.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/23/22. 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 rebasing (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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/63005df100f41bc54d8146bdd1d2e8ab4c67ec38 Thanks. Xueming Li --- >From 63005df100f41bc54d8146bdd1d2e8ab4c67ec38 Mon Sep 17 00:00:00 2001 From: Wenwu Ma Date: Sat, 7 May 2022 13:27:53 +0000 Subject: [PATCH] vhost: fix deadlock when message handling failed Cc: Xueming Li [ upstream commit 9e89b06d027c6087624f36f288bd82c643c5a269 ] In vhost_user_msg_handler(), if vhost message handling failed, we should check whether the queue is locked and release the lock before returning. Or, it will cause a deadlock later. Fixes: 7f31d4ea05ca ("vhost: fix lock on device readiness notification") Signed-off-by: Wenwu Ma Reviewed-by: Chenbo Xia Tested-by: Wei Ling Acked-by: David Marchand --- lib/librte_vhost/vhost_user.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index fbb854dad0..25ebc0c37c 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -2789,7 +2789,6 @@ vhost_user_msg_handler(int vid, int fd) return -1; } - ret = 0; request = msg.request.master; if (request > VHOST_USER_NONE && request < VHOST_USER_MAX && vhost_message_str[request]) { @@ -2931,9 +2930,11 @@ skip_to_post_handle: } else if (ret == RTE_VHOST_MSG_RESULT_ERR) { VHOST_LOG_CONFIG(ERR, "vhost message handling failed.\n"); - return -1; + ret = -1; + goto unlock; } + ret = 0; for (i = 0; i < dev->nr_vring; i++) { struct vhost_virtqueue *vq = dev->virtqueue[i]; bool cur_ready = vq_is_ready(dev, vq); @@ -2944,10 +2945,11 @@ skip_to_post_handle: } } +unlock: if (unlock_required) vhost_user_unlock_all_queue_pairs(dev); - if (!virtio_is_ready(dev)) + if (ret != 0 || !virtio_is_ready(dev)) goto out; /* @@ -2974,7 +2976,7 @@ skip_to_post_handle: } out: - return 0; + return ret; } static int process_slave_message_reply(struct virtio_net *dev, -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-21 15:37:53.251533320 +0800 +++ 0089-vhost-fix-deadlock-when-message-handling-failed.patch 2022-06-21 15:37:49.184451772 +0800 @@ -1 +1 @@ -From 9e89b06d027c6087624f36f288bd82c643c5a269 Mon Sep 17 00:00:00 2001 +From 63005df100f41bc54d8146bdd1d2e8ab4c67ec38 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9e89b06d027c6087624f36f288bd82c643c5a269 ] @@ -12 +14,0 @@ -Cc: stable@dpdk.org @@ -19 +21 @@ - lib/vhost/vhost_user.c | 10 ++++++---- + lib/librte_vhost/vhost_user.c | 10 ++++++---- @@ -22,5 +24,5 @@ -diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c -index 850848c269..91e69d1d97 100644 ---- a/lib/vhost/vhost_user.c -+++ b/lib/vhost/vhost_user.c -@@ -2887,7 +2887,6 @@ vhost_user_msg_handler(int vid, int fd) +diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c +index fbb854dad0..25ebc0c37c 100644 +--- a/lib/librte_vhost/vhost_user.c ++++ b/lib/librte_vhost/vhost_user.c +@@ -2789,7 +2789,6 @@ vhost_user_msg_handler(int vid, int fd) @@ -31,5 +33,4 @@ - request = ctx.msg.request.master; - if (request > VHOST_USER_NONE && request < RTE_DIM(vhost_message_handlers)) - msg_handler = &vhost_message_handlers[request]; -@@ -3031,9 +3030,11 @@ skip_to_post_handle: - send_vhost_reply(dev, fd, &ctx); + request = msg.request.master; + if (request > VHOST_USER_NONE && request < VHOST_USER_MAX && + vhost_message_str[request]) { +@@ -2931,9 +2930,11 @@ skip_to_post_handle: @@ -37 +38,2 @@ - VHOST_LOG_CONFIG(ERR, "(%s) vhost message handling failed.\n", dev->ifname); + VHOST_LOG_CONFIG(ERR, + "vhost message handling failed.\n"); @@ -47 +49 @@ -@@ -3044,10 +3045,11 @@ skip_to_post_handle: +@@ -2944,10 +2945,11 @@ skip_to_post_handle: @@ -60 +62 @@ -@@ -3074,7 +3076,7 @@ skip_to_post_handle: +@@ -2974,7 +2976,7 @@ skip_to_post_handle: