From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Yuval Shaia <yuval.shaia@oracle.com>,
dgilbert@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 08/10] hw/rdma: Free all MAD receive buffers when device is closed
Date: Wed, 6 Feb 2019 12:19:31 +0200 [thread overview]
Message-ID: <67b1643e-c48a-2d58-acdb-415558b9ccf7@gmail.com> (raw)
In-Reply-To: <20190131130850.6850-9-yuval.shaia@oracle.com>
On 1/31/19 3:08 PM, Yuval Shaia wrote:
> When device is going down free all saved MAD buffers.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
> hw/rdma/rdma_backend.c | 32 ++++++++++++++++++++++++++++++++
> hw/rdma/rdma_backend.h | 1 +
> 2 files changed, 33 insertions(+)
>
> diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
> index d43fb1e677..65b28aa5b2 100644
> --- a/hw/rdma/rdma_backend.c
> +++ b/hw/rdma/rdma_backend.c
> @@ -64,6 +64,32 @@ static inline void complete_work(enum ibv_wc_status status, uint32_t vendor_err,
> comp_handler(ctx, &wc);
> }
>
> +static void free_cqe_ctx(gpointer data, gpointer user_data)
> +{
> + BackendCtx *bctx;
> + RdmaDeviceResources *rdma_dev_res = user_data;
> + unsigned long cqe_ctx_id = GPOINTER_TO_INT(data);
> +
> + bctx = rdma_rm_get_cqe_ctx(rdma_dev_res, cqe_ctx_id);
> + if (bctx) {
> + rdma_rm_dealloc_cqe_ctx(rdma_dev_res, cqe_ctx_id);
> + }
> + g_free(bctx);
> +}
> +
> +static void clean_recv_mads(RdmaBackendDev *backend_dev)
> +{
> + unsigned long cqe_ctx_id;
> +
> + do {
> + cqe_ctx_id = rdma_locked_list_pop_int64(&backend_dev->recv_mads_list);
> + if (cqe_ctx_id != -ENOENT) {
> + free_cqe_ctx(GINT_TO_POINTER(cqe_ctx_id),
> + backend_dev->rdma_dev_res);
> + }
> + } while (cqe_ctx_id != -ENOENT);
> +}
> +
> static int rdma_poll_cq(RdmaDeviceResources *rdma_dev_res, struct ibv_cq *ibcq)
> {
> int i, ne, total_ne = 0;
> @@ -1029,6 +1055,11 @@ static int mad_init(RdmaBackendDev *backend_dev, CharBackend *mad_chr_be)
> return 0;
> }
>
> +static void mad_stop(RdmaBackendDev *backend_dev)
> +{
> + clean_recv_mads(backend_dev);
> +}
> +
> static void mad_fini(RdmaBackendDev *backend_dev)
> {
> disable_rdmacm_mux_async(backend_dev);
> @@ -1216,6 +1247,7 @@ void rdma_backend_start(RdmaBackendDev *backend_dev)
>
> void rdma_backend_stop(RdmaBackendDev *backend_dev)
> {
> + mad_stop(backend_dev);
> stop_backend_thread(&backend_dev->comp_thread);
> }
>
> diff --git a/hw/rdma/rdma_backend.h b/hw/rdma/rdma_backend.h
> index 36305cd148..6abc367a52 100644
> --- a/hw/rdma/rdma_backend.h
> +++ b/hw/rdma/rdma_backend.h
> @@ -33,6 +33,7 @@
> #define VENDOR_ERR_MR_SMALL 0x208
> #define VENDOR_ERR_INV_MAD_BUFF 0x209
> #define VENDOR_ERR_INV_GID_IDX 0x210
> +#define VENDOR_ERR_DEV_GOING_DOWN 0x211
>
> /* Add definition for QP0 and QP1 as there is no userspace enums for them */
> enum ibv_special_qp_type {
Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Thanks,
Marcel
next prev parent reply other threads:[~2019-02-06 10:19 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-31 13:08 [Qemu-devel] [PATCH 00/10] Misc fixes to pvrdma device Yuval Shaia
2019-01-31 13:08 ` [Qemu-devel] [PATCH 01/10] hw/rdma: Switch to generic error reporting way Yuval Shaia
2019-02-01 12:36 ` Dr. David Alan Gilbert
2019-02-03 7:32 ` Yuval Shaia
2019-01-31 13:08 ` [Qemu-devel] [PATCH 02/10] hw/rdma: Introduce locked qlist Yuval Shaia
2019-02-07 9:05 ` Marcel Apfelbaum
2019-02-07 10:28 ` Yuval Shaia
2019-01-31 13:08 ` [Qemu-devel] [PATCH 03/10] hw/rdma: Warn when too many consecutive poll CQ triggered on an empty CQ Yuval Shaia
2019-02-06 10:14 ` Marcel Apfelbaum
2019-02-06 14:59 ` Yuval Shaia
2019-02-06 15:02 ` Yuval Shaia
2019-01-31 13:08 ` [Qemu-devel] [PATCH 04/10] hw/rdma: Protect against concurrent execution of poll_cq Yuval Shaia
2019-02-05 20:14 ` Marcel Apfelbaum
2019-01-31 13:08 ` [Qemu-devel] [PATCH 05/10] hw/pvrdma: Add device statistics counters Yuval Shaia
2019-02-06 10:17 ` Marcel Apfelbaum
2019-02-06 14:44 ` Yuval Shaia
2019-01-31 13:08 ` [Qemu-devel] [PATCH 06/10] hw/pvrdma: Dump device statistics counters to file Yuval Shaia
2019-02-04 13:03 ` Markus Armbruster
2019-02-04 16:14 ` Yuval Shaia
2019-02-04 18:21 ` Markus Armbruster
2019-01-31 13:08 ` [Qemu-devel] [PATCH 07/10] monitor: Expose pvrdma device statistics counters Yuval Shaia
2019-01-31 13:17 ` Eric Blake
2019-01-31 20:08 ` Yuval Shaia
2019-01-31 20:52 ` Eric Blake
2019-02-01 7:33 ` Markus Armbruster
2019-02-01 11:42 ` Dr. David Alan Gilbert
2019-02-03 7:12 ` Yuval Shaia
2019-02-03 7:06 ` Yuval Shaia
2019-02-04 8:23 ` Markus Armbruster
2019-02-04 16:07 ` Yuval Shaia
2019-02-05 7:21 ` Markus Armbruster
2019-02-04 8:00 ` Markus Armbruster
2019-01-31 13:08 ` [Qemu-devel] [PATCH 08/10] hw/rdma: Free all MAD receive buffers when device is closed Yuval Shaia
2019-02-06 10:19 ` Marcel Apfelbaum [this message]
2019-01-31 13:08 ` [Qemu-devel] [PATCH 09/10] hw/rdma: Free all receive buffers when QP is destroyed Yuval Shaia
2019-02-06 10:23 ` Marcel Apfelbaum
2019-02-06 15:55 ` Yuval Shaia
2019-01-31 13:08 ` [Qemu-devel] [PATCH 10/10] hw/pvrdma: Delete unneeded function argument Yuval Shaia
2019-02-05 20:16 ` Marcel Apfelbaum
2019-02-02 13:50 ` [Qemu-devel] [PATCH 00/10] Misc fixes to pvrdma device no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67b1643e-c48a-2d58-acdb-415558b9ccf7@gmail.com \
--to=marcel.apfelbaum@gmail.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yuval.shaia@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).