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 ED32FA0542 for ; Thu, 24 Nov 2022 15:00:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E918F42DC2; Thu, 24 Nov 2022 15:00:43 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 0008942DBF for ; Thu, 24 Nov 2022 15:00:42 +0100 (CET) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 3C3863F195 for ; Thu, 24 Nov 2022 14:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1669298442; bh=u1p/ILggfMNUYErfkQ92vgjSo0oSQvgmE3VrpnDrlus=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=qhK1xxovY9o3ljG39w4J3FdEyeS5EkYrwl9EYV5SUPODiQqLMWm+BizRj+QLJfpNd FGDLiGIexHX8Vi21RqdqMZCDFK3ymwRTc6qzEQZfeDwmkZLSlY/bcf3fRz67Ntgu4I yqd7vU8an9AFFX4VM7TSnK/LVvR38tcWBzFdminYWA5+wqGtKU8SAtQ632PoXlDbBC NjzOr/5+DMssLZxT7dABA1s2kNmfyxtqvSmgXv+Vnt4Qh6KpsFBhTkhAFH133M0Vpy 2Bbgkx1fG1RMrk5/WPXdEwYnTbF0d4RBj5KlNS/NdRU9QbRZ4CBGXZRZwpBKFBd6LU 53IiIkD3ni09Q== Received: by mail-ed1-f69.google.com with SMTP id s14-20020a056402520e00b00469a9930c52so986276edd.16 for ; Thu, 24 Nov 2022 06:00:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u1p/ILggfMNUYErfkQ92vgjSo0oSQvgmE3VrpnDrlus=; b=ELRZjbixBPbU8WJZUqoE0eUSROMl0xg1lJSg2CapZD4YbfNbceX9eoBzY90qtrfG6G qvnVLYy3uPn77tJ07RBG+lvnaNo+XP4uRVVnyIZ0Yc3yP7AgN5tr6EF7oRV3OApFE1Ww TTI/gl6s/LF3XjCWZaimt9rumPWWh71ohmSTkfbuLKuONui4yGYMMvoDZz8BHOczVTAi Z1dFDo/KiMWVrIr8yAqeE7PIRTouiTnU1DpCY+yQIIKE+RTr9v3bJUNkTAkJUBh4hC44 mDF1Q5jdfNpYM1Oou8rFVuSjPv2wzZFhbFonFHLk/cvkOsiEyUctc51kp7pUGwktmNXv yT2A== X-Gm-Message-State: ANoB5pmz6TuoPfJh8EuRU1iVY50ymStRGdoJzl6pfSSZf+luOEzG8b7W wC5hOSX6ccQjfP29kNldcZHf3cUd9j8OpifxzX9y3wkHDcnxi3vVZc9d9Fktf40T/NWgE5L8zam EjtslrhMn8KuL4888QAi90TR+ X-Received: by 2002:a17:906:e2cb:b0:7ad:c35a:ad76 with SMTP id gr11-20020a170906e2cb00b007adc35aad76mr28127418ejb.705.1669298441868; Thu, 24 Nov 2022 06:00:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf7OBRo6GPsXSgDT6W1zNemCOH10eqp7hhMBjdP/yPtwvQQ8wuX3IBsdMFmKZB6ggRO7O+ywoA== X-Received: by 2002:a17:906:e2cb:b0:7ad:c35a:ad76 with SMTP id gr11-20020a170906e2cb00b007adc35aad76mr28127395ejb.705.1669298441517; Thu, 24 Nov 2022 06:00:41 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39e5:dd00:978:e124:4bf:b342]) by smtp.gmail.com with ESMTPSA id i29-20020a50d75d000000b0046a44b2b5e6sm557249edj.32.2022.11.24.06.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 06:00:41 -0800 (PST) From: christian.ehrhardt@canonical.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 19.11.14 Date: Thu, 24 Nov 2022 15:00:24 +0100 Message-Id: <20221124140034.770192-1-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.38.1 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 19.11.14 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/26/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/b9dbbd4a5a69f467f2e2762c7fafd79a7fb72a2c Thanks. Christian Ehrhardt --- >From b9dbbd4a5a69f467f2e2762c7fafd79a7fb72a2c 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/net/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c index e0044ec29e..0981b61242 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -893,7 +893,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, true) != 0) DRV_LOG(NOTICE, "vDPA (%d): software relay is used.", did); @@ -933,7 +938,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; + } } return 0; @@ -1202,7 +1212,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; @@ -1231,7 +1249,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.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-24 14:58:12.152133231 +0100 +++ 0001-vdpa-ifc-handle-data-path-update-failure.patch 2022-11-24 14:58:11.805189452 +0100 @@ -1 +1 @@ -From 903ec2b1b49e496815c016b0104fd655cd972661 Mon Sep 17 00:00:00 2001 +From b9dbbd4a5a69f467f2e2762c7fafd79a7fb72a2c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 903ec2b1b49e496815c016b0104fd655cd972661 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ - drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- + drivers/net/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- @@ -22,5 +23,5 @@ -diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c -index 8dfd49336e..49d68ad1b1 100644 ---- a/drivers/vdpa/ifc/ifcvf_vdpa.c -+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c -@@ -1098,7 +1098,12 @@ ifcvf_dev_config(int vid) +diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c +index e0044ec29e..0981b61242 100644 +--- a/drivers/net/ifc/ifcvf_vdpa.c ++++ b/drivers/net/ifc/ifcvf_vdpa.c +@@ -893,7 +893,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, true) != 0) + DRV_LOG(NOTICE, "vDPA (%d): software relay is used.", did); +@@ -933,7 +938,12 @@ ifcvf_dev_close(int vid) @@ -53,3 +54,3 @@ - internal->configured = 0; -@@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, - } + return 0; +@@ -1202,7 +1212,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) +@@ -1231,7 +1249,8 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev)