diff mbox series

[v5,23/24] hw/pvrdma: Do not clean resources on shutdown

Message ID 20181122121402.13764-24-yuval.shaia@oracle.com (mailing list archive)
State New, archived
Headers show
Series Add support for RDMA MAD | expand

Commit Message

Yuval Shaia Nov. 22, 2018, 12:14 p.m. UTC
All resources are already cleaned at rm_fini phase.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 hw/rdma/rdma_backend.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

Comments

Yuval Shaia Nov. 25, 2018, 7:30 a.m. UTC | #1
On Thu, Nov 22, 2018 at 02:14:01PM +0200, Yuval Shaia wrote:
> All resources are already cleaned at rm_fini phase.

Please ignore this patch, i will squash it to patch #5.

> 
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>  hw/rdma/rdma_backend.c | 21 +--------------------
>  1 file changed, 1 insertion(+), 20 deletions(-)
> 
> diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
> index 6a1e39d4c0..8ab25e94b1 100644
> --- a/hw/rdma/rdma_backend.c
> +++ b/hw/rdma/rdma_backend.c
> @@ -1075,28 +1075,9 @@ static int mad_init(RdmaBackendDev *backend_dev, CharBackend *mad_chr_be)
>  
>  static void mad_stop(RdmaBackendDev *backend_dev)
>  {
> -    QObject *o_ctx_id;
> -    unsigned long cqe_ctx_id;
> -    BackendCtx *bctx;
> -
> -    pr_dbg("Closing MAD\n");
> +    pr_dbg("Stopping MAD\n");
>  
>      disable_rdmacm_mux_async(backend_dev);
> -
> -    /* Clear MAD buffers list */
> -    qemu_mutex_lock(&backend_dev->recv_mads_list.lock);
> -    do {
> -        o_ctx_id = qlist_pop(backend_dev->recv_mads_list.list);
> -        if (o_ctx_id) {
> -            cqe_ctx_id = qnum_get_uint(qobject_to(QNum, o_ctx_id));
> -            bctx = rdma_rm_get_cqe_ctx(backend_dev->rdma_dev_res, cqe_ctx_id);
> -            if (bctx) {
> -                rdma_rm_dealloc_cqe_ctx(backend_dev->rdma_dev_res, cqe_ctx_id);
> -                g_free(bctx);
> -            }
> -        }
> -    } while (o_ctx_id);
> -    qemu_mutex_unlock(&backend_dev->recv_mads_list.lock);
>  }
>  
>  static void mad_fini(RdmaBackendDev *backend_dev)
> -- 
> 2.17.2
>
Marcel Apfelbaum Nov. 25, 2018, 7:41 a.m. UTC | #2
On 11/22/18 2:14 PM, Yuval Shaia wrote:
> All resources are already cleaned at rm_fini phase.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>   hw/rdma/rdma_backend.c | 21 +--------------------
>   1 file changed, 1 insertion(+), 20 deletions(-)
>
> diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
> index 6a1e39d4c0..8ab25e94b1 100644
> --- a/hw/rdma/rdma_backend.c
> +++ b/hw/rdma/rdma_backend.c
> @@ -1075,28 +1075,9 @@ static int mad_init(RdmaBackendDev *backend_dev, CharBackend *mad_chr_be)
>   
>   static void mad_stop(RdmaBackendDev *backend_dev)
>   {
> -    QObject *o_ctx_id;
> -    unsigned long cqe_ctx_id;
> -    BackendCtx *bctx;
> -
> -    pr_dbg("Closing MAD\n");
> +    pr_dbg("Stopping MAD\n");
>   
>       disable_rdmacm_mux_async(backend_dev);
> -
> -    /* Clear MAD buffers list */
> -    qemu_mutex_lock(&backend_dev->recv_mads_list.lock);
> -    do {
> -        o_ctx_id = qlist_pop(backend_dev->recv_mads_list.list);
> -        if (o_ctx_id) {
> -            cqe_ctx_id = qnum_get_uint(qobject_to(QNum, o_ctx_id));
> -            bctx = rdma_rm_get_cqe_ctx(backend_dev->rdma_dev_res, cqe_ctx_id);
> -            if (bctx) {
> -                rdma_rm_dealloc_cqe_ctx(backend_dev->rdma_dev_res, cqe_ctx_id);
> -                g_free(bctx);
> -            }
> -        }
> -    } while (o_ctx_id);
> -    qemu_mutex_unlock(&backend_dev->recv_mads_list.lock);
>   }
>   
>   static void mad_fini(RdmaBackendDev *backend_dev)
>

Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

Thanks,
Marcel
diff mbox series

Patch

diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
index 6a1e39d4c0..8ab25e94b1 100644
--- a/hw/rdma/rdma_backend.c
+++ b/hw/rdma/rdma_backend.c
@@ -1075,28 +1075,9 @@  static int mad_init(RdmaBackendDev *backend_dev, CharBackend *mad_chr_be)
 
 static void mad_stop(RdmaBackendDev *backend_dev)
 {
-    QObject *o_ctx_id;
-    unsigned long cqe_ctx_id;
-    BackendCtx *bctx;
-
-    pr_dbg("Closing MAD\n");
+    pr_dbg("Stopping MAD\n");
 
     disable_rdmacm_mux_async(backend_dev);
-
-    /* Clear MAD buffers list */
-    qemu_mutex_lock(&backend_dev->recv_mads_list.lock);
-    do {
-        o_ctx_id = qlist_pop(backend_dev->recv_mads_list.list);
-        if (o_ctx_id) {
-            cqe_ctx_id = qnum_get_uint(qobject_to(QNum, o_ctx_id));
-            bctx = rdma_rm_get_cqe_ctx(backend_dev->rdma_dev_res, cqe_ctx_id);
-            if (bctx) {
-                rdma_rm_dealloc_cqe_ctx(backend_dev->rdma_dev_res, cqe_ctx_id);
-                g_free(bctx);
-            }
-        }
-    } while (o_ctx_id);
-    qemu_mutex_unlock(&backend_dev->recv_mads_list.lock);
 }
 
 static void mad_fini(RdmaBackendDev *backend_dev)