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 1750DA06CB for ; Tue, 22 Nov 2022 23:02:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08AAF42D79; Tue, 22 Nov 2022 23:02:53 +0100 (CET) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mails.dpdk.org (Postfix) with ESMTP id 21E5142B77 for ; Tue, 22 Nov 2022 23:02:51 +0100 (CET) Received: by mail-wr1-f42.google.com with SMTP id s5so9681309wru.1 for ; Tue, 22 Nov 2022 14:02:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pj4iZn8pNUNlX263cBz996A9yMoMcy4/AsaO15LMH4A=; b=QP1kuUmnyo7hH9k7krxXssYXEhN3tZ2+qb5SoRNMkvlWuXycy8tKTThhDQpt16FiiQ BIJ2mzYkd6lT8cpO+tIe0ALrNrpOvS01Rhfo+GrTp3ByhaU4+3AVycDDLdYae7jWQpfg rngd9Xp02CaYINbJawGlwIv+j2Clb2/VNyLUWA4MmPMUrCaooNjaqwVKqurHgsBZcvFo DdLZO68CmVVzmGbGm9JMBGHF7sHvxfMCpL/ce4C5YATcbNLYRbTz0FROUaZfI7EdExXW Sx5hFUkHxb3xCIHKZCzFAwfRuuXHiQ9ShIyvhzVlqc66dAQoS6MFsN0R+VCmDGgEUibt g2LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pj4iZn8pNUNlX263cBz996A9yMoMcy4/AsaO15LMH4A=; b=k3iwlKuG6br+pTw+ZceD1yOKTLLAL/bw2Uk8yCGJ/OS9PRCjDfzxhS0ElS6wUklKMt 1TdvZBRTpLPxDyQoLeGwNyJGFGUi8ZLUZe7YAfpThMbGhNcls5niuF/GX+FYq02hda4M m4/AEjNvqB7ZLjs8KHe4lSGL40YOJTHsUrMqd7pNP9hxB1k1xOw96IR3s/VEpaJTMgLv 51zUtahnHcxUSYtTGs6Hwb3Q4s1vbvoy3oKvO7SDVuZkwci8fA+HC5N152ZAoCtHQGMN IIObvV0j5r1nR7cCPGTu8jyIpRMWevgr8UJQlkTum4wrDIQ9feVN7C42+A6zAfi+27cH MQvw== X-Gm-Message-State: ANoB5pnksFS2R72PgTETJzQLFg3Os1b7MdfriZOWRTB3f9aMlz66DPIu UodXRfmOIVEylHl3JsZQUNQ= X-Google-Smtp-Source: AA0mqf5cJn7j4nGgVoQe9fAbKthRncnKW/tenoQ6HO/6BN3hHWJURE/y2SNYNRTYo0/Cm9yLqVJ/hQ== X-Received: by 2002:a5d:474c:0:b0:234:d495:d3ae with SMTP id o12-20020a5d474c000000b00234d495d3aemr8428032wrs.448.1669154570621; Tue, 22 Nov 2022 14:02:50 -0800 (PST) Received: from localhost ([137.220.119.58]) by smtp.gmail.com with ESMTPSA id l6-20020a5d5606000000b0022efc4322a9sm15099157wrv.10.2022.11.22.14.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 14:02:49 -0800 (PST) From: luca.boccassi@gmail.com To: Taekyung Kim Cc: Chenbo Xia , Maxime Coquelin , Andy Pei , dpdk stable Subject: patch 'vdpa/ifc: handle data path update failure' has been queued to stable release 20.11.7 Date: Tue, 22 Nov 2022 22:02:25 +0000 Message-Id: <20221122220241.926784-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221117230859.611465-34-luca.boccassi@gmail.com> References: <20221117230859.611465-34-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.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 11/24/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/67792ab2fd401cb62c5b0d64dbf1b3e01e1a854c Thanks. Luca Boccassi --- >From 67792ab2fd401cb62c5b0d64dbf1b3e01e1a854c Mon Sep 17 00:00:00 2001 From: Taekyung Kim Date: Thu, 10 Nov 2022 13:09:43 +0900 Subject: [PATCH] vdpa/ifc: handle data path update failure [ upstream commit 903ec2b1b49e496815c016b0104fd655cd972661 ] Stop and return the error code when update_datapath fails. update_datapath prepares resources for the vdpa device. The driver should not perform any further actions if update_datapath returns an error. Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") Signed-off-by: Taekyung Kim Reviewed-by: Chenbo Xia Reviewed-by: Maxime Coquelin Acked-by: Andy Pei --- drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 85bca09377..4dbfd1a71d 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -894,7 +894,12 @@ ifcvf_dev_config(int vid) internal = list->internal; internal->vid = vid; rte_atomic32_set(&internal->dev_attached, 1); - update_datapath(internal); + if (update_datapath(internal) < 0) { + DRV_LOG(ERR, "failed to update datapath for vDPA device %s", + vdev->device->name); + rte_atomic32_set(&internal->dev_attached, 0); + return -1; + } if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) != 0) DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", @@ -936,7 +941,12 @@ ifcvf_dev_close(int vid) internal->sw_fallback_running = false; } else { rte_atomic32_set(&internal->dev_attached, 0); - update_datapath(internal); + if (update_datapath(internal) < 0) { + DRV_LOG(ERR, "failed to update datapath for vDPA device %s", + vdev->device->name); + internal->configured = 0; + return -1; + } } internal->configured = 0; @@ -1255,7 +1265,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, pthread_mutex_unlock(&internal_list_lock); rte_atomic32_set(&internal->started, 1); - update_datapath(internal); + if (update_datapath(internal) < 0) { + DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name); + rte_atomic32_set(&internal->started, 0); + rte_vdpa_unregister_device(internal->vdev); + pthread_mutex_lock(&internal_list_lock); + TAILQ_REMOVE(&internal_list, list, next); + pthread_mutex_unlock(&internal_list_lock); + goto error; + } rte_kvargs_free(kvlist); return 0; @@ -1284,7 +1302,8 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev) internal = list->internal; rte_atomic32_set(&internal->started, 0); - update_datapath(internal); + if (update_datapath(internal) < 0) + DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name); rte_pci_unmap_device(internal->pdev); rte_vfio_container_destroy(internal->vfio_container_fd); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-22 22:01:31.598338961 +0000 +++ 0001-vdpa-ifc-handle-data-path-update-failure.patch 2022-11-22 22:01:31.443523419 +0000 @@ -1 +1 @@ -From 903ec2b1b49e496815c016b0104fd655cd972661 Mon Sep 17 00:00:00 2001 +From 67792ab2fd401cb62c5b0d64dbf1b3e01e1a854c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 903ec2b1b49e496815c016b0104fd655cd972661 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 8dfd49336e..49d68ad1b1 100644 +index 85bca09377..4dbfd1a71d 100644 @@ -26 +27 @@ -@@ -1098,7 +1098,12 @@ ifcvf_dev_config(int vid) +@@ -894,7 +894,12 @@ ifcvf_dev_config(int vid) @@ -38,3 +39,3 @@ - hw = &internal->hw; - for (i = 0; i < hw->nr_vring; i++) { -@@ -1146,7 +1151,12 @@ ifcvf_dev_close(int vid) + if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) != 0) + DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", +@@ -936,7 +941,12 @@ ifcvf_dev_close(int vid) @@ -54,2 +55,2 @@ -@@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, - } +@@ -1255,7 +1265,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + pthread_mutex_unlock(&internal_list_lock); @@ -71 +72 @@ -@@ -1781,7 +1799,8 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev) +@@ -1284,7 +1302,8 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev)