* [PATCH] vdpa/ifc: fix update_datapath error handling @ 2022-10-18 7:22 Taekyung Kim 2022-11-02 9:12 ` Maxime Coquelin 0 siblings, 1 reply; 24+ messages in thread From: Taekyung Kim @ 2022-10-18 7:22 UTC (permalink / raw) To: dev; +Cc: Maxime Coquelin, Taekyung Kim Stop and return the error code if 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. Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> --- drivers/vdpa/ifc/ifcvf_vdpa.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index d5ac583589..795967e998 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1063,7 +1063,10 @@ 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: %p", vdev); + return -1; + } if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) != 0) DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", @@ -1105,7 +1108,10 @@ 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: %p", vdev); + return -1; + } } internal->configured = 0; @@ -1632,7 +1638,10 @@ 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); + return -1; + } rte_kvargs_free(kvlist); return 0; @@ -1661,7 +1670,10 @@ 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); + return -1; + } rte_pci_unmap_device(internal->pdev); rte_vfio_container_destroy(internal->vfio_container_fd); -- 2.30.1 (Apple Git-130) ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] vdpa/ifc: fix update_datapath error handling 2022-10-18 7:22 [PATCH] vdpa/ifc: fix update_datapath error handling Taekyung Kim @ 2022-11-02 9:12 ` Maxime Coquelin 2022-11-07 5:34 ` [PATCH v2] " Taekyung Kim 0 siblings, 1 reply; 24+ messages in thread From: Maxime Coquelin @ 2022-11-02 9:12 UTC (permalink / raw) To: Taekyung Kim, dev, Chenbo Xia, Xiao Wang Hi, On 10/18/22 09:22, Taekyung Kim wrote: > Stop and return the error code if 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. You need to add Fixes tag and Cc stable@dpdk.org, so that it is backported to relevant LTS branches. > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c > index d5ac583589..795967e998 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -1063,7 +1063,10 @@ 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: %p", vdev); > + return -1; > + } > > if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) != 0) > DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", > @@ -1105,7 +1108,10 @@ 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: %p", vdev); > + return -1; > + } > } > > internal->configured = 0; > @@ -1632,7 +1638,10 @@ 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); > + return -1; > + } This is not enough, you need to free resources allocated before, otherwise you introduce memory leaks. Basically, you should goto error instead o directly returning -1. > > rte_kvargs_free(kvlist); > return 0; > @@ -1661,7 +1670,10 @@ 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); > + return -1; > + } I think we should not return early here, because we still want to clean as much as possible on remove. maybe just keep the error message. > rte_pci_unmap_device(internal->pdev); > rte_vfio_container_destroy(internal->vfio_container_fd); Thanks, Maxime ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2] vdpa/ifc: fix update_datapath error handling 2022-11-02 9:12 ` Maxime Coquelin @ 2022-11-07 5:34 ` Taekyung Kim 2022-11-07 8:59 ` [PATCH v3] " Taekyung Kim 0 siblings, 1 reply; 24+ messages in thread From: Taekyung Kim @ 2022-11-07 5:34 UTC (permalink / raw) To: dev; +Cc: maxime.coquelin, chenbo.xia, kim.tae.kyung, xiao.w.wang, stable 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") Cc: stable@dpdk.org Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> --- v2: * Revert the prepared resources before returning an error * Rebase to 22.11 rc2 * Add fixes and cc for backport --- drivers/vdpa/ifc/ifcvf_vdpa.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8dfd49336e..e25fb16106 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1098,7 +1098,11 @@ 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; + } hw = &internal->hw; for (i = 0; i < hw->nr_vring; i++) { @@ -1146,7 +1150,11 @@ 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; @@ -1752,7 +1760,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } 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); + 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; @@ -1781,7 +1796,9 @@ 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 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3] vdpa/ifc: fix update_datapath error handling 2022-11-07 5:34 ` [PATCH v2] " Taekyung Kim @ 2022-11-07 8:59 ` Taekyung Kim 2022-11-08 1:46 ` Xia, Chenbo 0 siblings, 1 reply; 24+ messages in thread From: Taekyung Kim @ 2022-11-07 8:59 UTC (permalink / raw) To: dev; +Cc: stable, maxime.coquelin, chenbo.xia, xiao.w.wang, kim.tae.kyung 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") Cc: stable@dpdk.org Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> --- v3: * Fix coding style v2: * Revert the prepared resources before returning an error * Rebase to 22.11 rc2 * Add fixes and cc for backport --- drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8dfd49336e..0396d49122 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1098,7 +1098,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; + } hw = &internal->hw; for (i = 0; i < hw->nr_vring; i++) { @@ -1146,7 +1151,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; @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } 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); + 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; @@ -1781,7 +1798,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 ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling 2022-11-07 8:59 ` [PATCH v3] " Taekyung Kim @ 2022-11-08 1:46 ` Xia, Chenbo 2022-11-08 7:30 ` Taekyung Kim 2022-11-08 7:39 ` Pei, Andy 0 siblings, 2 replies; 24+ messages in thread From: Xia, Chenbo @ 2022-11-08 1:46 UTC (permalink / raw) To: Taekyung Kim, dev; +Cc: stable, maxime.coquelin, Wang, Xiao W > -----Original Message----- > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > Sent: Monday, November 7, 2022 5:00 PM > To: dev@dpdk.org > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > <chenbo.xia@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; > kim.tae.kyung@navercorp.com > Subject: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > 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") > Cc: stable@dpdk.org > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > --- > v3: > * Fix coding style > > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport > > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- > 1 file changed, 22 insertions(+), 4 deletions(-) > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c > index 8dfd49336e..0396d49122 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -1098,7 +1098,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; > + } > > hw = &internal->hw; > for (i = 0; i < hw->nr_vring; i++) { > @@ -1146,7 +1151,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; > @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, > } > > 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); > + 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; > @@ -1781,7 +1798,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 Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3] vdpa/ifc: fix update_datapath error handling 2022-11-08 1:46 ` Xia, Chenbo @ 2022-11-08 7:30 ` Taekyung Kim 2022-11-08 7:39 ` Pei, Andy 1 sibling, 0 replies; 24+ messages in thread From: Taekyung Kim @ 2022-11-08 7:30 UTC (permalink / raw) To: Xia, Chenbo; +Cc: dev, stable, maxime.coquelin, Wang, Xiao W Hi Chenbo, Thanks for your review. On Tue, Nov 08, 2022 at 01:46:37AM +0000, Xia, Chenbo wrote: > > -----Original Message----- > > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > > Sent: Monday, November 7, 2022 5:00 PM > > To: dev@dpdk.org > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > > <chenbo.xia@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; > > kim.tae.kyung@navercorp.com > > Subject: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > 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") > > Cc: stable@dpdk.org > > > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > > --- > > v3: > > * Fix coding style > > > > v2: > > * Revert the prepared resources before returning an error > > * Rebase to 22.11 rc2 > > * Add fixes and cc for backport > > > > --- > > drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- > > 1 file changed, 22 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c > > index 8dfd49336e..0396d49122 100644 > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > > @@ -1098,7 +1098,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; > > + } > > > > hw = &internal->hw; > > for (i = 0; i < hw->nr_vring; i++) { > > @@ -1146,7 +1151,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; > > @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > > __rte_unused, > > } > > > > 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); > > + 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; > > @@ -1781,7 +1798,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 > > Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling 2022-11-08 1:46 ` Xia, Chenbo 2022-11-08 7:30 ` Taekyung Kim @ 2022-11-08 7:39 ` Pei, Andy 2022-11-08 7:56 ` Xia, Chenbo 1 sibling, 1 reply; 24+ messages in thread From: Pei, Andy @ 2022-11-08 7:39 UTC (permalink / raw) To: Xia, Chenbo, Taekyung Kim, dev; +Cc: stable, maxime.coquelin, Wang, Xiao W Hi See my reply inline. > -----Original Message----- > From: Xia, Chenbo <chenbo.xia@intel.com> > Sent: Tuesday, November 8, 2022 9:47 AM > To: Taekyung Kim <kim.tae.kyung@navercorp.com>; dev@dpdk.org > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Wang, Xiao W > <xiao.w.wang@intel.com> > Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > -----Original Message----- > > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > > Sent: Monday, November 7, 2022 5:00 PM > > To: dev@dpdk.org > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > > <chenbo.xia@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; > > kim.tae.kyung@navercorp.com > > Subject: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > 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") > > Cc: stable@dpdk.org > > > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > > --- > > v3: > > * Fix coding style > > > > v2: > > * Revert the prepared resources before returning an error > > * Rebase to 22.11 rc2 > > * Add fixes and cc for backport > > > > --- > > drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- > > 1 file changed, 22 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8dfd49336e..0396d49122 100644 > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > > @@ -1098,7 +1098,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; > > + } > > > > hw = &internal->hw; > > for (i = 0; i < hw->nr_vring; i++) { @@ -1146,7 +1151,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; > > @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > > __rte_unused, > > } > > > > 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); > > + pthread_mutex_lock(&internal_list_lock); > > + TAILQ_REMOVE(&internal_list, list, next); > > + pthread_mutex_unlock(&internal_list_lock); > > + goto error; > > + } > > Is it necessary to unregister vdpa device? > > rte_kvargs_free(kvlist); > > return 0; > > @@ -1781,7 +1798,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 > > Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling 2022-11-08 7:39 ` Pei, Andy @ 2022-11-08 7:56 ` Xia, Chenbo 2022-11-08 8:27 ` Taekyung Kim 2022-11-08 8:56 ` [PATCH v4] " Taekyung Kim 0 siblings, 2 replies; 24+ messages in thread From: Xia, Chenbo @ 2022-11-08 7:56 UTC (permalink / raw) To: Pei, Andy, Taekyung Kim, dev; +Cc: stable, maxime.coquelin, Wang, Xiao W > -----Original Message----- > From: Pei, Andy <andy.pei@intel.com> > Sent: Tuesday, November 8, 2022 3:39 PM > To: Xia, Chenbo <chenbo.xia@intel.com>; Taekyung Kim > <kim.tae.kyung@navercorp.com>; dev@dpdk.org > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Wang, Xiao W > <xiao.w.wang@intel.com> > Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > Hi > > See my reply inline. > > > -----Original Message----- > > From: Xia, Chenbo <chenbo.xia@intel.com> > > Sent: Tuesday, November 8, 2022 9:47 AM > > To: Taekyung Kim <kim.tae.kyung@navercorp.com>; dev@dpdk.org > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Wang, Xiao W > > <xiao.w.wang@intel.com> > > Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > > -----Original Message----- > > > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > > > Sent: Monday, November 7, 2022 5:00 PM > > > To: dev@dpdk.org > > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > > > <chenbo.xia@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; > > > kim.tae.kyung@navercorp.com > > > Subject: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > > > 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") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > > > --- > > > v3: > > > * Fix coding style > > > > > > v2: > > > * Revert the prepared resources before returning an error > > > * Rebase to 22.11 rc2 > > > * Add fixes and cc for backport > > > > > > --- > > > drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- > > > 1 file changed, 22 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c > > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8dfd49336e..0396d49122 100644 > > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > > > @@ -1098,7 +1098,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; > > > + } > > > > > > hw = &internal->hw; > > > for (i = 0; i < hw->nr_vring; i++) { @@ -1146,7 +1151,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; > > > @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > > > __rte_unused, > > > } > > > > > > 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); > > > + pthread_mutex_lock(&internal_list_lock); > > > + TAILQ_REMOVE(&internal_list, list, next); > > > + pthread_mutex_unlock(&internal_list_lock); > > > + goto error; > > > + } > > > > > Is it necessary to unregister vdpa device? Good catch, yes it's needed. Kim, please add the unregistration. Thanks, Chenbo > > > > rte_kvargs_free(kvlist); > > > return 0; > > > @@ -1781,7 +1798,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 > > > > Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3] vdpa/ifc: fix update_datapath error handling 2022-11-08 7:56 ` Xia, Chenbo @ 2022-11-08 8:27 ` Taekyung Kim 2022-11-08 8:56 ` [PATCH v4] " Taekyung Kim 1 sibling, 0 replies; 24+ messages in thread From: Taekyung Kim @ 2022-11-08 8:27 UTC (permalink / raw) To: Xia, Chenbo; +Cc: Pei, Andy, dev, stable, maxime.coquelin, Wang, Xiao W On Tue, Nov 08, 2022 at 07:56:18AM +0000, Xia, Chenbo wrote: > > -----Original Message----- > > From: Pei, Andy <andy.pei@intel.com> > > Sent: Tuesday, November 8, 2022 3:39 PM > > To: Xia, Chenbo <chenbo.xia@intel.com>; Taekyung Kim > > <kim.tae.kyung@navercorp.com>; dev@dpdk.org > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Wang, Xiao W > > <xiao.w.wang@intel.com> > > Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > Hi > > > > See my reply inline. > > > > > -----Original Message----- > > > From: Xia, Chenbo <chenbo.xia@intel.com> > > > Sent: Tuesday, November 8, 2022 9:47 AM > > > To: Taekyung Kim <kim.tae.kyung@navercorp.com>; dev@dpdk.org > > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Wang, Xiao W > > > <xiao.w.wang@intel.com> > > > Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > > > > -----Original Message----- > > > > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > > > > Sent: Monday, November 7, 2022 5:00 PM > > > > To: dev@dpdk.org > > > > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > > > > <chenbo.xia@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; > > > > kim.tae.kyung@navercorp.com > > > > Subject: [PATCH v3] vdpa/ifc: fix update_datapath error handling > > > > > > > > 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") > > > > Cc: stable@dpdk.org > > > > > > > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > > > > --- > > > > v3: > > > > * Fix coding style > > > > > > > > v2: > > > > * Revert the prepared resources before returning an error > > > > * Rebase to 22.11 rc2 > > > > * Add fixes and cc for backport > > > > > > > > --- > > > > drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- > > > > 1 file changed, 22 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c > > > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8dfd49336e..0396d49122 100644 > > > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > > > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > > > > @@ -1098,7 +1098,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; > > > > + } > > > > > > > > hw = &internal->hw; > > > > for (i = 0; i < hw->nr_vring; i++) { @@ -1146,7 +1151,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; > > > > @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > > > > __rte_unused, > > > > } > > > > > > > > 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); > > > > + pthread_mutex_lock(&internal_list_lock); > > > > + TAILQ_REMOVE(&internal_list, list, next); > > > > + pthread_mutex_unlock(&internal_list_lock); > > > > + goto error; > > > > + } > > > > > > > > Is it necessary to unregister vdpa device? > > Good catch, yes it's needed. > > Kim, please add the unregistration. > > Thanks, > Chenbo Hi Andy and Chenbo, Thanks for your comments. I forgot to add `rte_vdpa_unregister_device(internal->vdev)`. I will send a new patch soon. By the way, it seems that deallocation for `ifcvf_vfio_setup(internal)` is also ommitted in `ifcvf_pci_probe(...)`. I will submit another commit to split `error:` into `error2:` and `error1:`, which calls `rte_pci_unmap_device(...)` and `rte_vfio_container_destroy(...)`. Thanks, Taekyung > > > > > > > rte_kvargs_free(kvlist); > > > > return 0; > > > > @@ -1781,7 +1798,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 > > > > > > Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-08 7:56 ` Xia, Chenbo 2022-11-08 8:27 ` Taekyung Kim @ 2022-11-08 8:56 ` Taekyung Kim 2022-11-08 13:49 ` Maxime Coquelin ` (2 more replies) 1 sibling, 3 replies; 24+ messages in thread From: Taekyung Kim @ 2022-11-08 8:56 UTC (permalink / raw) To: dev Cc: chenbo.xia, andy.pei, kim.tae.kyung, maxime.coquelin, stable, xiao.w.wang 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") Cc: stable@dpdk.org Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> --- v4: * Add rte_vdpa_unregister_device in ifcvf_pci_probe v3: * Fix coding style v2: * Revert the prepared resources before returning an error * Rebase to 22.11 rc2 * Add fixes and cc for backport --- 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 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) 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; + } hw = &internal->hw; for (i = 0; i < hw->nr_vring; i++) { @@ -1146,7 +1151,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; @@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } 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; @@ -1781,7 +1799,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 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-08 8:56 ` [PATCH v4] " Taekyung Kim @ 2022-11-08 13:49 ` Maxime Coquelin 2022-11-09 10:45 ` Taekyung Kim 2022-11-09 2:39 ` Pei, Andy 2022-11-10 1:53 ` Xia, Chenbo 2 siblings, 1 reply; 24+ messages in thread From: Maxime Coquelin @ 2022-11-08 13:49 UTC (permalink / raw) To: Taekyung Kim, dev; +Cc: chenbo.xia, andy.pei, stable, xiao.w.wang Hi Taekyung, On 11/8/22 09:56, Taekyung Kim wrote: > 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") > Cc: stable@dpdk.org > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > --- > v4: > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > v3: > * Fix coding style > > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport > > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Thanks, Maxime ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-08 13:49 ` Maxime Coquelin @ 2022-11-09 10:45 ` Taekyung Kim 0 siblings, 0 replies; 24+ messages in thread From: Taekyung Kim @ 2022-11-09 10:45 UTC (permalink / raw) To: Maxime Coquelin; +Cc: dev, chenbo.xia, andy.pei, stable, xiao.w.wang Hi Maxime, Thanks for your review. On Tue, Nov 08, 2022 at 02:49:39PM +0100, Maxime Coquelin wrote: > Hi Taekyung, > > On 11/8/22 09:56, Taekyung Kim wrote: > > 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") > > Cc: stable@dpdk.org > > > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > > --- > > v4: > > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > > > v3: > > * Fix coding style > > > > v2: > > * Revert the prepared resources before returning an error > > * Rebase to 22.11 rc2 > > * Add fixes and cc for backport > > > > --- > > drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- > > 1 file changed, 23 insertions(+), 4 deletions(-) > > > > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> > > Thanks, > Maxime > ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-08 8:56 ` [PATCH v4] " Taekyung Kim 2022-11-08 13:49 ` Maxime Coquelin @ 2022-11-09 2:39 ` Pei, Andy 2022-11-09 10:47 ` Taekyung Kim 2022-11-10 1:53 ` Xia, Chenbo 2 siblings, 1 reply; 24+ messages in thread From: Pei, Andy @ 2022-11-09 2:39 UTC (permalink / raw) To: Taekyung Kim, dev; +Cc: Xia, Chenbo, maxime.coquelin, stable, Wang, Xiao W > -----Original Message----- > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > Sent: Tuesday, November 8, 2022 4:56 PM > To: dev@dpdk.org > Cc: Xia, Chenbo <Chenbo.Xia@intel.com>; Pei, Andy <andy.pei@intel.com>; > kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; > stable@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com> > Subject: [PATCH v4] vdpa/ifc: fix update_datapath error handling > > 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") > Cc: stable@dpdk.org > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > --- > v4: > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > v3: > * Fix coding style > > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport > > --- > 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 > 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) > 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; > + } > > hw = &internal->hw; > for (i = 0; i < hw->nr_vring; i++) { > @@ -1146,7 +1151,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; > @@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, > } > > 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; > @@ -1781,7 +1799,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 Acked-by: Andy Pei <andy.pei@intel.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-09 2:39 ` Pei, Andy @ 2022-11-09 10:47 ` Taekyung Kim 0 siblings, 0 replies; 24+ messages in thread From: Taekyung Kim @ 2022-11-09 10:47 UTC (permalink / raw) To: Pei, Andy; +Cc: dev, Xia, Chenbo, maxime.coquelin, stable, Wang, Xiao W Hi Andy, Thanks for your review. On Wed, Nov 09, 2022 at 02:39:09AM +0000, Pei, Andy wrote: > > > > -----Original Message----- > > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > > Sent: Tuesday, November 8, 2022 4:56 PM > > To: dev@dpdk.org > > Cc: Xia, Chenbo <Chenbo.Xia@intel.com>; Pei, Andy <andy.pei@intel.com>; > > kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; > > stable@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com> > > Subject: [PATCH v4] vdpa/ifc: fix update_datapath error handling > > > > 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") > > Cc: stable@dpdk.org > > > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > > --- > > v4: > > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > > > v3: > > * Fix coding style > > > > v2: > > * Revert the prepared resources before returning an error > > * Rebase to 22.11 rc2 > > * Add fixes and cc for backport > > > > --- > > 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 > > 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) > > 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; > > + } > > > > hw = &internal->hw; > > for (i = 0; i < hw->nr_vring; i++) { > > @@ -1146,7 +1151,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; > > @@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > > __rte_unused, > > } > > > > 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; > > @@ -1781,7 +1799,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 > > Acked-by: Andy Pei <andy.pei@intel.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-08 8:56 ` [PATCH v4] " Taekyung Kim 2022-11-08 13:49 ` Maxime Coquelin 2022-11-09 2:39 ` Pei, Andy @ 2022-11-10 1:53 ` Xia, Chenbo 2022-11-10 4:02 ` Taekyung Kim 2022-11-10 4:09 ` [PATCH v5] " Taekyung Kim 2 siblings, 2 replies; 24+ messages in thread From: Xia, Chenbo @ 2022-11-10 1:53 UTC (permalink / raw) To: Taekyung Kim, dev; +Cc: Pei, Andy, maxime.coquelin, stable, Wang, Xiao W Hi Kim, > -----Original Message----- > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > Sent: Tuesday, November 8, 2022 4:56 PM > To: dev@dpdk.org > Cc: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy <andy.pei@intel.com>; > kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; stable@dpdk.org; > Wang, Xiao W <xiao.w.wang@intel.com> > Subject: [PATCH v4] vdpa/ifc: fix update_datapath error handling > > 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") > Cc: stable@dpdk.org > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > --- > v4: > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > v3: > * Fix coding style > > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport > > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) I can't find your patch in patchwork: http://patchwork.dpdk.org/project/dpdk/list/?series=&submitter=2877&state=*&q=&archive=both&delegate= so it's difficult to review and merge. Do you know why or is it possible that you send a new version to make it show on Patchwork today? Thanks, Chenbo ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-10 1:53 ` Xia, Chenbo @ 2022-11-10 4:02 ` Taekyung Kim 2022-11-10 9:20 ` Maxime Coquelin 2022-11-10 4:09 ` [PATCH v5] " Taekyung Kim 1 sibling, 1 reply; 24+ messages in thread From: Taekyung Kim @ 2022-11-10 4:02 UTC (permalink / raw) To: Xia, Chenbo; +Cc: dev, Pei, Andy, maxime.coquelin, stable, Wang, Xiao W On Thu, Nov 10, 2022 at 01:53:50AM +0000, Xia, Chenbo wrote: > Hi Kim, > > > -----Original Message----- > > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > > Sent: Tuesday, November 8, 2022 4:56 PM > > To: dev@dpdk.org > > Cc: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy <andy.pei@intel.com>; > > kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; stable@dpdk.org; > > Wang, Xiao W <xiao.w.wang@intel.com> > > Subject: [PATCH v4] vdpa/ifc: fix update_datapath error handling > > > > 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") > > Cc: stable@dpdk.org > > > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > > --- > > v4: > > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > > > v3: > > * Fix coding style > > > > v2: > > * Revert the prepared resources before returning an error > > * Rebase to 22.11 rc2 > > * Add fixes and cc for backport > > > > --- > > drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- > > 1 file changed, 23 insertions(+), 4 deletions(-) > > I can't find your patch in patchwork: > > http://patchwork.dpdk.org/project/dpdk/list/?series=&submitter=2877&state=*&q=&archive=both&delegate= > > so it's difficult to review and merge. Do you know why or is it possible > that you send a new version to make it show on Patchwork today? > > Thanks, > Chenbo > Hi Chenbo, First, thanks for your review. I will send a new version for this patch soon. I think the mail for v4 is lost. Whenever I send a patch, I received "Your message to dev awaits moderator approval" from dev-owner@dpdk.org with the reason "Post by non-member to a members-only list". Maybe, the reason is that this is the first time that I submit a patch. Thanks, Taekyung ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-10 4:02 ` Taekyung Kim @ 2022-11-10 9:20 ` Maxime Coquelin 2022-11-10 9:34 ` Ali Alnubani 0 siblings, 1 reply; 24+ messages in thread From: Maxime Coquelin @ 2022-11-10 9:20 UTC (permalink / raw) To: Taekyung Kim, Thomas Monjalon, Ali Alnubani Cc: dev, Pei, Andy, stable, Wang, Xiao W, Xia, Chenbo Hi Taekyung, Adding Thomas and Ali who maintains the patchwork instance. On 11/10/22 05:02, Taekyung Kim wrote: > On Thu, Nov 10, 2022 at 01:53:50AM +0000, Xia, Chenbo wrote: >> Hi Kim, >> >>> -----Original Message----- >>> From: Taekyung Kim <kim.tae.kyung@navercorp.com> >>> Sent: Tuesday, November 8, 2022 4:56 PM >>> To: dev@dpdk.org >>> Cc: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy <andy.pei@intel.com>; >>> kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; stable@dpdk.org; >>> Wang, Xiao W <xiao.w.wang@intel.com> >>> Subject: [PATCH v4] vdpa/ifc: fix update_datapath error handling >>> >>> 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") >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> >>> --- >>> v4: >>> * Add rte_vdpa_unregister_device in ifcvf_pci_probe >>> >>> v3: >>> * Fix coding style >>> >>> v2: >>> * Revert the prepared resources before returning an error >>> * Rebase to 22.11 rc2 >>> * Add fixes and cc for backport >>> >>> --- >>> drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- >>> 1 file changed, 23 insertions(+), 4 deletions(-) >> >> I can't find your patch in patchwork: >> >> http://patchwork.dpdk.org/project/dpdk/list/?series=&submitter=2877&state=*&q=&archive=both&delegate= >> >> so it's difficult to review and merge. Do you know why or is it possible >> that you send a new version to make it show on Patchwork today? >> >> Thanks, >> Chenbo >> > > Hi Chenbo, > > First, thanks for your review. > I will send a new version for this patch soon. > > I think the mail for v4 is lost. > Whenever I send a patch, I received "Your message to dev awaits moderator approval" > from dev-owner@dpdk.org with the reason "Post by non-member to a members-only list". > Maybe, the reason is that this is the first time that I submit a patch. No, I don't think subscription is needed, there should be another issue. Ali & Thomas, any idea why it happens? Thanks, Maxime > Thanks, > Taekyung > ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-10 9:20 ` Maxime Coquelin @ 2022-11-10 9:34 ` Ali Alnubani 2022-11-10 9:38 ` David Marchand 2022-11-10 9:42 ` Maxime Coquelin 0 siblings, 2 replies; 24+ messages in thread From: Ali Alnubani @ 2022-11-10 9:34 UTC (permalink / raw) To: Maxime Coquelin, Taekyung Kim, NBU-Contact-Thomas Monjalon (EXTERNAL) Cc: dev, Pei, Andy, stable, Wang, Xiao W, Xia, Chenbo > -----Original Message----- > From: Maxime Coquelin <maxime.coquelin@redhat.com> > Sent: Thursday, November 10, 2022 11:20 AM > To: Taekyung Kim <kim.tae.kyung@navercorp.com>; NBU-Contact-Thomas > Monjalon (EXTERNAL) <thomas@monjalon.net>; Ali Alnubani > <alialnu@nvidia.com> > Cc: dev@dpdk.org; Pei, Andy <andy.pei@intel.com>; stable@dpdk.org; > Wang, Xiao W <xiao.w.wang@intel.com>; Xia, Chenbo > <chenbo.xia@intel.com> > Subject: Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling > > Hi Taekyung, > > Adding Thomas and Ali who maintains the patchwork instance. > > On 11/10/22 05:02, Taekyung Kim wrote: > > On Thu, Nov 10, 2022 at 01:53:50AM +0000, Xia, Chenbo wrote: > >> Hi Kim, > >> > >>> -----Original Message----- > >>> From: Taekyung Kim <kim.tae.kyung@navercorp.com> > >>> Sent: Tuesday, November 8, 2022 4:56 PM > >>> To: dev@dpdk.org > >>> Cc: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy > <andy.pei@intel.com>; > >>> kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; > stable@dpdk.org; > >>> Wang, Xiao W <xiao.w.wang@intel.com> > >>> Subject: [PATCH v4] vdpa/ifc: fix update_datapath error handling > >>> > >>> 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") > >>> Cc: stable@dpdk.org > >>> > >>> Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > >>> --- > >>> v4: > >>> * Add rte_vdpa_unregister_device in ifcvf_pci_probe > >>> > >>> v3: > >>> * Fix coding style > >>> > >>> v2: > >>> * Revert the prepared resources before returning an error > >>> * Rebase to 22.11 rc2 > >>> * Add fixes and cc for backport > >>> > >>> --- > >>> drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- > >>> 1 file changed, 23 insertions(+), 4 deletions(-) > >> > >> I can't find your patch in patchwork: > >> > >> > http://patchwork.dpdk.org/project/dpdk/list/?series=&submitter=2877&sta > te=*&q=&archive=both&delegate= > >> > >> so it's difficult to review and merge. Do you know why or is it possible > >> that you send a new version to make it show on Patchwork today? > >> > >> Thanks, > >> Chenbo > >> > > > > Hi Chenbo, > > > > First, thanks for your review. > > I will send a new version for this patch soon. > > > > I think the mail for v4 is lost. > > Whenever I send a patch, I received "Your message to dev awaits > moderator approval" > > from dev-owner@dpdk.org with the reason "Post by non-member to a > members-only list". > > Maybe, the reason is that this is the first time that I submit a patch. > > No, I don't think subscription is needed, there should be another issue. > Ali & Thomas, any idea why it happens? > Hello, Subscription to the dev mailing list is required for posting without moderator approval. I see that Taekyung is a member only since Nov 08. Postings prior to his subscription are waiting moderation. Thanks, Ali ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-10 9:34 ` Ali Alnubani @ 2022-11-10 9:38 ` David Marchand 2022-11-10 9:45 ` Taekyung Kim 2022-11-10 9:42 ` Maxime Coquelin 1 sibling, 1 reply; 24+ messages in thread From: David Marchand @ 2022-11-10 9:38 UTC (permalink / raw) To: Ali Alnubani Cc: Maxime Coquelin, Taekyung Kim, NBU-Contact-Thomas Monjalon (EXTERNAL), dev, Pei, Andy, stable, Wang, Xiao W, Xia, Chenbo On Thu, Nov 10, 2022 at 10:34 AM Ali Alnubani <alialnu@nvidia.com> wrote: > > > I think the mail for v4 is lost. > > > Whenever I send a patch, I received "Your message to dev awaits > > moderator approval" > > > from dev-owner@dpdk.org with the reason "Post by non-member to a > > members-only list". > > > Maybe, the reason is that this is the first time that I submit a patch. > > > > No, I don't think subscription is needed, there should be another issue. > > Ali & Thomas, any idea why it happens? > > > > Hello, > > Subscription to the dev mailing list is required for posting without moderator approval. > I see that Taekyung is a member only since Nov 08. Postings prior to his subscription are waiting moderation. Indeed, I just flushed the queue. -- David Marchand ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-10 9:38 ` David Marchand @ 2022-11-10 9:45 ` Taekyung Kim 0 siblings, 0 replies; 24+ messages in thread From: Taekyung Kim @ 2022-11-10 9:45 UTC (permalink / raw) To: David Marchand Cc: Ali Alnubani, Maxime Coquelin, NBU-Contact-Thomas Monjalon (EXTERNAL), dev, Pei, Andy, stable, Wang, Xiao W, Xia, Chenbo On Thu, Nov 10, 2022 at 10:38:55AM +0100, David Marchand wrote: > On Thu, Nov 10, 2022 at 10:34 AM Ali Alnubani <alialnu@nvidia.com> wrote: > > > > I think the mail for v4 is lost. > > > > Whenever I send a patch, I received "Your message to dev awaits > > > moderator approval" > > > > from dev-owner@dpdk.org with the reason "Post by non-member to a > > > members-only list". > > > > Maybe, the reason is that this is the first time that I submit a patch. > > > > > > No, I don't think subscription is needed, there should be another issue. > > > Ali & Thomas, any idea why it happens? > > > > > > > Hello, > > > > Subscription to the dev mailing list is required for posting without moderator approval. > > I see that Taekyung is a member only since Nov 08. Postings prior to his subscription are waiting moderation. > > Indeed, I just flushed the queue. > > > -- > David Marchand > Hello, I fully understand what was the problem. It was my mistake. I will be more cautious before sending a patch. Thanks for your detailed explanation. Thanks, Taekyung ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling 2022-11-10 9:34 ` Ali Alnubani 2022-11-10 9:38 ` David Marchand @ 2022-11-10 9:42 ` Maxime Coquelin 1 sibling, 0 replies; 24+ messages in thread From: Maxime Coquelin @ 2022-11-10 9:42 UTC (permalink / raw) To: Ali Alnubani, Taekyung Kim, NBU-Contact-Thomas Monjalon (EXTERNAL) Cc: dev, Pei, Andy, stable, Wang, Xiao W, Xia, Chenbo On 11/10/22 10:34, Ali Alnubani wrote: >> -----Original Message----- >> From: Maxime Coquelin <maxime.coquelin@redhat.com> >> Sent: Thursday, November 10, 2022 11:20 AM >> To: Taekyung Kim <kim.tae.kyung@navercorp.com>; NBU-Contact-Thomas >> Monjalon (EXTERNAL) <thomas@monjalon.net>; Ali Alnubani >> <alialnu@nvidia.com> >> Cc: dev@dpdk.org; Pei, Andy <andy.pei@intel.com>; stable@dpdk.org; >> Wang, Xiao W <xiao.w.wang@intel.com>; Xia, Chenbo >> <chenbo.xia@intel.com> >> Subject: Re: [PATCH v4] vdpa/ifc: fix update_datapath error handling >> >> Hi Taekyung, >> >> Adding Thomas and Ali who maintains the patchwork instance. >> >> On 11/10/22 05:02, Taekyung Kim wrote: >>> On Thu, Nov 10, 2022 at 01:53:50AM +0000, Xia, Chenbo wrote: >>>> Hi Kim, >>>> >>>>> -----Original Message----- >>>>> From: Taekyung Kim <kim.tae.kyung@navercorp.com> >>>>> Sent: Tuesday, November 8, 2022 4:56 PM >>>>> To: dev@dpdk.org >>>>> Cc: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy >> <andy.pei@intel.com>; >>>>> kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; >> stable@dpdk.org; >>>>> Wang, Xiao W <xiao.w.wang@intel.com> >>>>> Subject: [PATCH v4] vdpa/ifc: fix update_datapath error handling >>>>> >>>>> 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") >>>>> Cc: stable@dpdk.org >>>>> >>>>> Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> >>>>> --- >>>>> v4: >>>>> * Add rte_vdpa_unregister_device in ifcvf_pci_probe >>>>> >>>>> v3: >>>>> * Fix coding style >>>>> >>>>> v2: >>>>> * Revert the prepared resources before returning an error >>>>> * Rebase to 22.11 rc2 >>>>> * Add fixes and cc for backport >>>>> >>>>> --- >>>>> drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- >>>>> 1 file changed, 23 insertions(+), 4 deletions(-) >>>> >>>> I can't find your patch in patchwork: >>>> >>>> >> http://patchwork.dpdk.org/project/dpdk/list/?series=&submitter=2877&sta >> te=*&q=&archive=both&delegate= >>>> >>>> so it's difficult to review and merge. Do you know why or is it possible >>>> that you send a new version to make it show on Patchwork today? >>>> >>>> Thanks, >>>> Chenbo >>>> >>> >>> Hi Chenbo, >>> >>> First, thanks for your review. >>> I will send a new version for this patch soon. >>> >>> I think the mail for v4 is lost. >>> Whenever I send a patch, I received "Your message to dev awaits >> moderator approval" >>> from dev-owner@dpdk.org with the reason "Post by non-member to a >> members-only list". >>> Maybe, the reason is that this is the first time that I submit a patch. >> >> No, I don't think subscription is needed, there should be another issue. >> Ali & Thomas, any idea why it happens? >> > > Hello, > > Subscription to the dev mailing list is required for posting without moderator approval. > I see that Taekyung is a member only since Nov 08. Postings prior to his subscription are waiting moderation. Ok, thanks. I did not know! Maxime > Thanks, > Ali ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v5] vdpa/ifc: fix update_datapath error handling 2022-11-10 1:53 ` Xia, Chenbo 2022-11-10 4:02 ` Taekyung Kim @ 2022-11-10 4:09 ` Taekyung Kim 2022-11-10 6:12 ` Xia, Chenbo 2022-11-10 7:02 ` Xia, Chenbo 1 sibling, 2 replies; 24+ messages in thread From: Taekyung Kim @ 2022-11-10 4:09 UTC (permalink / raw) To: dev Cc: chenbo.xia, andy.pei, kim.tae.kyung, maxime.coquelin, stable, xiao.w.wang 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") Cc: stable@dpdk.org Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> --- v5: * Resubmit to patchwork v4: * Add rte_vdpa_unregister_device in ifcvf_pci_probe v3: * Fix coding style v2: * Revert the prepared resources before returning an error * Rebase to 22.11 rc2 * Add fixes and cc for backport --- 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 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) 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; + } hw = &internal->hw; for (i = 0; i < hw->nr_vring; i++) { @@ -1146,7 +1151,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; @@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, } 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; @@ -1781,7 +1799,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 ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v5] vdpa/ifc: fix update_datapath error handling 2022-11-10 4:09 ` [PATCH v5] " Taekyung Kim @ 2022-11-10 6:12 ` Xia, Chenbo 2022-11-10 7:02 ` Xia, Chenbo 1 sibling, 0 replies; 24+ messages in thread From: Xia, Chenbo @ 2022-11-10 6:12 UTC (permalink / raw) To: Taekyung Kim, dev; +Cc: Pei, Andy, maxime.coquelin, stable, Wang, Xiao W > -----Original Message----- > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > Sent: Thursday, November 10, 2022 12:10 PM > To: dev@dpdk.org > Cc: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy <andy.pei@intel.com>; > kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; stable@dpdk.org; > Wang, Xiao W <xiao.w.wang@intel.com> > Subject: [PATCH v5] vdpa/ifc: fix update_datapath error handling > > 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") > Cc: stable@dpdk.org > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > --- > v5: > * Resubmit to patchwork > > v4: > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > v3: > * Fix coding style > > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport > > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) > Thanks Kim for helping on resending. Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> Will help you add Maxime and Andy's Reviewed-by/Acked-by in commit log When applying. Thanks, Chenbo ^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH v5] vdpa/ifc: fix update_datapath error handling 2022-11-10 4:09 ` [PATCH v5] " Taekyung Kim 2022-11-10 6:12 ` Xia, Chenbo @ 2022-11-10 7:02 ` Xia, Chenbo 1 sibling, 0 replies; 24+ messages in thread From: Xia, Chenbo @ 2022-11-10 7:02 UTC (permalink / raw) To: Taekyung Kim, dev; +Cc: Pei, Andy, maxime.coquelin, stable, Wang, Xiao W > -----Original Message----- > From: Taekyung Kim <kim.tae.kyung@navercorp.com> > Sent: Thursday, November 10, 2022 12:10 PM > To: dev@dpdk.org > Cc: Xia, Chenbo <chenbo.xia@intel.com>; Pei, Andy <andy.pei@intel.com>; > kim.tae.kyung@navercorp.com; maxime.coquelin@redhat.com; stable@dpdk.org; > Wang, Xiao W <xiao.w.wang@intel.com> > Subject: [PATCH v5] vdpa/ifc: fix update_datapath error handling > > 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") > Cc: stable@dpdk.org > > Signed-off-by: Taekyung Kim <kim.tae.kyung@navercorp.com> > --- > v5: > * Resubmit to patchwork > > v4: > * Add rte_vdpa_unregister_device in ifcvf_pci_probe > > v3: > * Fix coding style > > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport > > --- > 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 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) > 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; > + } > > hw = &internal->hw; > for (i = 0; i < hw->nr_vring; i++) { > @@ -1146,7 +1151,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; > @@ -1752,7 +1762,15 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, > } > > 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; > @@ -1781,7 +1799,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 Applied to next-virtio/main, thanks ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2022-11-10 9:45 UTC | newest] Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-18 7:22 [PATCH] vdpa/ifc: fix update_datapath error handling Taekyung Kim 2022-11-02 9:12 ` Maxime Coquelin 2022-11-07 5:34 ` [PATCH v2] " Taekyung Kim 2022-11-07 8:59 ` [PATCH v3] " Taekyung Kim 2022-11-08 1:46 ` Xia, Chenbo 2022-11-08 7:30 ` Taekyung Kim 2022-11-08 7:39 ` Pei, Andy 2022-11-08 7:56 ` Xia, Chenbo 2022-11-08 8:27 ` Taekyung Kim 2022-11-08 8:56 ` [PATCH v4] " Taekyung Kim 2022-11-08 13:49 ` Maxime Coquelin 2022-11-09 10:45 ` Taekyung Kim 2022-11-09 2:39 ` Pei, Andy 2022-11-09 10:47 ` Taekyung Kim 2022-11-10 1:53 ` Xia, Chenbo 2022-11-10 4:02 ` Taekyung Kim 2022-11-10 9:20 ` Maxime Coquelin 2022-11-10 9:34 ` Ali Alnubani 2022-11-10 9:38 ` David Marchand 2022-11-10 9:45 ` Taekyung Kim 2022-11-10 9:42 ` Maxime Coquelin 2022-11-10 4:09 ` [PATCH v5] " Taekyung Kim 2022-11-10 6:12 ` Xia, Chenbo 2022-11-10 7:02 ` Xia, Chenbo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).