Skip to contentSkip to conversation

MR cleanups

PATCH In review Christoph Hellwig 5 participants 24 messages Dec 18, 2015 – Dec 20, 2015 9 messages not in the archive

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

Hi Doug,

this series (on top of your k.o/for-4.5 branch) has various MR-related
cleanups: starting to document the device capabilities, removing lots of dead MR/MW code and removing a useless field in struct ib_mr. This should be fairly uncontroversial I hope, so I'd like to get it in before the real MR changes.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/10 IB: start documenting device capabilities

In reply to a message not in the archive

Just IB_DEVICE_LOCAL_DMA_LKEY and IB_DEVICE_MEM_MGT_EXTENSIONS for now as I'm most familar with those.

---
 include/rdma/ib_verbs.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
include/rdma/ib_verbs.h +18 -0
index a7dbbfc..db4e3fe 100644
@@ -122,6 +122,14 @@ enum ib_device_cap_flags {
 	IB_DEVICE_RC_RNR_NAK_GEN	= (1<<12),
 	IB_DEVICE_SRQ_RESIZE		= (1<<13),
 	IB_DEVICE_N_NOTIFY_CQ		= (1<<14),
+
+	/*
+	 * This device supports a per-device lkey or stag that can be
+	 * used without performing a memory registration for the local
+	 * memory.  Note that ULPs should never check this flag, but
+	 * instead of use the local_dma_lkey flag in the ib_pd structure,
+	 * which will always contain a usable lkey.
+	 */
 	IB_DEVICE_LOCAL_DMA_LKEY	= (1<<15),
 	IB_DEVICE_RESERVED		= (1<<16), /* old SEND_W_INV */
 	IB_DEVICE_MEM_WINDOW		= (1<<17),
@@ -135,6 +143,16 @@ enum ib_device_cap_flags {
 	IB_DEVICE_UD_IP_CSUM		= (1<<18),
 	IB_DEVICE_UD_TSO		= (1<<19),
 	IB_DEVICE_XRC			= (1<<20),
+
+	/*
+	 * This device supports the IB "base memory management extension",
+	 * which includes support for fast registrations (IB_WR_REG_MR,
+	 * IB_WR_LOCAL_INV and IB_WR_SEND_WITH_INV verbs).  This flag should
+	 * also be set by any iWarp device which must support FRs to comply
+	 * to the iWarp verbs spec.  iWarp devices also support the
+	 * IB_WR_RDMA_READ_WITH_INV verb for RDMA READs that invalidate the
+	 * stag.
+	 */
 	IB_DEVICE_MEM_MGT_EXTENSIONS	= (1<<21),
 	IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22),
 	IB_DEVICE_MEM_WINDOW_TYPE_2A	= (1<<23),
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 2/10 IB: remove ib_query_mr

In reply to a message not in the archive

This functionality has no users and was only supported by the staged out EHCA driver.

---
 drivers/infiniband/core/verbs.c         |  7 -----
 drivers/staging/rdma/ehca/ehca_iverbs.h |  2 --
 drivers/staging/rdma/ehca/ehca_main.c   |  1 -
 drivers/staging/rdma/ehca/ehca_mrmw.c   | 49 ---------------------------------
 include/rdma/ib_verbs.h                 | 18 ------------
 5 files changed, 77 deletions(-)
drivers/infiniband/core/verbs.c +0 -7
index 87d3746..29a3e53 100644
@@ -1216,13 +1216,6 @@ struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags)
 }
 EXPORT_SYMBOL(ib_get_dma_mr);
 
-int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr)
-{
-	return mr->device->query_mr ?
-		mr->device->query_mr(mr, mr_attr) : -ENOSYS;
-}
-EXPORT_SYMBOL(ib_query_mr);
-
 int ib_dereg_mr(struct ib_mr *mr)
 {
 	struct ib_pd *pd;
drivers/staging/rdma/ehca/ehca_iverbs.h +0 -2
index 75c9876..4a45ca3 100644
@@ -94,8 +94,6 @@ int ehca_rereg_phys_mr(struct ib_mr *mr,
 		       struct ib_phys_buf *phys_buf_array,
 		       int num_phys_buf, int mr_access_flags, u64 *iova_start);
 
-int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
-
 int ehca_dereg_mr(struct ib_mr *mr);
 
 struct ib_mw *ehca_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
drivers/staging/rdma/ehca/ehca_main.c +0 -1
index 285e560..0be7959 100644
@@ -513,7 +513,6 @@ static int ehca_init_device(struct ehca_shca *shca)
 	shca->ib_device.get_dma_mr	    = ehca_get_dma_mr;
 	shca->ib_device.reg_phys_mr	    = ehca_reg_phys_mr;
 	shca->ib_device.reg_user_mr	    = ehca_reg_user_mr;
-	shca->ib_device.query_mr	    = ehca_query_mr;
 	shca->ib_device.dereg_mr	    = ehca_dereg_mr;
 	shca->ib_device.rereg_phys_mr	    = ehca_rereg_phys_mr;
 	shca->ib_device.alloc_mw	    = ehca_alloc_mw;
drivers/staging/rdma/ehca/ehca_mrmw.c +0 -49

55 lines not on this page · raw message

include/rdma/ib_verbs.h +0 -18
index db4e3fe..a2a7c22 100644
@@ -1180,15 +1180,6 @@ struct ib_phys_buf {
 	u64      size;
 };
 
-struct ib_mr_attr {
-	struct ib_pd	*pd;
-	u64		device_virt_addr;
-	u64		size;
-	int		mr_access_flags;
-	u32		lkey;
-	u32		rkey;
-};
-
 enum ib_mr_rereg_flags {
 	IB_MR_REREG_TRANS	= 1,
 	IB_MR_REREG_PD		= (1<<1),
@@ -1737,8 +1728,6 @@ struct ib_device {
 						    int mr_access_flags,
 						    struct ib_pd *pd,
 						    struct ib_udata *udata);
-	int                        (*query_mr)(struct ib_mr *mr,
-					       struct ib_mr_attr *mr_attr);
 	int                        (*dereg_mr)(struct ib_mr *mr);
 	struct ib_mr *		   (*alloc_mr)(struct ib_pd *pd,
 					       enum ib_mr_type mr_type,
@@ -2883,13 +2872,6 @@ static inline void ib_dma_free_coherent(struct ib_device *dev,
 }
 
 /**
- * ib_query_mr - Retrieves information about a specific memory region.
- * @mr: The memory region to retrieve information about.
- * @mr_attr: The attributes of the specified memory region.
- */
-int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
-
-/**
  * ib_dereg_mr - Deregisters a memory region and removes it from the
  *   HCA translation table.
  * @mr: The memory region to deregister.
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 3/10 IB: remove support for phys MRs

In reply to a message not in the archive

We have stopped using phys MRs in the kernel a while ago, so let's remove all the cruft used to implement them.

---
 drivers/infiniband/hw/cxgb3/iwch_mem.c       |  31 ---
 drivers/infiniband/hw/cxgb3/iwch_provider.c  |  69 ------
 drivers/infiniband/hw/cxgb3/iwch_provider.h  |   4 -
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h       |  11 -
 drivers/infiniband/hw/cxgb4/mem.c            | 248 ---------------------
 drivers/infiniband/hw/cxgb4/provider.c       |   2 -
 drivers/infiniband/hw/mthca/mthca_provider.c |  84 -------
 drivers/infiniband/hw/nes/nes_cm.c           |   7 +-
 drivers/infiniband/hw/nes/nes_verbs.c        |   3 +-
 drivers/infiniband/hw/nes/nes_verbs.h        |   5 +
 drivers/infiniband/hw/ocrdma/ocrdma_main.c   |   1 -
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  | 163 --------------
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |   3 -
 drivers/infiniband/hw/qib/qib_mr.c           |  51 +----
 drivers/infiniband/hw/qib/qib_verbs.c        |   1 -
 drivers/infiniband/hw/qib/qib_verbs.h        |   4 -
 drivers/staging/rdma/amso1100/c2_provider.c  |   1 -
 drivers/staging/rdma/ehca/ehca_iverbs.h      |  11 -
 drivers/staging/rdma/ehca/ehca_main.c        |   2 -
 drivers/staging/rdma/ehca/ehca_mrmw.c        | 321 ---------------------------
 drivers/staging/rdma/ehca/ehca_mrmw.h        |   5 -
 drivers/staging/rdma/hfi1/mr.c               |  51 +----
 drivers/staging/rdma/hfi1/verbs.c            |   1 -
 drivers/staging/rdma/hfi1/verbs.h            |   4 -
 drivers/staging/rdma/ipath/ipath_mr.c        |  55 -----
 drivers/staging/rdma/ipath/ipath_verbs.c     |   1 -
 drivers/staging/rdma/ipath/ipath_verbs.h     |   4 -
 include/rdma/ib_verbs.h                      |  16 +-
 28 files changed, 15 insertions(+), 1144 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_mem.c +0 -31
index 5c36ee2..3a5e27d 100644
@@ -75,37 +75,6 @@ int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php,
 	return ret;
 }
 
-int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php,
-					struct iwch_mr *mhp,
-					int shift,
-					int npages)
-{
-	u32 stag;
-	int ret;
-
-	/* We could support this... */
-	if (npages > mhp->attr.pbl_size)
-		return -ENOMEM;
-
-	stag = mhp->attr.stag;
-	if (cxio_reregister_phys_mem(&rhp->rdev,
-				   &stag, mhp->attr.pdid,
-				   mhp->attr.perms,
-				   mhp->attr.zbva,
-				   mhp->attr.va_fbo,
-				   mhp->attr.len,
-				   shift - 12,
-				   mhp->attr.pbl_size, mhp->attr.pbl_addr))
-		return -ENOMEM;
-
-	ret = iwch_finish_mem_reg(mhp, stag);
-	if (ret)
-		cxio_dereg_mem(&rhp->rdev, mhp->attr.stag, mhp->attr.pbl_size,
-		       mhp->attr.pbl_addr);
-
-	return ret;
-}
-
 int iwch_alloc_pbl(struct iwch_mr *mhp, int npages)
 {
 	mhp->attr.pbl_addr = cxio_hal_pblpool_alloc(&mhp->rhp->rdev,
drivers/infiniband/hw/cxgb3/iwch_provider.c +0 -69

81 lines not on this page · raw message

drivers/infiniband/hw/cxgb3/iwch_provider.h +0 -4
index 2ac85b8..f4fa6d6 100644
@@ -341,10 +341,6 @@ void iwch_unregister_device(struct iwch_dev *dev);
 void stop_read_rep_timer(struct iwch_qp *qhp);
 int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php,
 		      struct iwch_mr *mhp, int shift);
-int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php,
-					struct iwch_mr *mhp,
-					int shift,
-					int npages);
 int iwch_alloc_pbl(struct iwch_mr *mhp, int npages);
 void iwch_free_pbl(struct iwch_mr *mhp);
 int iwch_write_pbl(struct iwch_mr *mhp, __be64 *pages, int npages, int offset);
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +0 -11
index 00e55fa..dd00cf2 100644
@@ -968,17 +968,6 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
 					   u64 length, u64 virt, int acc,
 					   struct ib_udata *udata);
 struct ib_mr *c4iw_get_dma_mr(struct ib_pd *pd, int acc);
-struct ib_mr *c4iw_register_phys_mem(struct ib_pd *pd,
-					struct ib_phys_buf *buffer_list,
-					int num_phys_buf,
-					int acc,
-					u64 *iova_start);
-int c4iw_reregister_phys_mem(struct ib_mr *mr,
-				     int mr_rereg_mask,
-				     struct ib_pd *pd,
-				     struct ib_phys_buf *buffer_list,
-				     int num_phys_buf,
-				     int acc, u64 *iova_start);
 int c4iw_dereg_mr(struct ib_mr *ib_mr);
 int c4iw_destroy_cq(struct ib_cq *ib_cq);
 struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
drivers/infiniband/hw/cxgb4/mem.c +0 -248

260 lines not on this page · raw message

drivers/infiniband/hw/cxgb4/provider.c +0 -2
index b7703bc..186319e 100644
@@ -509,8 +509,6 @@ int c4iw_register_device(struct c4iw_dev *dev)
 	dev->ibdev.resize_cq = c4iw_resize_cq;
 	dev->ibdev.poll_cq = c4iw_poll_cq;
 	dev->ibdev.get_dma_mr = c4iw_get_dma_mr;
-	dev->ibdev.reg_phys_mr = c4iw_register_phys_mem;
-	dev->ibdev.rereg_phys_mr = c4iw_reregister_phys_mem;
 	dev->ibdev.reg_user_mr = c4iw_reg_user_mr;
 	dev->ibdev.dereg_mr = c4iw_dereg_mr;
 	dev->ibdev.alloc_mw = c4iw_alloc_mw;
drivers/infiniband/hw/mthca/mthca_provider.c +0 -84

96 lines not on this page · raw message

drivers/infiniband/hw/nes/nes_cm.c +3 -4
index 8a3ad17..242c87d 100644
@@ -3319,10 +3319,9 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 		ibphysbuf.addr = nesqp->ietf_frame_pbase + mpa_frame_offset;
 		ibphysbuf.size = buff_len;
 		tagged_offset = (u64)(unsigned long)*start_buff;
-		ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd,
-						   &ibphysbuf, 1,
-						   IB_ACCESS_LOCAL_WRITE,
-						   &tagged_offset);
+		ibmr = nes_reg_phys_mr(&nespd->ibpd, &ibphysbuf, 1,
+					IB_ACCESS_LOCAL_WRITE,
+					&tagged_offset);
 		if (!ibmr) {
 			nes_debug(NES_DBG_CM, "Unable to register memory region"
 				  "for lSMM for cm_node = %p \n",
drivers/infiniband/hw/nes/nes_verbs.c +1 -2
index 2bad036..453ebc2 100644
@@ -2019,7 +2019,7 @@ static int nes_reg_mr(struct nes_device *nesdev, struct nes_pd *nespd,
 /**
  * nes_reg_phys_mr
  */
-static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
+struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
 		struct ib_phys_buf *buffer_list, int num_phys_buf, int acc,
 		u64 * iova_start)
 {
@@ -3832,7 +3832,6 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
 	nesibdev->ibdev.destroy_cq = nes_destroy_cq;
 	nesibdev->ibdev.poll_cq = nes_poll_cq;
 	nesibdev->ibdev.get_dma_mr = nes_get_dma_mr;
-	nesibdev->ibdev.reg_phys_mr = nes_reg_phys_mr;
 	nesibdev->ibdev.reg_user_mr = nes_reg_user_mr;
 	nesibdev->ibdev.dereg_mr = nes_dereg_mr;
 	nesibdev->ibdev.alloc_mw = nes_alloc_mw;
drivers/infiniband/hw/nes/nes_verbs.h +5 -0
index a204b67..38e38cf 100644
@@ -190,4 +190,9 @@ struct nes_qp {
 	u8                    pau_state;
 	__u64                 nesuqp_addr;
 };
+
+struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
+		struct ib_phys_buf *buffer_list, int num_phys_buf, int acc,
+		u64 * iova_start);
+
 #endif			/* NES_VERBS_H */
drivers/infiniband/hw/ocrdma/ocrdma_main.c +0 -1
index 963be66..f91131f 100644
@@ -174,7 +174,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 	dev->ibdev.req_notify_cq = ocrdma_arm_cq;
 
 	dev->ibdev.get_dma_mr = ocrdma_get_dma_mr;
-	dev->ibdev.reg_phys_mr = ocrdma_reg_kernel_mr;
 	dev->ibdev.dereg_mr = ocrdma_dereg_mr;
 	dev->ibdev.reg_user_mr = ocrdma_reg_user_mr;
 
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +0 -163

169 lines not on this page · raw message

drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +0 -3
index f2ce048..82f476f 100644
@@ -115,9 +115,6 @@ int ocrdma_post_srq_recv(struct ib_srq *, struct ib_recv_wr *,
 
 int ocrdma_dereg_mr(struct ib_mr *);
 struct ib_mr *ocrdma_get_dma_mr(struct ib_pd *, int acc);
-struct ib_mr *ocrdma_reg_kernel_mr(struct ib_pd *,
-				   struct ib_phys_buf *buffer_list,
-				   int num_phys_buf, int acc, u64 *iova_start);
 struct ib_mr *ocrdma_reg_user_mr(struct ib_pd *, u64 start, u64 length,
 				 u64 virt, int acc, struct ib_udata *);
 struct ib_mr *ocrdma_alloc_mr(struct ib_pd *pd,
drivers/infiniband/hw/qib/qib_mr.c +1 -50

63 lines not on this page · raw message

drivers/infiniband/hw/qib/qib_verbs.c +0 -1
index 9e1af0b..e56bd65 100644
@@ -2206,7 +2206,6 @@ int qib_register_ib_device(struct qib_devdata *dd)
 	ibdev->poll_cq = qib_poll_cq;
 	ibdev->req_notify_cq = qib_req_notify_cq;
 	ibdev->get_dma_mr = qib_get_dma_mr;
-	ibdev->reg_phys_mr = qib_reg_phys_mr;
 	ibdev->reg_user_mr = qib_reg_user_mr;
 	ibdev->dereg_mr = qib_dereg_mr;
 	ibdev->alloc_mr = qib_alloc_mr;
drivers/infiniband/hw/qib/qib_verbs.h +0 -4
index bc803f3..6c5e777 100644
@@ -1032,10 +1032,6 @@ int qib_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);
 
 struct ib_mr *qib_get_dma_mr(struct ib_pd *pd, int acc);
 
-struct ib_mr *qib_reg_phys_mr(struct ib_pd *pd,
-			      struct ib_phys_buf *buffer_list,
-			      int num_phys_buf, int acc, u64 *iova_start);
-
 struct ib_mr *qib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 			      u64 virt_addr, int mr_access_flags,
 			      struct ib_udata *udata);
drivers/staging/rdma/amso1100/c2_provider.c +0 -1
index ee2ff87..6c3e9cc 100644
@@ -831,7 +831,6 @@ int c2_register_device(struct c2_dev *dev)
 	dev->ibdev.destroy_cq = c2_destroy_cq;
 	dev->ibdev.poll_cq = c2_poll_cq;
 	dev->ibdev.get_dma_mr = c2_get_dma_mr;
-	dev->ibdev.reg_phys_mr = c2_reg_phys_mr;
 	dev->ibdev.reg_user_mr = c2_reg_user_mr;
 	dev->ibdev.dereg_mr = c2_dereg_mr;
 	dev->ibdev.get_port_immutable = c2_port_immutable;
drivers/staging/rdma/ehca/ehca_iverbs.h +0 -11
index 4a45ca3..219f635 100644
@@ -79,21 +79,10 @@ int ehca_destroy_ah(struct ib_ah *ah);
 
 struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
 
-struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,
-			       struct ib_phys_buf *phys_buf_array,
-			       int num_phys_buf,
-			       int mr_access_flags, u64 *iova_start);
-
 struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 			       u64 virt, int mr_access_flags,
 			       struct ib_udata *udata);
 
-int ehca_rereg_phys_mr(struct ib_mr *mr,
-		       int mr_rereg_mask,
-		       struct ib_pd *pd,
-		       struct ib_phys_buf *phys_buf_array,
-		       int num_phys_buf, int mr_access_flags, u64 *iova_start);
-
 int ehca_dereg_mr(struct ib_mr *mr);
 
 struct ib_mw *ehca_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
drivers/staging/rdma/ehca/ehca_main.c +0 -2
index 0be7959..ba023426 100644
@@ -511,10 +511,8 @@ static int ehca_init_device(struct ehca_shca *shca)
 	shca->ib_device.req_notify_cq	    = ehca_req_notify_cq;
 	/* shca->ib_device.req_ncomp_notif  = ehca_req_ncomp_notif; */
 	shca->ib_device.get_dma_mr	    = ehca_get_dma_mr;
-	shca->ib_device.reg_phys_mr	    = ehca_reg_phys_mr;
 	shca->ib_device.reg_user_mr	    = ehca_reg_user_mr;
 	shca->ib_device.dereg_mr	    = ehca_dereg_mr;
-	shca->ib_device.rereg_phys_mr	    = ehca_rereg_phys_mr;
 	shca->ib_device.alloc_mw	    = ehca_alloc_mw;
 	shca->ib_device.bind_mw		    = ehca_bind_mw;
 	shca->ib_device.dealloc_mw	    = ehca_dealloc_mw;
drivers/staging/rdma/ehca/ehca_mrmw.c +0 -321

339 lines not on this page · raw message

drivers/staging/rdma/ehca/ehca_mrmw.h +0 -5
index 50d8b51..52bfa95 100644
@@ -98,11 +98,6 @@ int ehca_reg_maxmr(struct ehca_shca *shca,
 
 int ehca_dereg_internal_maxmr(struct ehca_shca *shca);
 
-int ehca_mr_chk_buf_and_calc_size(struct ib_phys_buf *phys_buf_array,
-				  int num_phys_buf,
-				  u64 *iova_start,
-				  u64 *size);
-
 int ehca_fmr_check_page_list(struct ehca_mr *e_fmr,
 			     u64 *page_list,
 			     int list_len);
drivers/staging/rdma/hfi1/mr.c +1 -50

63 lines not on this page · raw message

drivers/staging/rdma/hfi1/verbs.c +0 -1
index cb5b346..1b3d8d9 100644
@@ -2011,7 +2011,6 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
 	ibdev->poll_cq = hfi1_poll_cq;
 	ibdev->req_notify_cq = hfi1_req_notify_cq;
 	ibdev->get_dma_mr = hfi1_get_dma_mr;
-	ibdev->reg_phys_mr = hfi1_reg_phys_mr;
 	ibdev->reg_user_mr = hfi1_reg_user_mr;
 	ibdev->dereg_mr = hfi1_dereg_mr;
 	ibdev->alloc_mr = hfi1_alloc_mr;
drivers/staging/rdma/hfi1/verbs.h +0 -4
index 041ad07..255792a 100644
@@ -1012,10 +1012,6 @@ int hfi1_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);
 
 struct ib_mr *hfi1_get_dma_mr(struct ib_pd *pd, int acc);
 
-struct ib_mr *hfi1_reg_phys_mr(struct ib_pd *pd,
-			       struct ib_phys_buf *buffer_list,
-			       int num_phys_buf, int acc, u64 *iova_start);
-
 struct ib_mr *hfi1_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 			       u64 virt_addr, int mr_access_flags,
 			       struct ib_udata *udata);
drivers/staging/rdma/ipath/ipath_mr.c +0 -55

67 lines not on this page · raw message

drivers/staging/rdma/ipath/ipath_verbs.c +0 -1
index 7ab1520..02d8834 100644
@@ -2149,7 +2149,6 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
 	dev->poll_cq = ipath_poll_cq;
 	dev->req_notify_cq = ipath_req_notify_cq;
 	dev->get_dma_mr = ipath_get_dma_mr;
-	dev->reg_phys_mr = ipath_reg_phys_mr;
 	dev->reg_user_mr = ipath_reg_user_mr;
 	dev->dereg_mr = ipath_dereg_mr;
 	dev->alloc_fmr = ipath_alloc_fmr;
drivers/staging/rdma/ipath/ipath_verbs.h +0 -4
index 0a90a56..6c70a89 100644
@@ -828,10 +828,6 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);
 
 struct ib_mr *ipath_get_dma_mr(struct ib_pd *pd, int acc);
 
-struct ib_mr *ipath_reg_phys_mr(struct ib_pd *pd,
-				struct ib_phys_buf *buffer_list,
-				int num_phys_buf, int acc, u64 *iova_start);
-
 struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 				u64 virt_addr, int mr_access_flags,
 				struct ib_udata *udata);
include/rdma/ib_verbs.h +4 -12
index a2a7c22..1f4b057 100644
@@ -1180,6 +1180,10 @@ struct ib_phys_buf {
 	u64      size;
 };
 
+/*
+ * XXX: these are apparently used for ->rereg_user_mr, no idea why they
+ * are hidden here instead of a uapi header!
+ */
 enum ib_mr_rereg_flags {
 	IB_MR_REREG_TRANS	= 1,
 	IB_MR_REREG_PD		= (1<<1),
@@ -1711,11 +1715,6 @@ struct ib_device {
 						      int wc_cnt);
 	struct ib_mr *             (*get_dma_mr)(struct ib_pd *pd,
 						 int mr_access_flags);
-	struct ib_mr *             (*reg_phys_mr)(struct ib_pd *pd,
-						  struct ib_phys_buf *phys_buf_array,
-						  int num_phys_buf,
-						  int mr_access_flags,
-						  u64 *iova_start);
 	struct ib_mr *             (*reg_user_mr)(struct ib_pd *pd,
 						  u64 start, u64 length,
 						  u64 virt_addr,
@@ -1735,13 +1734,6 @@ struct ib_device {
 	int                        (*map_mr_sg)(struct ib_mr *mr,
 						struct scatterlist *sg,
 						int sg_nents);
-	int                        (*rereg_phys_mr)(struct ib_mr *mr,
-						    int mr_rereg_mask,
-						    struct ib_pd *pd,
-						    struct ib_phys_buf *phys_buf_array,
-						    int num_phys_buf,
-						    int mr_access_flags,
-						    u64 *iova_start);
 	struct ib_mw *             (*alloc_mw)(struct ib_pd *pd,
 					       enum ib_mw_type type);
 	int                        (*bind_mw)(struct ib_qp *qp,
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 4/10 IB: remove in-kernel support for memory windows

In reply to a message not in the archive

Remove the unused ib_allow_mw and ib_bind_mw functions, remove the unused IB_WR_BIND_MW and IB_WC_BIND_MW opcodes and move ib_dealloc_mw into the uverbs module.

---
 Documentation/infiniband/core_locking.txt   |  2 -
 drivers/infiniband/core/uverbs.h            |  2 +
 drivers/infiniband/core/uverbs_cmd.c        |  4 +-
 drivers/infiniband/core/uverbs_main.c       | 13 ++++-
 drivers/infiniband/core/verbs.c             | 36 -------------
 drivers/infiniband/hw/cxgb3/iwch_cq.c       |  4 --
 drivers/infiniband/hw/cxgb3/iwch_provider.c |  1 -
 drivers/infiniband/hw/cxgb3/iwch_provider.h |  3 --
 drivers/infiniband/hw/cxgb3/iwch_qp.c       | 82 ----------------------------
 drivers/infiniband/hw/cxgb4/cq.c            |  3 --
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h      |  2 -
 drivers/infiniband/hw/cxgb4/provider.c      |  1 -
 drivers/infiniband/hw/cxgb4/qp.c            |  5 --
 drivers/infiniband/hw/mlx4/cq.c             |  3 --
 drivers/infiniband/hw/mlx4/main.c           |  1 -
 drivers/infiniband/hw/mlx4/mlx4_ib.h        |  2 -
 drivers/infiniband/hw/mlx4/mr.c             | 22 --------
 drivers/infiniband/hw/mlx4/qp.c             | 27 ----------
 drivers/infiniband/hw/mlx5/cq.c             |  3 --
 drivers/infiniband/hw/mthca/mthca_cq.c      |  3 --
 drivers/infiniband/hw/nes/nes_verbs.c       | 75 --------------------------
 drivers/staging/rdma/amso1100/c2_cq.c       |  3 --
 drivers/staging/rdma/ehca/ehca_iverbs.h     |  3 --
 drivers/staging/rdma/ehca/ehca_main.c       |  1 -
 drivers/staging/rdma/ehca/ehca_mrmw.c       | 12 -----
 drivers/staging/rdma/ehca/ehca_reqs.c       |  1 -
 include/rdma/ib_verbs.h                     | 83 -----------------------------
 27 files changed, 16 insertions(+), 381 deletions(-)
Documentation/infiniband/core_locking.txt +0 -2
index e167854..4b1f36b 100644
@@ -15,7 +15,6 @@ Sleeping and interrupt context
     modify_ah
     query_ah
     destroy_ah
-    bind_mw
     post_send
     post_recv
     poll_cq
@@ -31,7 +30,6 @@ Sleeping and interrupt context
     ib_modify_ah
     ib_query_ah
     ib_destroy_ah
-    ib_bind_mw
     ib_post_send
     ib_post_recv
     ib_req_notify_cq
drivers/infiniband/core/uverbs.h +2 -0
index 94bbd8c..612ccfd 100644
@@ -204,6 +204,8 @@ void ib_uverbs_event_handler(struct ib_event_handler *handler,
 			     struct ib_event *event);
 void ib_uverbs_dealloc_xrcd(struct ib_uverbs_device *dev, struct ib_xrcd *xrcd);
 
+int uverbs_dealloc_mw(struct ib_mw *mw);
+
 struct ib_uverbs_flow_spec {
 	union {
 		union {
drivers/infiniband/core/uverbs_cmd.c +2 -2
index 1add536..48776bb 100644
@@ -1242,7 +1242,7 @@ err_copy:
 	idr_remove_uobj(&ib_uverbs_mw_idr, uobj);
 
 err_unalloc:
-	ib_dealloc_mw(mw);
+	uverbs_dealloc_mw(mw);
 
 err_put:
 	put_pd_read(pd);
@@ -1271,7 +1271,7 @@ ssize_t ib_uverbs_dealloc_mw(struct ib_uverbs_file *file,
 
 	mw = uobj->object;
 
-	ret = ib_dealloc_mw(mw);
+	ret = uverbs_dealloc_mw(mw);
 	if (!ret)
 		uobj->live = 0;
 
drivers/infiniband/core/uverbs_main.c +12 -1
index e3ef288..39680ae 100644
@@ -133,6 +133,17 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file,
 static void ib_uverbs_add_one(struct ib_device *device);
 static void ib_uverbs_remove_one(struct ib_device *device, void *client_data);
 
+int uverbs_dealloc_mw(struct ib_mw *mw)
+{
+	struct ib_pd *pd = mw->pd;
+	int ret;
+
+	ret = mw->device->dealloc_mw(mw);
+	if (!ret)
+		atomic_dec(&pd->usecnt);
+	return ret;
+}
+
 static void ib_uverbs_release_dev(struct kobject *kobj)
 {
 	struct ib_uverbs_device *dev =
@@ -224,7 +235,7 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
 		struct ib_mw *mw = uobj->object;
 
 		idr_remove_uobj(&ib_uverbs_mw_idr, uobj);
-		ib_dealloc_mw(mw);
+		uverbs_dealloc_mw(mw);
 		kfree(uobj);
 	}
 
drivers/infiniband/core/verbs.c +0 -36
index 29a3e53..2858b35 100644
@@ -1267,42 +1267,6 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
 }
 EXPORT_SYMBOL(ib_alloc_mr);
 
-/* Memory windows */
-
-struct ib_mw *ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
-{
-	struct ib_mw *mw;
-
-	if (!pd->device->alloc_mw)
-		return ERR_PTR(-ENOSYS);
-
-	mw = pd->device->alloc_mw(pd, type);
-	if (!IS_ERR(mw)) {
-		mw->device  = pd->device;
-		mw->pd      = pd;
-		mw->uobject = NULL;
-		mw->type    = type;
-		atomic_inc(&pd->usecnt);
-	}
-
-	return mw;
-}
-EXPORT_SYMBOL(ib_alloc_mw);
-
-int ib_dealloc_mw(struct ib_mw *mw)
-{
-	struct ib_pd *pd;
-	int ret;
-
-	pd = mw->pd;
-	ret = mw->device->dealloc_mw(mw);
-	if (!ret)
-		atomic_dec(&pd->usecnt);
-
-	return ret;
-}
-EXPORT_SYMBOL(ib_dealloc_mw);
-
 /* "Fast" memory regions */
 
 struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd,
drivers/infiniband/hw/cxgb3/iwch_cq.c +0 -4
index cfe4049..97fbfd2 100644
@@ -115,10 +115,6 @@ static int iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
 		case T3_SEND_WITH_SE_INV:
 			wc->opcode = IB_WC_SEND;
 			break;
-		case T3_BIND_MW:
-			wc->opcode = IB_WC_BIND_MW;
-			break;
-
 		case T3_LOCAL_INV:
 			wc->opcode = IB_WC_LOCAL_INV;
 			break;
drivers/infiniband/hw/cxgb3/iwch_provider.c +0 -1
index 9576e15..b184933 100644
@@ -1350,7 +1350,6 @@ int iwch_register_device(struct iwch_dev *dev)
 	dev->ibdev.reg_user_mr = iwch_reg_user_mr;
 	dev->ibdev.dereg_mr = iwch_dereg_mr;
 	dev->ibdev.alloc_mw = iwch_alloc_mw;
-	dev->ibdev.bind_mw = iwch_bind_mw;
 	dev->ibdev.dealloc_mw = iwch_dealloc_mw;
 	dev->ibdev.alloc_mr = iwch_alloc_mr;
 	dev->ibdev.map_mr_sg = iwch_map_mr_sg;
drivers/infiniband/hw/cxgb3/iwch_provider.h +0 -3
index f4fa6d6..f24df44 100644
@@ -330,9 +330,6 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
 		      struct ib_send_wr **bad_wr);
 int iwch_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 		      struct ib_recv_wr **bad_wr);
-int iwch_bind_mw(struct ib_qp *qp,
-			     struct ib_mw *mw,
-			     struct ib_mw_bind *mw_bind);
 int iwch_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
 int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg);
 int iwch_post_zb_read(struct iwch_ep *ep);
drivers/infiniband/hw/cxgb3/iwch_qp.c +0 -82

88 lines not on this page · raw message

drivers/infiniband/hw/cxgb4/cq.c +0 -3
index de9cd69..cf21df4 100644
@@ -744,9 +744,6 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)
 		case FW_RI_SEND_WITH_SE:
 			wc->opcode = IB_WC_SEND;
 			break;
-		case FW_RI_BIND_MW:
-			wc->opcode = IB_WC_BIND_MW;
-			break;
 
 		case FW_RI_LOCAL_INV:
 			wc->opcode = IB_WC_LOCAL_INV;
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +0 -2
index dd00cf2..fb2de75 100644
@@ -947,8 +947,6 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
 		      struct ib_send_wr **bad_wr);
 int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 		      struct ib_recv_wr **bad_wr);
-int c4iw_bind_mw(struct ib_qp *qp, struct ib_mw *mw,
-		 struct ib_mw_bind *mw_bind);
 int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param);
 int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog);
 int c4iw_destroy_listen(struct iw_cm_id *cm_id);
drivers/infiniband/hw/cxgb4/provider.c +0 -1
index 186319e..5544adc 100644
@@ -512,7 +512,6 @@ int c4iw_register_device(struct c4iw_dev *dev)
 	dev->ibdev.reg_user_mr = c4iw_reg_user_mr;
 	dev->ibdev.dereg_mr = c4iw_dereg_mr;
 	dev->ibdev.alloc_mw = c4iw_alloc_mw;
-	dev->ibdev.bind_mw = c4iw_bind_mw;
 	dev->ibdev.dealloc_mw = c4iw_dealloc_mw;
 	dev->ibdev.alloc_mr = c4iw_alloc_mr;
 	dev->ibdev.map_mr_sg = c4iw_map_mr_sg;
drivers/infiniband/hw/cxgb4/qp.c +0 -5
index aa515af..e99345e 100644
@@ -933,11 +933,6 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 	return err;
 }
 
-int c4iw_bind_mw(struct ib_qp *qp, struct ib_mw *mw, struct ib_mw_bind *mw_bind)
-{
-	return -ENOSYS;
-}
-
 static inline void build_term_codes(struct t4_cqe *err_cqe, u8 *layer_type,
 				    u8 *ecode)
 {
drivers/infiniband/hw/mlx4/cq.c +0 -3
index b88fc8f..9f8b516 100644
@@ -811,9 +811,6 @@ repoll:
 			wc->opcode    = IB_WC_MASKED_FETCH_ADD;
 			wc->byte_len  = 8;
 			break;
-		case MLX4_OPCODE_BIND_MW:
-			wc->opcode    = IB_WC_BIND_MW;
-			break;
 		case MLX4_OPCODE_LSO:
 			wc->opcode    = IB_WC_LSO;
 			break;
drivers/infiniband/hw/mlx4/main.c +0 -1
index e0232a2..4c18ff5 100644
@@ -2313,7 +2313,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 	if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||
 	    dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN) {
 		ibdev->ib_dev.alloc_mw = mlx4_ib_alloc_mw;
-		ibdev->ib_dev.bind_mw = mlx4_ib_bind_mw;
 		ibdev->ib_dev.dealloc_mw = mlx4_ib_dealloc_mw;
 
 		ibdev->ib_dev.uverbs_cmd_mask |=
drivers/infiniband/hw/mlx4/mlx4_ib.h +0 -2
index 1caa11e..8916e9b 100644
@@ -704,8 +704,6 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 				  struct ib_udata *udata);
 int mlx4_ib_dereg_mr(struct ib_mr *mr);
 struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
