All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 00/10] iSER support for remote invalidate
@ 2015-11-24 16:23 Sagi Grimberg
       [not found] ` <1448382234-24806-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Sagi Grimberg @ 2015-11-24 16:23 UTC (permalink / raw)
  To: linux-rdma, target-devel
  Cc: Nicholas A. Bellinger, Or Gerlitz, Jenny Derzhavetz, Steve Wise

This patchset adds remote invalidation support to iser initiator and
target. The support negotiation for this feature is based on IBTA
annex 12 "Support for iSCSI Extensions for RDMA" carried in rdma_cm
private data.

Remote invalidation allows a peer host to invalidate a remote key
as part of a SEND operation. This feature allows a host to avoid
invalidating an rkey locally. By supporting this feature iser initiator
can save extra latency and processing time yielded by invalidating 
the memory key locally.

The initiator feature support is dependent on:
- fastreg is used (not FMR)
- always_register=Y

In this case the initiator will expose support for remote invalidation,
however it will not blindly rely on the target to do so and will verify
that in the work completion information. The iser target now looks into
the iser header in the CM request and in case the initiator supports
remote invalidation it will respond it will use remote invalidation for
provided remote keys.

Thanks a lot to all the reviewers!

Changes from v0:
- Rebased on top of 4.4-rc2
- Removed iser_hello messages from the protocol header
- Avoided from further breaking the non-existent bidi support
- Fixed initiator remote invalidate support exposure only
  for fastreg && iser_always_register
- Removed patch 2/10 as it's still under testing.
- Minor line-spacing nitpicks CR comments fixes.
- Added a FIXME comment to declare our debt to Or and Jason
  on the awkward device->mr->rkey deref.
- Piggybacked another patch that reduces some iser code that
  is now available by the ib_core (ib_sg_to_pages).

Code is available at:
git@github.com:sagigrimberg/linux.git iser-remote-inv

Jenny Derzhavetz (5):
  IB/iser: Don't register memory for all immediatedata writes
  IB/iser: set intuitive values for mr_valid
  iser-target: Declare correct flags when accepting a connection
  iser-target: Support the remote invalidation exception
  IB/iser: Support the remote invalidation exception

Roi Dayan (1):
  IB/iser: Fix module init not cleaning up on error flow

Sagi Grimberg (4):
  IB/iser: Reuse ib_sg_to_pages
  iser: Have initiator and target to share protocol structures and
    definitions
  iser-target: Remove unused file iser_proto.h
  IB/iser: Increment the rkey when registering and not when invalidating

 drivers/infiniband/ulp/iser/iscsi_iser.c     |   9 +-
 drivers/infiniband/ulp/iser/iscsi_iser.h     |  54 +++-------
 drivers/infiniband/ulp/iser/iser_initiator.c |  70 +++++++++++--
 drivers/infiniband/ulp/iser/iser_memory.c    | 150 +++++++++------------------
 drivers/infiniband/ulp/iser/iser_verbs.c     |  30 ++++--
 drivers/infiniband/ulp/isert/ib_isert.c      |  73 +++++++++----
 drivers/infiniband/ulp/isert/ib_isert.h      |  40 ++++++-
 drivers/infiniband/ulp/isert/isert_proto.h   |  47 ---------
 include/scsi/iser.h                          |  78 ++++++++++++++
 9 files changed, 322 insertions(+), 229 deletions(-)
 delete mode 100644 drivers/infiniband/ulp/isert/isert_proto.h
 create mode 100644 include/scsi/iser.h

-- 
1.8.4.3

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: [PATCH v1 10/10] IB/iser: Support the remote invalidation exception
@ 2015-11-30 21:36 Or Gerlitz
  2015-12-01 10:43 ` Sagi Grimberg
  0 siblings, 1 reply; 24+ messages in thread
From: Or Gerlitz @ 2015-11-30 21:36 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: linux-rdma@vger.kernel.org, target-devel, Nicholas A. Bellinger,
	Or Gerlitz, Jenny Derzhavetz, Steve Wise

On Tue, Nov 24, 2015 at 6:23 PM, Sagi Grimberg <sagig@mellanox.com> wrote:
>
> From: Jenny Derzhavetz <jennyf@mellanox.com>
>
> Declare that we support remote invalidation in case we are:
> 1. using Fastreg method
> 2. always registering memory.

decide if you want or don't want to use periods @ the end of these
cases, but be consistent... I vote not to use periods

>
> Detect the invalidated rkey from the work completion info so we
> won't invalidate it locally. The spec madates that we must not rely
> on the taget remote invalidate our rkey so we must check it upon
> a receive (scsi response) completion.
>

s/madates/mandates/ and run spell check over the change-logs of the
whole series please before posting v2



>
> Signed-off-by: Jenny Derzhavetz <jennyf@mellanox.com>
> Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
> ---
>  drivers/infiniband/ulp/iser/iscsi_iser.h     |  5 ++-
>  drivers/infiniband/ulp/iser/iser_initiator.c | 59 +++++++++++++++++++++++++++-
>  drivers/infiniband/ulp/iser/iser_memory.c    |  4 +-
>  drivers/infiniband/ulp/iser/iser_verbs.c     | 21 +++++++---
>  4 files changed, 80 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
> index c79fdba6f969..e399d9a49df2 100644
> --- a/drivers/infiniband/ulp/iser/iscsi_iser.h
> +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
> @@ -358,6 +358,7 @@ struct iser_reg_ops {
>   *                 cpus and device max completion vectors
>   * @comps:         Dinamically allocated array of completion handlers
>   * @reg_ops:       Registration ops
> + * @remote_inv_sup: Remote invalidate is supported on this device
>   */
>  struct iser_device {
>         struct ib_device             *ib_device;
> @@ -370,6 +371,7 @@ struct iser_device {
>         int                          comps_used;
>         struct iser_comp             *comps;
>         struct iser_reg_ops          *reg_ops;
> +       bool                         remote_inv_sup;
>  };
>
>  #define ISER_CHECK_GUARD       0xc0
> @@ -519,6 +521,7 @@ struct iser_conn {
>         u32                          num_rx_descs;
>         unsigned short               scsi_sg_tablesize;
>         unsigned int                 scsi_max_sectors;
> +       bool                         snd_w_inv;
>  };
>
>  /**
> @@ -602,7 +605,7 @@ int iser_conn_terminate(struct iser_conn *iser_conn);
>  void iser_release_work(struct work_struct *work);
>
>  void iser_rcv_completion(struct iser_rx_desc *desc,
> -                        unsigned long dto_xfer_len,
> +                        struct ib_wc *wc,
>                          struct ib_conn *ib_conn);
>
>  void iser_snd_completion(struct iser_tx_desc *desc,
> diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
> index 6a968e350c14..cd12f89b3365 100644
> --- a/drivers/infiniband/ulp/iser/iser_initiator.c
> +++ b/drivers/infiniband/ulp/iser/iser_initiator.c
> @@ -563,11 +563,61 @@ send_control_error:
>         return err;
>  }
>
> +static inline void
> +iser_inv_desc(struct iser_fr_desc *desc, u32 rkey)
> +{
> +       if (likely(rkey == desc->rsc.mr->rkey))
> +               desc->rsc.mr_valid = 0;
> +       else if (likely(rkey == desc->pi_ctx->sig_mr->rkey))
> +               desc->pi_ctx->sig_mr_valid = 0;
> +}
> +
> +static int
> +iser_check_remote_inv(struct iser_conn *iser_conn,
> +                     struct ib_wc *wc,
> +                     struct iscsi_hdr *hdr)
> +{
> +       if (wc->wc_flags & IB_WC_WITH_INVALIDATE) {
> +               struct iscsi_task *task;
> +               u32 rkey = wc->ex.invalidate_rkey;
> +
> +               iser_dbg("conn %p: remote invalidation for rkey %#x\n",
> +                        iser_conn, rkey);
> +
> +               if (unlikely(!iser_conn->snd_w_inv)) {
> +                       iser_err("conn %p: unexepected remote invalidation, "
> +                                "terminating connection\n", iser_conn);
> +                       return -EPROTO;
> +               }
> +
> +               task = iscsi_itt_to_ctask(iser_conn->iscsi_conn, hdr->itt);
> +               if (likely(task)) {
> +                       struct iscsi_iser_task *iser_task = task->dd_data;
> +                       struct iser_fr_desc *desc;
> +
> +                       if (iser_task->dir[ISER_DIR_IN]) {
> +                               desc = iser_task->rdma_reg[ISER_DIR_IN].mem_h;
> +                               iser_inv_desc(desc, rkey);
> +                       }
> +
> +                       if (iser_task->dir[ISER_DIR_OUT]) {
> +                               desc = iser_task->rdma_reg[ISER_DIR_OUT].mem_h;
> +                               iser_inv_desc(desc, rkey);
> +                       }
> +               } else {
> +                       iser_err("failed to get task for itt=%d\n", hdr->itt);
> +                       return -EINVAL;
> +               }
> +       }
> +
> +       return 0;
> +}
> +
>  /**
>   * iser_rcv_dto_completion - recv DTO completion
>   */
>  void iser_rcv_completion(struct iser_rx_desc *rx_desc,
> -                        unsigned long rx_xfer_len,
> +                        struct ib_wc *wc,
>                          struct ib_conn *ib_conn)
>  {
>         struct iser_conn *iser_conn = container_of(ib_conn, struct iser_conn,
> @@ -575,6 +625,7 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
>         struct iscsi_hdr *hdr;
>         u64 rx_dma;
>         int rx_buflen, outstanding, count, err;
> +       unsigned long rx_xfer_len = wc->byte_len;
>
>         /* differentiate between login to all other PDUs */
>         if ((char *)rx_desc == iser_conn->login_resp_buf) {
> @@ -593,6 +644,12 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
>         iser_dbg("op 0x%x itt 0x%x dlen %d\n", hdr->opcode,
>                         hdr->itt, (int)(rx_xfer_len - ISER_HEADERS_LEN));
>
> +       if (iser_check_remote_inv(iser_conn, wc, hdr)) {
> +               iscsi_conn_failure(iser_conn->iscsi_conn,
> +                                  ISCSI_ERR_CONN_FAILED);
> +               return;
> +       }
> +
>         iscsi_iser_recv(iser_conn->iscsi_conn, hdr, rx_desc->data,
>                         rx_xfer_len - ISER_HEADERS_LEN);
>
> diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
> index c008fc262aee..8a57d4eadda6 100644
> --- a/drivers/infiniband/ulp/iser/iser_memory.c
> +++ b/drivers/infiniband/ulp/iser/iser_memory.c
> @@ -76,10 +76,10 @@ int iser_assign_reg_ops(struct iser_device *device)
>             device->ib_device->map_phys_fmr && device->ib_device->unmap_fmr) {
>                 iser_info("FMR supported, using FMR for registration\n");
>                 device->reg_ops = &fmr_ops;
> -       } else
> -       if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {
> +       } else if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {
>                 iser_info("FastReg supported, using FastReg for registration\n");
>                 device->reg_ops = &fastreg_ops;
> +               device->remote_inv_sup = iser_always_reg;
>         } else {
>                 iser_err("IB device does not support FMRs nor FastRegs, can't register memory\n");
>                 return -1;
> diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
> index 9ba5214f0e02..8d25c503d32b 100644
> --- a/drivers/infiniband/ulp/iser/iser_verbs.c
> +++ b/drivers/infiniband/ulp/iser/iser_verbs.c
> @@ -847,7 +847,9 @@ static void iser_route_handler(struct rdma_cm_id *cma_id)
>         conn_param.rnr_retry_count     = 6;
>
>         memset(&req_hdr, 0, sizeof(req_hdr));
> -       req_hdr.flags = (ISER_ZBVA_NOT_SUP | ISER_SEND_W_INV_NOT_SUP);
> +       req_hdr.flags = ISER_ZBVA_NOT_SUP;
> +       if (!device->remote_inv_sup)
> +               req_hdr.flags |= ISER_SEND_W_INV_NOT_SUP;
>         conn_param.private_data = (void *)&req_hdr;
>         conn_param.private_data_len = sizeof(struct iser_cm_hdr);
>
> @@ -862,7 +864,8 @@ failure:
>         iser_connect_error(cma_id);
>  }
>
> -static void iser_connected_handler(struct rdma_cm_id *cma_id)
> +static void iser_connected_handler(struct rdma_cm_id *cma_id,
> +                                  const void *private_data)
>  {
>         struct iser_conn *iser_conn;
>         struct ib_qp_attr attr;
> @@ -876,6 +879,15 @@ static void iser_connected_handler(struct rdma_cm_id *cma_id)
>         (void)ib_query_qp(cma_id->qp, &attr, ~0, &init_attr);
>         iser_info("remote qpn:%x my qpn:%x\n", attr.dest_qp_num, cma_id->qp->qp_num);
>
> +       if (private_data) {
> +               u8 flags = *(u8 *)private_data;
> +
> +               iser_conn->snd_w_inv = !(flags & ISER_SEND_W_INV_NOT_SUP);
> +       }
> +
> +       iser_info("conn %p: negotiated %s invalidation\n",
> +                 iser_conn, iser_conn->snd_w_inv ? "remote" : "local");
> +
>         iser_conn->state = ISER_CONN_UP;
>         complete(&iser_conn->up_completion);
>  }
> @@ -927,7 +939,7 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
>                 iser_route_handler(cma_id);
>                 break;
>         case RDMA_CM_EVENT_ESTABLISHED:
> -               iser_connected_handler(cma_id);
> +               iser_connected_handler(cma_id, event->param.conn.private_data);
>                 break;
>         case RDMA_CM_EVENT_ADDR_ERROR:
>         case RDMA_CM_EVENT_ROUTE_ERROR:
> @@ -1205,8 +1217,7 @@ static void iser_handle_wc(struct ib_wc *wc)
>         if (likely(wc->status == IB_WC_SUCCESS)) {
>                 if (wc->opcode == IB_WC_RECV) {
>                         rx_desc = (struct iser_rx_desc *)(uintptr_t)wc->wr_id;
> -                       iser_rcv_completion(rx_desc, wc->byte_len,
> -                                           ib_conn);
> +                       iser_rcv_completion(rx_desc, wc, ib_conn);
>                 } else
>                 if (wc->opcode == IB_WC_SEND) {
>                         tx_desc = (struct iser_tx_desc *)(uintptr_t)wc->wr_id;
> --
> 1.8.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2015-12-01 10:43 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-24 16:23 [PATCH v1 00/10] iSER support for remote invalidate Sagi Grimberg
     [not found] ` <1448382234-24806-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-11-24 16:23   ` [PATCH v1 01/10] IB/iser: Fix module init not cleaning up on error flow Sagi Grimberg
2015-11-24 16:23   ` [PATCH v1 02/10] IB/iser: Reuse ib_sg_to_pages Sagi Grimberg
2015-11-24 16:23   ` [PATCH v1 04/10] IB/iser: set intuitive values for mr_valid Sagi Grimberg
2015-11-24 16:23   ` [PATCH v1 05/10] iser: Have initiator and target to share protocol structures and definitions Sagi Grimberg
2015-11-24 16:23   ` [PATCH v1 08/10] iser-target: Support the remote invalidation exception Sagi Grimberg
     [not found]     ` <1448382234-24806-9-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-11-24 17:42       ` Or Gerlitz
     [not found]         ` <CAJ3xEMjPwD3X-B+56-+sZ9RqMrcNgr_Y060nR3wLMhi_O0MgqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-25  7:55           ` Sagi Grimberg
2015-11-25  8:41             ` Or Gerlitz
2015-11-25  8:48               ` Sagi Grimberg
2015-11-25 18:24                 ` Or Gerlitz
2015-11-26  8:55                   ` Sagi Grimberg
2015-11-24 16:23 ` [PATCH v1 03/10] IB/iser: Don't register memory for all immediatedata writes Sagi Grimberg
2015-11-24 16:46   ` Steve Wise
     [not found]   ` <1448382234-24806-4-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-11-24 19:09     ` Or Gerlitz
2015-11-24 16:23 ` [PATCH v1 06/10] iser-target: Remove unused file iser_proto.h Sagi Grimberg
2015-11-24 16:23 ` [PATCH v1 07/10] iser-target: Declare correct flags when accepting a connection Sagi Grimberg
2015-11-24 16:23 ` [PATCH v1 09/10] IB/iser: Increment the rkey when registering and not when invalidating Sagi Grimberg
2015-11-24 19:12   ` Or Gerlitz
2015-11-24 16:23 ` [PATCH v1 10/10] IB/iser: Support the remote invalidation exception Sagi Grimberg
     [not found]   ` <1448382234-24806-11-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-11-30 13:27     ` Haggai Eran
2015-11-24 16:55 ` [PATCH v1 00/10] iSER support for remote invalidate Steve Wise
  -- strict thread matches above, loose matches on Subject: below --
2015-11-30 21:36 [PATCH v1 10/10] IB/iser: Support the remote invalidation exception Or Gerlitz
2015-12-01 10:43 ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.