From: Jason Gunthorpe <jgg@mellanox•com>
To: Leon Romanovsky <leon@kernel•org>
Cc: Doug Ledford <dledford@redhat•com>,
Leon Romanovsky <leonro@mellanox•com>,
RDMA mailing list <linux-rdma@vger•kernel.org>,
Artemy Kovalyov <artemyko@mellanox•com>,
Majd Dibbiny <majd@mellanox•com>, Moni Shoua <monis@mellanox•com>,
Saeed Mahameed <saeedm@mellanox•com>,
linux-netdev <netdev@vger•kernel.org>
Subject: Re: [PATCH mlx5-next 08/10] IB/mlx5: Call PAGE_FAULT_RESUME command asynchronously
Date: Thu, 8 Nov 2018 19:49:03 +0000 [thread overview]
Message-ID: <20181108194857.GF5548@mellanox.com> (raw)
In-Reply-To: <20181108191017.21891-9-leon@kernel.org>
On Thu, Nov 08, 2018 at 09:10:15PM +0200, Leon Romanovsky wrote:
> From: Moni Shoua <monis@mellanox•com>
>
> Telling the HCA that page fault handling is done and QP can resume
> its flow is done in the context of the page fault handler. This blocks
> the handling of the next work in queue without a need.
> Call the PAGE_FAULT_RESUME command in an asynchronous manner and free
> the workqueue to pick the next work item for handling. All tasks that
> were executed after PAGE_FAULT_RESUME need to be done now
> in the callback of the asynchronous command mechanism.
>
> Signed-off-by: Moni Shoua <monis@mellanox•com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox•com>
> drivers/infiniband/hw/mlx5/odp.c | 110 +++++++++++++++++++++++++------
> include/linux/mlx5/driver.h | 3 +
> 2 files changed, 94 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
> index abce55b8b9ba..0c4f469cdd5b 100644
> +++ b/drivers/infiniband/hw/mlx5/odp.c
> @@ -298,20 +298,78 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
> return;
> }
>
> +struct pfault_resume_cb_ctx {
> + struct mlx5_ib_dev *dev;
> + struct mlx5_core_rsc_common *res;
> + struct mlx5_pagefault *pfault;
> +};
> +
> +static void page_fault_resume_callback(int status, void *context)
> +{
> + struct pfault_resume_cb_ctx *ctx = context;
> + struct mlx5_pagefault *pfault = ctx->pfault;
> +
> + if (status)
> + mlx5_ib_err(ctx->dev, "Resolve the page fault failed with status %d\n",
> + status);
> +
> + if (ctx->res)
> + mlx5_core_res_put(ctx->res);
> + kfree(pfault);
> + kfree(ctx);
> +}
> +
> static void mlx5_ib_page_fault_resume(struct mlx5_ib_dev *dev,
> + struct mlx5_core_rsc_common *res,
> struct mlx5_pagefault *pfault,
> - int error)
> + int error,
> + bool async)
> {
> + int ret = 0;
> + u32 *out = pfault->out_pf_resume;
> + u32 *in = pfault->in_pf_resume;
> + u32 token = pfault->token;
> int wq_num = pfault->event_subtype == MLX5_PFAULT_SUBTYPE_WQE ?
> - pfault->wqe.wq_num : pfault->token;
> - int ret = mlx5_core_page_fault_resume(dev->mdev,
> - pfault->token,
> - wq_num,
> - pfault->type,
> - error);
> - if (ret)
> - mlx5_ib_err(dev, "Failed to resolve the page fault on WQ 0x%x\n",
> - wq_num);
> + pfault->wqe.wq_num : pfault->token;
> + u8 type = pfault->type;
> + struct pfault_resume_cb_ctx *ctx = NULL;
> +
> + if (async)
> + ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
Why not allocate this ctx ast part of the mlx5_pagefault and avoid
this allocation failure strategy?
Jason
next prev parent reply other threads:[~2018-11-09 5:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 19:10 [PATCH mlx5-next 00/10] Collection of ODP fixes Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 01/10] net/mlx5: Release resource on error flow Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 02/10] IB/mlx5: Avoid hangs due to a missing completion Leon Romanovsky
2018-11-08 19:44 ` Jason Gunthorpe
2018-11-09 16:17 ` Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 03/10] net/mlx5: Add interface to hold and release core resources Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 04/10] net/mlx5: Enumerate page fault types Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 05/10] IB/mlx5: Lock QP during page fault handling Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 06/10] net/mlx5: Return success for PAGE_FAULT_RESUME in internal error state Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 07/10] net/mlx5: Use multi threaded workqueue for page fault handling Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 08/10] IB/mlx5: Call PAGE_FAULT_RESUME command asynchronously Leon Romanovsky
2018-11-08 19:49 ` Jason Gunthorpe [this message]
2018-11-09 16:26 ` Leon Romanovsky
2018-11-09 16:59 ` Jason Gunthorpe
2018-11-10 15:47 ` Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 09/10] net/mlx5: Remove unused function Leon Romanovsky
2018-11-08 19:10 ` [PATCH mlx5-next 10/10] IB/mlx5: Improve ODP debugging messages Leon Romanovsky
2018-11-08 19:45 ` [PATCH mlx5-next 00/10] Collection of ODP fixes Jason Gunthorpe
2018-11-08 19:50 ` Saeed Mahameed
2018-11-12 20:43 ` Leon Romanovsky
2018-11-19 22:25 ` Jason Gunthorpe
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=20181108194857.GF5548@mellanox.com \
--to=jgg@mellanox$(echo .)com \
--cc=artemyko@mellanox$(echo .)com \
--cc=dledford@redhat$(echo .)com \
--cc=leon@kernel$(echo .)org \
--cc=leonro@mellanox$(echo .)com \
--cc=linux-rdma@vger$(echo .)kernel.org \
--cc=majd@mellanox$(echo .)com \
--cc=monis@mellanox$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=saeedm@mellanox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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