-int mlx4_ib_bind_mw(struct ib_qp *qp, struct ib_mw *mw,
-		    struct ib_mw_bind *mw_bind);
 int mlx4_ib_dealloc_mw(struct ib_mw *mw);
 struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd,
 			       enum ib_mr_type mr_type,
drivers/infiniband/hw/mlx4/mr.c +0 -22
index 4d1e1c6..242b94e 100644
@@ -366,28 +366,6 @@ err_free:
 	return ERR_PTR(err);
 }
 
-int mlx4_ib_bind_mw(struct ib_qp *qp, struct ib_mw *mw,
-		    struct ib_mw_bind *mw_bind)
-{
-	struct ib_bind_mw_wr  wr;
-	struct ib_send_wr *bad_wr;
-	int ret;
-
-	memset(&wr, 0, sizeof(wr));
-	wr.wr.opcode		= IB_WR_BIND_MW;
-	wr.wr.wr_id		= mw_bind->wr_id;
-	wr.wr.send_flags	= mw_bind->send_flags;
-	wr.mw			= mw;
-	wr.bind_info		= mw_bind->bind_info;
-	wr.rkey			= ib_inc_rkey(mw->rkey);
-
-	ret = mlx4_ib_post_send(qp, &wr.wr, &bad_wr);
-	if (!ret)
-		mw->rkey = wr.rkey;
-
-	return ret;
-}
-
 int mlx4_ib_dealloc_mw(struct ib_mw *ibmw)
 {
 	struct mlx4_ib_mw *mw = to_mmw(ibmw);
drivers/infiniband/hw/mlx4/qp.c +0 -27
index 13eaaf4..7996536 100644
@@ -115,7 +115,6 @@ static const __be32 mlx4_ib_opcode[] = {
 	[IB_WR_REG_MR]				= cpu_to_be32(MLX4_OPCODE_FMR),
 	[IB_WR_MASKED_ATOMIC_CMP_AND_SWP]	= cpu_to_be32(MLX4_OPCODE_MASKED_ATOMIC_CS),
 	[IB_WR_MASKED_ATOMIC_FETCH_AND_ADD]	= cpu_to_be32(MLX4_OPCODE_MASKED_ATOMIC_FA),
-	[IB_WR_BIND_MW]				= cpu_to_be32(MLX4_OPCODE_BIND_MW),
 };
 
 static struct mlx4_ib_sqp *to_msqp(struct mlx4_ib_qp *mqp)
@@ -2528,25 +2527,6 @@ static void set_reg_seg(struct mlx4_wqe_fmr_seg *fseg,
 	fseg->reserved[1]	= 0;
 }
 
-static void set_bind_seg(struct mlx4_wqe_bind_seg *bseg,
-		struct ib_bind_mw_wr *wr)
-{
-	bseg->flags1 =
-		convert_access(wr->bind_info.mw_access_flags) &
-		cpu_to_be32(MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_READ  |
-			    MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_WRITE |
-			    MLX4_WQE_FMR_AND_BIND_PERM_ATOMIC);
-	bseg->flags2 = 0;
-	if (wr->mw->type == IB_MW_TYPE_2)
-		bseg->flags2 |= cpu_to_be32(MLX4_WQE_BIND_TYPE_2);
-	if (wr->bind_info.mw_access_flags & IB_ZERO_BASED)
-		bseg->flags2 |= cpu_to_be32(MLX4_WQE_BIND_ZERO_BASED);
-	bseg->new_rkey = cpu_to_be32(wr->rkey);
-	bseg->lkey = cpu_to_be32(wr->bind_info.mr->lkey);
-	bseg->addr = cpu_to_be64(wr->bind_info.addr);
-	bseg->length = cpu_to_be64(wr->bind_info.length);
-}
-
 static void set_local_inv_seg(struct mlx4_wqe_local_inval_seg *iseg, u32 rkey)
 {
 	memset(iseg, 0, sizeof(*iseg));
@@ -2867,13 +2847,6 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
 				size += sizeof(struct mlx4_wqe_fmr_seg) / 16;
 				break;
 
-			case IB_WR_BIND_MW:
-				ctrl->srcrb_flags |=
-					cpu_to_be32(MLX4_WQE_CTRL_STRONG_ORDER);
-				set_bind_seg(wqe, bind_mw_wr(wr));
-				wqe  += sizeof(struct mlx4_wqe_bind_seg);
-				size += sizeof(struct mlx4_wqe_bind_seg) / 16;
-				break;
 			default:
 				/* No extra segments required for sends */
 				break;
drivers/infiniband/hw/mlx5/cq.c +0 -3
index 3dfd287..82f86ed 100644
@@ -154,9 +154,6 @@ static void handle_good_req(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
 		wc->opcode    = IB_WC_MASKED_FETCH_ADD;
 		wc->byte_len  = 8;
 		break;
-	case MLX5_OPCODE_BIND_MW:
-		wc->opcode    = IB_WC_BIND_MW;
-		break;
 	case MLX5_OPCODE_UMR:
 		wc->opcode = get_umr_comp(wq, idx);
 		break;
drivers/infiniband/hw/mthca/mthca_cq.c +0 -3
index 40ba833..a6531ff 100644
@@ -608,9 +608,6 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
 			entry->opcode    = IB_WC_FETCH_ADD;
 			entry->byte_len  = MTHCA_ATOMIC_BYTE_LEN;
 			break;
-		case MTHCA_OPCODE_BIND_MW:
-			entry->opcode    = IB_WC_BIND_MW;
-			break;
 		default:
 			entry->opcode    = MTHCA_OPCODE_INVALID;
 			break;
drivers/infiniband/hw/nes/nes_verbs.c +0 -75

87 lines not on this page · raw message

drivers/staging/rdma/amso1100/c2_cq.c +0 -3
index 3ef881f..7ad0c08 100644
@@ -173,9 +173,6 @@ static inline int c2_poll_one(struct c2_dev *c2dev,
 	case C2_WR_TYPE_RDMA_READ:
 		entry->opcode = IB_WC_RDMA_READ;
 		break;
-	case C2_WR_TYPE_BIND_MW:
-		entry->opcode = IB_WC_BIND_MW;
-		break;
 	case C2_WR_TYPE_RECV:
 		entry->byte_len = be32_to_cpu(ce->bytes_rcvd);
 		entry->opcode = IB_WC_RECV;
drivers/staging/rdma/ehca/ehca_iverbs.h +0 -3
index 219f635..630416d 100644
@@ -87,9 +87,6 @@ int ehca_dereg_mr(struct ib_mr *mr);
 
 struct ib_mw *ehca_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
 
-int ehca_bind_mw(struct ib_qp *qp, struct ib_mw *mw,
-		 struct ib_mw_bind *mw_bind);
-
 int ehca_dealloc_mw(struct ib_mw *mw);
 
 struct ib_fmr *ehca_alloc_fmr(struct ib_pd *pd,
drivers/staging/rdma/ehca/ehca_main.c +0 -1
index ba023426..915e924 100644
@@ -514,7 +514,6 @@ static int ehca_init_device(struct ehca_shca *shca)
 	shca->ib_device.reg_user_mr	    = ehca_reg_user_mr;
 	shca->ib_device.dereg_mr	    = ehca_dereg_mr;
 	shca->ib_device.alloc_mw	    = ehca_alloc_mw;
-	shca->ib_device.bind_mw		    = ehca_bind_mw;
 	shca->ib_device.dealloc_mw	    = ehca_dealloc_mw;
 	shca->ib_device.alloc_fmr	    = ehca_alloc_fmr;
 	shca->ib_device.map_phys_fmr	    = ehca_map_phys_fmr;
drivers/staging/rdma/ehca/ehca_mrmw.c +0 -12
index 1c1a8dd..c6e3245 100644
@@ -413,18 +413,6 @@ alloc_mw_exit0:
 
 /*----------------------------------------------------------------------*/
 
-int ehca_bind_mw(struct ib_qp *qp,
-		 struct ib_mw *mw,
-		 struct ib_mw_bind *mw_bind)
-{
-	/* TODO: not supported up to now */
-	ehca_gen_err("bind MW currently not supported by HCAD");
-
-	return -EPERM;
-} /* end ehca_bind_mw() */
-
-/*----------------------------------------------------------------------*/
-
 int ehca_dealloc_mw(struct ib_mw *mw)
 {
 	u64 h_ret;
drivers/staging/rdma/ehca/ehca_reqs.c +0 -1
index 10e2074..11813b8 100644
@@ -614,7 +614,6 @@ int ehca_post_srq_recv(struct ib_srq *srq,
 static const u8 ib_wc_opcode[255] = {
 	[0x01] = IB_WC_RECV+1,
 	[0x02] = IB_WC_RECV_RDMA_WITH_IMM+1,
-	[0x04] = IB_WC_BIND_MW+1,
 	[0x08] = IB_WC_FETCH_ADD+1,
 	[0x10] = IB_WC_COMP_SWAP+1,
 	[0x20] = IB_WC_RDMA_WRITE+1,
include/rdma/ib_verbs.h +0 -83

125 lines not on this page · raw message

Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

PATCH 5/10 cxgb3: simplify iwch_get_dma_wr

In reply to a message not in the archive

Fold simplified versions of build_phys_page_list and iwch_register_phys_mem into iwch_get_dma_wr now that no other callers are left.

---
 drivers/infiniband/hw/cxgb3/iwch_mem.c      | 71 ----------------------------
 drivers/infiniband/hw/cxgb3/iwch_provider.c | 73 ++++++++++-------------------
 drivers/infiniband/hw/cxgb3/iwch_provider.h |  8 ----
 3 files changed, 26 insertions(+), 126 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_mem.c +0 -71
index 3a5e27d..1d04c87 100644
@@ -99,74 +99,3 @@ int iwch_write_pbl(struct iwch_mr *mhp, __be64 *pages, int npages, int offset)
 	return cxio_write_pbl(&mhp->rhp->rdev, pages,
 			      mhp->attr.pbl_addr + (offset << 3), npages);
 }
-
-int build_phys_page_list(struct ib_phys_buf *buffer_list,
-					int num_phys_buf,
-					u64 *iova_start,
-					u64 *total_size,
-					int *npages,
-					int *shift,
-					__be64 **page_list)
-{
-	u64 mask;
-	int i, j, n;
-
-	mask = 0;
-	*total_size = 0;
-	for (i = 0; i < num_phys_buf; ++i) {
-		if (i != 0 && buffer_list[i].addr & ~PAGE_MASK)
-			return -EINVAL;
-		if (i != 0 && i != num_phys_buf - 1 &&
-		    (buffer_list[i].size & ~PAGE_MASK))
-			return -EINVAL;
-		*total_size += buffer_list[i].size;
-		if (i > 0)
-			mask |= buffer_list[i].addr;
-		else
-			mask |= buffer_list[i].addr & PAGE_MASK;
-		if (i != num_phys_buf - 1)
-			mask |= buffer_list[i].addr + buffer_list[i].size;
-		else
-			mask |= (buffer_list[i].addr + buffer_list[i].size +
-				PAGE_SIZE - 1) & PAGE_MASK;
-	}
-
-	if (*total_size > 0xFFFFFFFFULL)
-		return -ENOMEM;
-
-	/* Find largest page shift we can use to cover buffers */
-	for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift))
-		if ((1ULL << *shift) & mask)
-			break;
-
-	buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1);
-	buffer_list[0].addr &= ~0ull << *shift;
-
-	*npages = 0;
-	for (i = 0; i < num_phys_buf; ++i)
-		*npages += (buffer_list[i].size +
-			(1ULL << *shift) - 1) >> *shift;
-
-	if (!*npages)
-		return -EINVAL;
-
-	*page_list = kmalloc(sizeof(u64) * *npages, GFP_KERNEL);
-	if (!*page_list)
-		return -ENOMEM;
-
-	n = 0;
-	for (i = 0; i < num_phys_buf; ++i)
-		for (j = 0;
-		     j < (buffer_list[i].size + (1ULL << *shift) - 1) >> *shift;
-		     ++j)
-			(*page_list)[n++] = cpu_to_be64(buffer_list[i].addr +
-			    ((u64) j << *shift));
-
-	PDBG("%s va 0x%llx mask 0x%llx shift %d len %lld pbl_size %d\n",
-	     __func__, (unsigned long long) *iova_start,
-	     (unsigned long long) mask, *shift, (unsigned long long) *total_size,
-	     *npages);
-
-	return 0;
-
-}
drivers/infiniband/hw/cxgb3/iwch_provider.c +26 -47

114 lines not on this page · raw message

drivers/infiniband/hw/cxgb3/iwch_provider.h +0 -8
index f24df44..252c464 100644
@@ -341,14 +341,6 @@ int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php,
 int iwch_alloc_pbl(struct iwch_mr *mhp, int npages);
 void iwch_free_pbl(struct iwch_mr *mhp);
 int iwch_write_pbl(struct iwch_mr *mhp, __be64 *pages, int npages, int offset);
-int build_phys_page_list(struct ib_phys_buf *buffer_list,
-					int num_phys_buf,
-					u64 *iova_start,
-					u64 *total_size,
-					int *npages,
-					int *shift,
-					__be64 **page_list);
-
 
 #define IWCH_NODE_DESC "cxgb3 Chelsio Communications"
 
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

PATCH 6/10 nes: simplify nes_reg_phys_mr calling conventions

In reply to a message not in the archive

Just pass and address/size pair instead of an ib_phys_buf array.

---
 drivers/infiniband/hw/nes/nes_cm.c    |  10 +--
 drivers/infiniband/hw/nes/nes_verbs.c | 140 ++++++++--------------------------
 drivers/infiniband/hw/nes/nes_verbs.h |   3 +-
 3 files changed, 37 insertions(+), 116 deletions(-)
drivers/infiniband/hw/nes/nes_cm.c +4 -6
index 242c87d..bc37adb 100644
@@ -3232,7 +3232,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	int passive_state;
 	struct nes_ib_device *nesibdev;
 	struct ib_mr *ibmr = NULL;
-	struct ib_phys_buf ibphysbuf;
 	struct nes_pd *nespd;
 	u64 tagged_offset;
 	u8 mpa_frame_offset = 0;
@@ -3316,12 +3315,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 		u64temp = (unsigned long)nesqp;
 		nesibdev = nesvnic->nesibdev;
 		nespd = nesqp->nespd;
-		ibphysbuf.addr = nesqp->ietf_frame_pbase + mpa_frame_offset;
-		ibphysbuf.size = buff_len;
 		tagged_offset = (u64)(unsigned long)*start_buff;
-		ibmr = nes_reg_phys_mr(&nespd->ibpd, &ibphysbuf, 1,
-					IB_ACCESS_LOCAL_WRITE,
-					&tagged_offset);
+		ibmr = nes_reg_phys_mr(&nespd->ibpd,
+				nesqp->ietf_frame_pbase + mpa_frame_offset,
+				buff_len, IB_ACCESS_LOCAL_WRITE,
+				&tagged_offset);
 		if (!ibmr) {
 			nes_debug(NES_DBG_CM, "Unable to register memory region"
 				  "for lSMM for cm_node = %p \n",
drivers/infiniband/hw/nes/nes_verbs.c +32 -108

204 lines not on this page · raw message

drivers/infiniband/hw/nes/nes_verbs.h +1 -2
index 38e38cf..7029088 100644
@@ -192,7 +192,6 @@ struct nes_qp {
 };
 
 struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
-		struct ib_phys_buf *buffer_list, int num_phys_buf, int acc,
-		u64 * iova_start);
+		u64 addr, u64 size, int acc, u64 *iova_start);
 
 #endif			/* NES_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

PATCH 7/10 amso1100: fold c2_reg_phys_mr into c2_get_dma_mr

In reply to a message not in the archive
---
 drivers/staging/rdma/amso1100/c2_provider.c | 71 ++++++-----------------------
 1 file changed, 14 insertions(+), 57 deletions(-)
drivers/staging/rdma/amso1100/c2_provider.c +14 -57
index 6c3e9cc..1691fc7 100644
@@ -323,43 +323,21 @@ static inline u32 c2_convert_access(int acc)
 	    C2_ACF_LOCAL_READ | C2_ACF_WINDOW_BIND;
 }
 
-static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
-				    struct ib_phys_buf *buffer_list,
-				    int num_phys_buf, int acc, u64 * iova_start)
+static struct ib_mr *c2_get_dma_mr(struct ib_pd *pd, int acc)
 {
 	struct c2_mr *mr;
 	u64 *page_list;
-	u32 total_len;
-	int err, i, j, k, page_shift, pbl_depth;
+	const u32 total_len = 0xffffffff;	/* AMSO1100 limit */
+	int err, page_shift, pbl_depth, i;
+	u64 kva = 0;
 
-	pbl_depth = 0;
-	total_len = 0;
+	pr_debug("%s:%u\n", __func__, __LINE__);
 
-	page_shift = PAGE_SHIFT;
 	/*
-	 * If there is only 1 buffer we assume this could
-	 * be a map of all phy mem...use a 32k page_shift.
+	 * This is a map of all phy mem...use a 32k page_shift.
 	 */
-	if (num_phys_buf == 1)
-		page_shift += 3;
-
-	for (i = 0; i < num_phys_buf; i++) {
-
-		if (offset_in_page(buffer_list[i].addr)) {
-			pr_debug("Unaligned Memory Buffer: 0x%x\n",
-				(unsigned int) buffer_list[i].addr);
-			return ERR_PTR(-EINVAL);
-		}
-
-		if (!buffer_list[i].size) {
-			pr_debug("Invalid Buffer Size\n");
-			return ERR_PTR(-EINVAL);
-		}
-
-		total_len += buffer_list[i].size;
-		pbl_depth += ALIGN(buffer_list[i].size,
-				   BIT(page_shift)) >> page_shift;
-	}
+	page_shift = PAGE_SHIFT + 3;
+	pbl_depth = ALIGN(total_len, BIT(page_shift)) >> page_shift;
 
 	page_list = vmalloc(sizeof(u64) * pbl_depth);
 	if (!page_list) {
@@ -368,16 +346,8 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	for (i = 0, j = 0; i < num_phys_buf; i++) {
-
-		int naddrs;
-
- 		naddrs = ALIGN(buffer_list[i].size,
-			       BIT(page_shift)) >> page_shift;
-		for (k = 0; k < naddrs; k++)
-			page_list[j++] = (buffer_list[i].addr +
-						     (k << page_shift));
-	}
+	for (i = 0; i < pbl_depth; i++)
+		page_list[i] = (i << page_shift);
 
 	mr = kmalloc(sizeof(*mr), GFP_KERNEL);
 	if (!mr) {
@@ -385,17 +355,17 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	mr->pd = to_c2pd(ib_pd);
+	mr->pd = to_c2pd(pd);
 	mr->umem = NULL;
 	pr_debug("%s - page shift %d, pbl_depth %d, total_len %u, "
 		"*iova_start %llx, first pa %llx, last pa %llx\n",
 		__func__, page_shift, pbl_depth, total_len,
-		(unsigned long long) *iova_start,
+		(unsigned long long) kva,
 	       	(unsigned long long) page_list[0],
 	       	(unsigned long long) page_list[pbl_depth-1]);
-  	err = c2_nsmr_register_phys_kern(to_c2dev(ib_pd->device), page_list,
+  	err = c2_nsmr_register_phys_kern(to_c2dev(pd->device), page_list,
 					 BIT(page_shift), pbl_depth,
-					 total_len, 0, iova_start,
+					 total_len, 0, &kva,
 					 c2_convert_access(acc), mr);
 	vfree(page_list);
 	if (err) {
@@ -406,19 +376,6 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
 	return &mr->ibmr;
 }
 
-static struct ib_mr *c2_get_dma_mr(struct ib_pd *pd, int acc)
-{
-	struct ib_phys_buf bl;
-	u64 kva = 0;
-
-	pr_debug("%s:%u\n", __func__, __LINE__);
-
-	/* AMSO1100 limit */
-	bl.size = 0xffffffff;
-	bl.addr = 0;
-	return c2_reg_phys_mr(pd, &bl, 1, acc, &kva);
-}
-
 static struct ib_mr *c2_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 				    u64 virt, int acc, struct ib_udata *udata)
 {
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

PATCH 8/10 ehca: stop using struct ib_phys_buf

In reply to a message not in the archive

And simplify the calling convention for full-memory registrations.

---
 drivers/staging/rdma/ehca/ehca_classes.h |  5 +-
 drivers/staging/rdma/ehca/ehca_mrmw.c    | 94 +++++++++++++++-----------------
 2 files changed, 46 insertions(+), 53 deletions(-)
drivers/staging/rdma/ehca/ehca_classes.h +2 -3
index bd45e0f..e8c3387 100644
@@ -316,9 +316,8 @@ struct ehca_mr_pginfo {
 
 	union {
 		struct { /* type EHCA_MR_PGI_PHYS section */
-			int num_phys_buf;
-			struct ib_phys_buf *phys_buf_array;
-			u64 next_buf;
+			u64 addr;
+			u16 size;
 		} phy;
 		struct { /* type EHCA_MR_PGI_USER section */
 			struct ib_umem *region;
drivers/staging/rdma/ehca/ehca_mrmw.c +44 -50

124 lines not on this page · raw message

Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

PATCH 9/10 IB: remove the struct ib_phys_buf definition

In reply to a message not in the archive
---
 include/rdma/ib_verbs.h | 5 -----
 1 file changed, 5 deletions(-)
include/rdma/ib_verbs.h +0 -5
index ea093ee..284916d 100644
@@ -1143,11 +1143,6 @@ enum ib_access_flags {
 	IB_ACCESS_ON_DEMAND     = (1<<6),
 };
 
-struct ib_phys_buf {
-	u64      addr;
-	u64      size;
-};
-
 /*
  * XXX: these are apparently used for ->rereg_user_mr, no idea why they
  * are hidden here instead of a uapi header!
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#17 lore raw

PATCH 10/10 IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
---
 drivers/infiniband/core/uverbs_cmd.c        | 6 ------
 drivers/infiniband/core/verbs.c             | 8 +-------
 drivers/infiniband/hw/cxgb3/iwch_provider.c | 3 ---
 drivers/infiniband/hw/cxgb4/mem.c           | 3 ---
 drivers/staging/rdma/ehca/ehca_mrmw.c       | 1 -
 include/rdma/ib_verbs.h                     | 1 -
 6 files changed, 1 insertion(+), 21 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +0 -6
index 48776bb..57be54e 100644
@@ -992,7 +992,6 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
 	mr->pd      = pd;
 	mr->uobject = uobj;
 	atomic_inc(&pd->usecnt);
-	atomic_set(&mr->usecnt, 0);
 
 	uobj->object = mr;
 	ret = idr_add_uobj(&ib_uverbs_mr_idr, uobj);
@@ -1090,11 +1089,6 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file,
 		}
 	}
 
-	if (atomic_read(&mr->usecnt)) {
-		ret = -EBUSY;
-		goto put_uobj_pd;
-	}
-
 	old_pd = mr->pd;
 	ret = mr->device->rereg_user_mr(mr, cmd.flags, cmd.start,
 					cmd.length, cmd.hca_va,
drivers/infiniband/core/verbs.c +1 -7
index 2858b35..cce080f 100644
@@ -1209,7 +1209,6 @@ struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags)
 		mr->pd      = pd;
 		mr->uobject = NULL;
 		atomic_inc(&pd->usecnt);
-		atomic_set(&mr->usecnt, 0);
 	}
 
 	return mr;
@@ -1218,13 +1217,9 @@ EXPORT_SYMBOL(ib_get_dma_mr);
 
 int ib_dereg_mr(struct ib_mr *mr)
 {
-	struct ib_pd *pd;
+	struct ib_pd *pd = mr->pd;
 	int ret;
 
-	if (atomic_read(&mr->usecnt))
-		return -EBUSY;
-
-	pd = mr->pd;
 	ret = mr->device->dereg_mr(mr);
 	if (!ret)
 		atomic_dec(&pd->usecnt);
@@ -1260,7 +1255,6 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
 		mr->pd      = pd;
 		mr->uobject = NULL;
 		atomic_inc(&pd->usecnt);
-		atomic_set(&mr->usecnt, 0);
 	}
 
 	return mr;
drivers/infiniband/hw/cxgb3/iwch_provider.c +0 -3
index 097eb93..f806289 100644
@@ -458,9 +458,6 @@ static int iwch_dereg_mr(struct ib_mr *ib_mr)
 	u32 mmid;
 
 	PDBG("%s ib_mr %p\n", __func__, ib_mr);
-	/* There can be no memory windows */
-	if (atomic_read(&ib_mr->usecnt))
-		return -EINVAL;
 
 	mhp = to_iwch_mr(ib_mr);
 	kfree(mhp->pages);
drivers/infiniband/hw/cxgb4/mem.c +0 -3
index 1eb833a..7849890 100644
@@ -704,9 +704,6 @@ int c4iw_dereg_mr(struct ib_mr *ib_mr)
 	u32 mmid;
 
 	PDBG("%s ib_mr %p\n", __func__, ib_mr);
-	/* There can be no memory windows */
-	if (atomic_read(&ib_mr->usecnt))
-		return -EINVAL;
 
 	mhp = to_c4iw_mr(ib_mr);
 	rhp = mhp->rhp;
drivers/staging/rdma/ehca/ehca_mrmw.c +0 -1
index 1814af7..06b832b 100644
@@ -1339,7 +1339,6 @@ int ehca_reg_internal_maxmr(
 	e_mr->ib.ib_mr.pd = &e_pd->ib_pd;
 	e_mr->ib.ib_mr.uobject = NULL;
 	atomic_inc(&(e_pd->ib_pd.usecnt));
-	atomic_set(&(e_mr->ib.ib_mr.usecnt), 0);
 	*e_maxmr = e_mr;
 	return 0;
 
include/rdma/ib_verbs.h +0 -1
index 284916d..e45776e 100644
@@ -1306,7 +1306,6 @@ struct ib_mr {
 	u64		   iova;
 	u32		   length;
 	unsigned int	   page_size;
-	atomic_t	   usecnt; /* count number of MWs */
 };
 
 struct ib_mw {
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by
#19 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 1 line · Christoph Hellwig

Shouldn't the description of this patch be changed into something like "Remove the usecnt field from ib_mr since it is always zero" ?

Anyway:

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 4 lines · Bart Van Assche
Quoted 1 line · Christoph Hellwig

Shouldn't the description of this patch be changed into something like "Remove the usecnt field from ib_mr since it is always zero" ?

Agree.

I would like us to avoid empty changes log for IB core patches and actually all over the rdma subsystem.

Or.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#23 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive

include/rdma/ib_verbs.h struct ib_mr { · line 1309

Quoted 11 lines · Christoph Hellwig
include/rdma/ib_verbs.h +0 -1
index 284916d..e45776e 100644
@@ -1306,7 +1306,6 @@ struct ib_mr {
  	u64		   iova;
  	u32		   length;
  	unsigned int	   page_size;
-	atomic_t	   usecnt; /* count number of MWs */
  };

This comment is part of Roland's uverbs commit.

I wonder if LL driver supporting the IB_WR_BIND_MW op ref the MR on port send and deref it on completion?

Or.

include/rdma/ib_verbs.h struct ib_mr { · line 1312

Quoted 3 lines
include/rdma/ib_verbs.h +0 -1
  struct ib_mw {
-- 1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#25 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 13 lines · Or Gerlitz

include/rdma/ib_verbs.h struct ib_mr { · line 1309

Quoted 10 lines · Christoph Hellwig

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 284916d..e45776e 100644

include/rdma/ib_verbs.h +0 -1
@@ -1306,7 +1306,6 @@ struct ib_mr {
      u64           iova;
      u32           length;
      unsigned int       page_size;
-    atomic_t       usecnt; /* count number of MWs */
  };

This comment is part of Roland's uverbs commit.

I saw now that you removed in-kernel support for MWs as a downstream patch of this series. I guess this cleanup needs to go there as the refcount field of kernel MRs relates to MWs. This will also help someone coming in the future and returning the in-kernel MW support to avoid forgetting on doing the refs.

Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

Re: [PATCH 09/10] IB: remove the struct ib_phys_buf definition

In reply to a message not in the archive
Quoted 4 lines · Christoph Hellwig

Here, too, please avoid empty change logs to IB core patches.

Or.

Quoted 10 lines
---
  include/rdma/ib_verbs.h | 5 -----
  1 file changed, 5 deletions(-)
include/rdma/ib_verbs.h +0 -0
index ea093ee..284916d 100644
@@ -1143,11 +1143,6 @@ enum ib_access_flags {
  	IB_ACCESS_ON_DEMAND     = (1<<6),

include/rdma/ib_verbs.h enum ib_access_flags { · line 1148

Quoted 10 lines
include/rdma/ib_verbs.h +0 -5
  };
 
-struct ib_phys_buf {
-	u64      addr;
-	u64      size;
-};
-
  /*
   * XXX: these are apparently used for ->rereg_user_mr, no idea why they
   * are hidden here instead of a uapi header!

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#26 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 14 lines

include/rdma/ib_verbs.h struct ib_mr { · line 1309

Quoted 11 lines
include/rdma/ib_verbs.h +0 -1
index 284916d..e45776e 100644
@@ -1306,7 +1306,6 @@ struct ib_mr {
      u64           iova;
      u32           length;
      unsigned int       page_size;
-    atomic_t       usecnt; /* count number of MWs */
  };

This comment is part of Roland's uverbs commit.

Quoted 2 lines

I wonder if LL driver supporting the IB_WR_BIND_MW op ref the MR on port send and deref it on completion?

I don't see why any driver would ref the underlying MR at post_send(IB_WR_BIND_MW) time. It doesn't really make sense.

However, I think that the patch from Shani 6b52a12bc3fc ("IB/uverbs:
Implement memory windows support in uverbs") is wrong. A memory window allocation should really reference the MR and not the PD (which is referenced by the MR). Otherwise the MR deregistration is allowed with windows bound to it. If this is the case then this field is not useless and we should fix ib_uverbs_alloc_mw()?

Haggai, can you shed some light here? It's Shani's and your code. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#28 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 6 lines · Sagi Grimberg

However, I think that the patch from Shani 6b52a12bc3fc ("IB/uverbs:
Implement memory windows support in uverbs") is wrong. A memory window allocation should really reference the MR and not the PD (which is referenced by the MR). Otherwise the MR deregistration is allowed with windows bound to it. If this is the case then this field is not useless and we should fix ib_uverbs_alloc_mw()?

I tend to agree, lets not remove the field this is clarified with Haggai and Co

Quoted 2 lines

Haggai, can you shed some light here? It's Shani's and your code.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#29 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 6 lines · Sagi Grimberg

However, I think that the patch from Shani 6b52a12bc3fc ("IB/uverbs:
Implement memory windows support in uverbs") is wrong. A memory window allocation should really reference the MR and not the PD (which is referenced by the MR). Otherwise the MR deregistration is allowed with windows bound to it. If this is the case then this field is not useless and we should fix ib_uverbs_alloc_mw()?

I tend to agree, lets not remove the field till this is clarified with Haggai and Co

Quoted 2 lines

Haggai, can you shed some light here? It's Shani's and your code.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#30 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 20 lines · Sagi Grimberg
Quoted 14 lines

include/rdma/ib_verbs.h struct ib_mr { · line 1309

Quoted 11 lines
include/rdma/ib_verbs.h +0 -1
index 284916d..e45776e 100644
@@ -1306,7 +1306,6 @@ struct ib_mr {
      u64           iova;
      u32           length;
      unsigned int       page_size;
-    atomic_t       usecnt; /* count number of MWs */
  };

This comment is part of Roland's uverbs commit.

Quoted 2 lines

I wonder if LL driver supporting the IB_WR_BIND_MW op ref the MR on port send and deref it on completion?

I don't see why any driver would ref the underlying MR at post_send(IB_WR_BIND_MW) time. It doesn't really make sense.

Quoted 8 lines

However, I think that the patch from Shani 6b52a12bc3fc ("IB/uverbs:
Implement memory windows support in uverbs") is wrong. A memory window allocation should really reference the MR and not the PD (which is referenced by the MR). Otherwise the MR deregistration is allowed with windows bound to it. If this is the case then this field is not useless and we should fix ib_uverbs_alloc_mw()?

Haggai, can you shed some light here? It's Shani's and your code.

A memory window takes reference on its PD during creation. It can only be used by that PD, and it isn't bound to any memory region yet. You are right that we want to prevent deregistration of an MR when there are memory windows bound to it. This is suggested (although not required) by the IBA specifications (section 10.6.7.2.6 Deregistering Regions with Bound Windows). The problem with the usecnt field in ib_mr as you wrote is that it needs to reflect what happens at bind / invalidate time, but bind can happen in user-space without the kernel knowing, and invalidation can similarly occur due to a send-with-invalidate message being received. This is why in the ConnectX-3 implementation of memory windows we didn't use the ib_mr.usecnt field, but relied on a hardware implementation of the reference count.

As I said, the spec also allows a device to proceed with deregistering an MR, leaving an orphan memory window. I don't think we can prevent this in the kernel, and I'm not sure it would be a good idea anyway, so I think it is okay to remove the use_cnt field.

Regards,
Haggai
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#32 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 11 lines
Quoted 9 lines

However, I think that the patch from Shani 6b52a12bc3fc ("IB/uverbs:
Implement memory windows support in uverbs") is wrong. A memory window allocation should really reference the MR and not the PD (which is referenced by the MR). Otherwise the MR deregistration is allowed with windows bound to it. If this is the case then this field is not useless and we should fix ib_uverbs_alloc_mw()?

Haggai, can you shed some light here? It's Shani's and your code.

A memory window takes reference on its PD during creation. It can only be used by that PD, and it isn't bound to any memory region yet.

Right! it's still not bound. I mixed up the details. Thanks for reminding me.

Quoted 8 lines

You are right that we want to prevent deregistration of an MR when there are memory windows bound to it. This is suggested (although not required) by the IBA specifications (section 10.6.7.2.6 Deregistering Regions with Bound Windows). The problem with the usecnt field in ib_mr as you wrote is that it needs to reflect what happens at bind / invalidate time, but bind can happen in user-space without the kernel knowing, and invalidation can similarly occur due to a send-with-invalidate message being received.

That's true. I didn't see user-space do that either but if it's not required it's probably a good idea not to complicate things.

Quoted 8 lines

This is why in the ConnectX-3 implementation of memory windows we didn't use the ib_mr.usecnt field, but relied on a hardware implementation of the reference count.

As I said, the spec also allows a device to proceed with deregistering an MR, leaving an orphan memory window. I don't think we can prevent this in the kernel, and I'm not sure it would be a good idea anyway, so I think it is okay to remove the use_cnt field.

I completely agree. we don't have any way to maintain mw<->mr reference so let's drop it.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw

Re: [PATCH 09/10] IB: remove the struct ib_phys_buf definition

In reply to a message not in the archive
Quoted 8 lines · Or Gerlitz
Quoted 4 lines · Christoph Hellwig

Here, too, please avoid empty change logs to IB core patches.

You sound like a bot :)

While I tend to ask people for better description a lot when I don't understand a patch without them I really don't see what you might want here. In general it really helps to say what you want to see. I can't see a useful explanation for removing an unused structure. But if you really want one and come up with a coherent sentence or two I can add it. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#22 lore raw

Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

In reply to a message not in the archive
Quoted 5 lines · Bart Van Assche
Quoted 1 line · Christoph Hellwig

Shouldn't the description of this patch be changed into something like "Remove the usecnt field from ib_mr since it is always zero" ?

In software context unused for my also includes something that's only written to. But I can change it to something like:

IB: remove the write only usecnt field from struct ib_mr

to be a little more precise.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Re: [PATCH 09/10] IB: remove the struct ib_phys_buf definition

In reply to a message not in the archive
Quoted 2 lines · Christoph Hellwig

I can't see a useful explanation for removing an unused structure. But if you really want one and come up with a coherent sentence or two I can add it.

patch title - IB/core: Remove struct ib_phys_buf

change log:

Remove struct ib_phys_buf since YYY

where you need to fill few words for YYY, e.g not used anywhere ever, not used after you did cleanup ZZZ, something that can serve someone reading your patch
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html