Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [RFC PATCH v2 1/5] RDMA/mthca: Make the direct buffer size limits macros
       [not found] <20261202032044.1705331-1-ericcurtin17@gmail.com>
@ 2026-12-02  3:17 ` Eric Curtin
  2026-12-02  3:17 ` [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks Eric Curtin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Eric Curtin @ 2026-12-02  3:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Eric Curtin, Jason Gunthorpe, Leon Romanovsky, linux-rdma

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant, so it cannot initialise an enumerator.

Convert MTHCA_MAX_DIRECT_CQ_SIZE, MTHCA_MAX_DIRECT_QP_SIZE and
MTHCA_MAX_DIRECT_SRQ_SIZE from enum members to macros of 4 * PAGE_SIZE.
They are only used as arguments to mthca_buf_alloc(), so they can be
evaluated at run time.

No functional change.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 drivers/infiniband/hw/mthca/mthca_cq.c  | 4 +---
 drivers/infiniband/hw/mthca/mthca_qp.c  | 3 ++-
 drivers/infiniband/hw/mthca/mthca_srq.c | 4 +---
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 39d4ff15849e..0dc018319340 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -46,9 +46,7 @@
 #include "mthca_cmd.h"
 #include "mthca_memfree.h"
 
-enum {
-	MTHCA_MAX_DIRECT_CQ_SIZE = 4 * PAGE_SIZE
-};
+#define MTHCA_MAX_DIRECT_CQ_SIZE (4 * PAGE_SIZE)
 
 enum {
 	MTHCA_CQ_ENTRY_SIZE = 0x20
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 53f43649f7d0..c0578ae29ef3 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -49,8 +49,9 @@
 #include "mthca_memfree.h"
 #include "mthca_wqe.h"
 
+#define MTHCA_MAX_DIRECT_QP_SIZE (4 * PAGE_SIZE)
+
 enum {
-	MTHCA_MAX_DIRECT_QP_SIZE = 4 * PAGE_SIZE,
 	MTHCA_ACK_REQ_FREQ       = 10,
 	MTHCA_FLIGHT_LIMIT       = 9,
 	MTHCA_UD_HEADER_SIZE     = 72, /* largest UD header possible */
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index a85935ccce88..f2e52f410c46 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -43,9 +43,7 @@
 #include "mthca_memfree.h"
 #include "mthca_wqe.h"
 
-enum {
-	MTHCA_MAX_DIRECT_SRQ_SIZE = 4 * PAGE_SIZE
-};
+#define MTHCA_MAX_DIRECT_SRQ_SIZE (4 * PAGE_SIZE)
 
 struct mthca_tavor_srq_context {
 	__be64 wqe_base_ds;	/* low 6 bits is descriptor size */

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

* [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks
       [not found] <20261202032044.1705331-1-ericcurtin17@gmail.com>
  2026-12-02  3:17 ` [RFC PATCH v2 1/5] RDMA/mthca: Make the direct buffer size limits macros Eric Curtin
@ 2026-12-02  3:17 ` Eric Curtin
  2026-12-02  3:28   ` sashiko-bot
  2026-12-02  3:17 ` [RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX Eric Curtin
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Eric Curtin @ 2026-12-02  3:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Eric Curtin, Leon Romanovsky, Jason Gunthorpe, linux-rdma

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant, so it cannot be used in BUILD_BUG_ON() or
static_assert().

In calc_total_bfregs(), check that MAX_BFREGS is a multiple of
MLX5_NON_FP_BFREGS_IN_PAGE_MAX and not smaller than
MLX5_NON_FP_BFREGS_IN_PAGE_MIN. In mlx5r_umr_alloc_xlt(), check that
PAGE_SIZE_MIN is a multiple of MLX5_UMR_FLEX_ALIGNMENT.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 drivers/infiniband/hw/mlx5/main.c | 4 ++--
 drivers/infiniband/hw/mlx5/umr.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 2ab38068db83..6e7bbd1317a4 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1910,8 +1910,8 @@ static int calc_total_bfregs(struct mlx5_ib_dev *dev, bool lib_uar_4k,
 	if (req->total_num_bfregs == 0)
 		return -EINVAL;
 
-	BUILD_BUG_ON(MLX5_MAX_BFREGS % MLX5_NON_FP_BFREGS_IN_PAGE);
-	BUILD_BUG_ON(MLX5_MAX_BFREGS < MLX5_NON_FP_BFREGS_IN_PAGE);
+	BUILD_BUG_ON(MLX5_MAX_BFREGS % MLX5_NON_FP_BFREGS_IN_PAGE_MAX);
+	BUILD_BUG_ON(MLX5_MAX_BFREGS < MLX5_NON_FP_BFREGS_IN_PAGE_MIN);
 
 	if (req->total_num_bfregs > MLX5_MAX_BFREGS)
 		return -ENOMEM;
diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/umr.c
index 711075e3d9ea..1401040526c8 100644
--- a/drivers/infiniband/hw/mlx5/umr.c
+++ b/drivers/infiniband/hw/mlx5/umr.c
@@ -500,7 +500,7 @@ static void *mlx5r_umr_alloc_xlt(size_t *nents, size_t ent_size, gfp_t gfp_mask)
 	size_t size;
 	void *res = NULL;
 
-	static_assert(PAGE_SIZE % MLX5_UMR_FLEX_ALIGNMENT == 0);
+	static_assert(PAGE_SIZE_MIN % MLX5_UMR_FLEX_ALIGNMENT == 0);
 
 	/*
 	 * MLX5_IB_UPD_XLT_ATOMIC doesn't signal an atomic context just that the

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

* [RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX
       [not found] <20261202032044.1705331-1-ericcurtin17@gmail.com>
  2026-12-02  3:17 ` [RFC PATCH v2 1/5] RDMA/mthca: Make the direct buffer size limits macros Eric Curtin
  2026-12-02  3:17 ` [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks Eric Curtin
@ 2026-12-02  3:17 ` Eric Curtin
  2026-12-02  3:29   ` sashiko-bot
  2026-12-02  3:17 ` [RFC PATCH v2 4/5] RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN Eric Curtin
  2026-12-02  3:17 ` [RFC PATCH v2 5/5] RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs Eric Curtin
  4 siblings, 1 reply; 9+ messages in thread
From: Eric Curtin @ 2026-12-02  3:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Eric Curtin, Chengchang Tang, Junxian Huang, Jason Gunthorpe,
	Leon Romanovsky, linux-rdma

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant. HNS_ROCE_DB_PER_PAGE was an enum constant and
sized the order0 and order1 bitmaps in struct hns_roce_db_pgdir.

Turn HNS_ROCE_DB_PER_PAGE into a macro that is evaluated at run time,
add HNS_ROCE_DB_PER_PAGE_MAX based on PAGE_SIZE_MAX, and use the latter
to declare the bitmaps so they are large enough for any page size.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 drivers/infiniband/hw/hns/hns_roce_device.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 5890ee69247c..1cd57a0477fa 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -166,9 +166,8 @@ enum {
 #define HNS_ROCE_DB_TYPE_COUNT			2
 #define HNS_ROCE_DB_UNIT_SIZE			4
 
-enum {
-	HNS_ROCE_DB_PER_PAGE = PAGE_SIZE / 4
-};
+#define HNS_ROCE_DB_PER_PAGE		(PAGE_SIZE / 4)
+#define HNS_ROCE_DB_PER_PAGE_MAX	(PAGE_SIZE_MAX / 4)
 
 enum hns_roce_reset_stage {
 	HNS_ROCE_STATE_NON_RST,
@@ -395,8 +394,9 @@ struct hns_roce_buf {
 
 struct hns_roce_db_pgdir {
 	struct list_head	list;
-	DECLARE_BITMAP(order0, HNS_ROCE_DB_PER_PAGE);
-	DECLARE_BITMAP(order1, HNS_ROCE_DB_PER_PAGE / HNS_ROCE_DB_TYPE_COUNT);
+	DECLARE_BITMAP(order0, HNS_ROCE_DB_PER_PAGE_MAX);
+	DECLARE_BITMAP(order1,
+		       HNS_ROCE_DB_PER_PAGE_MAX / HNS_ROCE_DB_TYPE_COUNT);
 	unsigned long		*bits[HNS_ROCE_DB_TYPE_COUNT];
 	u32			*page;
 	dma_addr_t		db_dma;

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

* [RFC PATCH v2 4/5] RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN
       [not found] <20261202032044.1705331-1-ericcurtin17@gmail.com>
                   ` (2 preceding siblings ...)
  2026-12-02  3:17 ` [RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX Eric Curtin
@ 2026-12-02  3:17 ` Eric Curtin
  2026-12-02  3:31   ` sashiko-bot
  2026-12-02  3:17 ` [RFC PATCH v2 5/5] RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs Eric Curtin
  4 siblings, 1 reply; 9+ messages in thread
From: Eric Curtin @ 2026-12-02  3:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Eric Curtin, Michael Margolin, Gal Pressman, Yossi Leybovich,
	Jason Gunthorpe, Leon Romanovsky, linux-rdma

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant, so it cannot be used in BUILD_BUG_ON().

Check that the chunk payload fits in a page against PAGE_SIZE_MIN, so
that it holds for every page size.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 drivers/infiniband/hw/efa/efa_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index d56eb132545b..1c27484e5b39 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -1478,7 +1478,7 @@ static int pbl_indirect_initialize(struct efa_dev *dev, struct pbl_context *pbl)
 	struct scatterlist *sgl;
 	int sg_dma_cnt, err;
 
-	BUILD_BUG_ON(EFA_CHUNK_PAYLOAD_SIZE > PAGE_SIZE);
+	BUILD_BUG_ON(EFA_CHUNK_PAYLOAD_SIZE > PAGE_SIZE_MIN);
 	sgl = efa_vmalloc_buf_to_sg(pbl->pbl_buf, size_in_pages);
 	if (!sgl)
 		return -ENOMEM;

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

* [RFC PATCH v2 5/5] RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs
       [not found] <20261202032044.1705331-1-ericcurtin17@gmail.com>
                   ` (3 preceding siblings ...)
  2026-12-02  3:17 ` [RFC PATCH v2 4/5] RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN Eric Curtin
@ 2026-12-02  3:17 ` Eric Curtin
  2026-12-02  3:36   ` sashiko-bot
  4 siblings, 1 reply; 9+ messages in thread
From: Eric Curtin @ 2026-12-02  3:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Eric Curtin, Jason Gunthorpe, Leon Romanovsky, linux-rdma

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant. Enum values, array sizes and BUILD_BUG_ON() need
one.

FRMR pools: make handles[] in struct frmr_handles_page a flexible array
and allocate a full PAGE_SIZE for each page structure, so that
NUM_HANDLES_PER_PAGE is evaluated at run time.

IPoIB: IPOIB_CM_HEAD_SIZE and IPOIB_CM_RX_SG move out of the enum into
macros. Add IPOIB_CM_RX_SG_MAX and IPOIB_CM_HEAD_SIZE_MIN, based on
PAGE_SIZE_MIN, and use the former for the mapping and rx_sge arrays and
the matching function arguments, and the latter in the copybreak
BUILD_BUG_ON().

uverbs: use PAGE_SIZE_MIN in the attribute length BUILD_BUG_ON_ZERO()
in include/rdma/uverbs_ioctl.h.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 drivers/infiniband/core/frmr_pools.c      |  2 +-
 drivers/infiniband/core/frmr_pools.h      |  2 +-
 drivers/infiniband/ulp/ipoib/ipoib.h      | 13 +++++++++----
 drivers/infiniband/ulp/ipoib/ipoib_cm.c   |  8 ++++----
 drivers/infiniband/ulp/ipoib/ipoib_main.c |  2 +-
 include/rdma/uverbs_ioctl.h               |  2 +-
 6 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/core/frmr_pools.c b/drivers/infiniband/core/frmr_pools.c
index 4af36dc8cf38..8412a1693318 100644
--- a/drivers/infiniband/core/frmr_pools.c
+++ b/drivers/infiniband/core/frmr_pools.c
@@ -20,7 +20,7 @@ static int push_handle_to_queue_locked(struct frmr_queue *queue, u32 handle)
 	struct frmr_handles_page *page;
 
 	if (queue->ci >= queue->num_pages * NUM_HANDLES_PER_PAGE) {
-		page = kzalloc_obj(*page, GFP_ATOMIC);
+		page = kzalloc(PAGE_SIZE, GFP_ATOMIC);
 		if (!page)
 			return -ENOMEM;
 		queue->num_pages++;
diff --git a/drivers/infiniband/core/frmr_pools.h b/drivers/infiniband/core/frmr_pools.h
index 67e1402169ae..b714ecaa4816 100644
--- a/drivers/infiniband/core/frmr_pools.h
+++ b/drivers/infiniband/core/frmr_pools.h
@@ -18,7 +18,7 @@
 
 struct frmr_handles_page {
 	struct list_head list;
-	u32 handles[NUM_HANDLES_PER_PAGE];
+	u32 handles[];
 };
 
 /* FRMR queue holds a list of frmr_handles_page.
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 143e03b64902..34a19e96d0a0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -70,8 +70,6 @@ enum {
 
 	IPOIB_CM_MTU		  = 0x10000 - 0x10, /* padding to align header to 16 */
 	IPOIB_CM_BUF_SIZE	  = IPOIB_CM_MTU  + IPOIB_ENCAP_LEN,
-	IPOIB_CM_HEAD_SIZE	  = IPOIB_CM_BUF_SIZE % PAGE_SIZE,
-	IPOIB_CM_RX_SG		  = ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE) / PAGE_SIZE,
 	IPOIB_RX_RING_SIZE	  = 256,
 	IPOIB_TX_RING_SIZE	  = 128,
 	IPOIB_MAX_QUEUE_SIZE	  = 8192,
@@ -118,6 +116,13 @@ enum {
 	IPOIB_RTNL_CHILD	  = 2,
 };
 
+#define IPOIB_CM_HEAD_SIZE	((int)(IPOIB_CM_BUF_SIZE % PAGE_SIZE))
+#define IPOIB_CM_HEAD_SIZE_MIN	((int)(IPOIB_CM_BUF_SIZE % PAGE_SIZE_MIN))
+#define IPOIB_CM_RX_SG		\
+	((unsigned int)(ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE) / PAGE_SIZE))
+#define IPOIB_CM_RX_SG_MAX	\
+	((int)(ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE_MIN) / PAGE_SIZE_MIN))
+
 #define	IPOIB_OP_RECV   (1ul << 31)
 #ifdef CONFIG_INFINIBAND_IPOIB_CM
 #define	IPOIB_OP_CM     (1ul << 30)
@@ -259,7 +264,7 @@ struct ipoib_cm_tx {
 
 struct ipoib_cm_rx_buf {
 	struct sk_buff *skb;
-	u64 mapping[IPOIB_CM_RX_SG];
+	u64 mapping[IPOIB_CM_RX_SG_MAX];
 };
 
 struct ipoib_cm_dev_priv {
@@ -280,7 +285,7 @@ struct ipoib_cm_dev_priv {
 	struct list_head	start_list;
 	struct list_head	reap_list;
 	struct ib_wc		ibwc[IPOIB_NUM_WC];
-	struct ib_sge		rx_sge[IPOIB_CM_RX_SG];
+	struct ib_sge		rx_sge[IPOIB_CM_RX_SG_MAX];
 	struct ib_recv_wr       rx_wr;
 	int			nonsrq_conn_qp;
 	int			max_cm_mtu;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index ed0592898384..314f9de684e3 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -81,7 +81,7 @@ static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id,
 			       const struct ib_cm_event *event);
 
 static void ipoib_cm_dma_unmap_rx(struct ipoib_dev_priv *priv, int frags,
-				  u64 mapping[IPOIB_CM_RX_SG])
+				  u64 mapping[IPOIB_CM_RX_SG_MAX])
 {
 	int i;
 
@@ -141,7 +141,7 @@ static int ipoib_cm_post_receive_nonsrq(struct net_device *dev,
 static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev,
 					     struct ipoib_cm_rx_buf *rx_ring,
 					     int id, int frags,
-					     u64 mapping[IPOIB_CM_RX_SG],
+					     u64 mapping[IPOIB_CM_RX_SG_MAX],
 					     gfp_t gfp)
 {
 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -350,7 +350,7 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i
 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
 	struct {
 		struct ib_recv_wr wr;
-		struct ib_sge sge[IPOIB_CM_RX_SG];
+		struct ib_sge sge[IPOIB_CM_RX_SG_MAX];
 	} *t;
 	int ret;
 	int i;
@@ -565,7 +565,7 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
 	struct sk_buff *skb, *newskb;
 	struct ipoib_cm_rx *p;
 	unsigned long flags;
-	u64 mapping[IPOIB_CM_RX_SG];
+	u64 mapping[IPOIB_CM_RX_SG_MAX];
 	int frags;
 	int has_srq;
 	struct sk_buff *small_skb;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index d1e1c5c89dad..a51d1c43f628 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -2760,7 +2760,7 @@ static int __init ipoib_init_module(void)
 	 * When copying small received packets, we only copy from the
 	 * linear data part of the SKB, so we rely on this condition.
 	 */
-	BUILD_BUG_ON(IPOIB_CM_COPYBREAK > IPOIB_CM_HEAD_SIZE);
+	BUILD_BUG_ON(IPOIB_CM_COPYBREAK > IPOIB_CM_HEAD_SIZE_MIN);
 
 	ipoib_register_debugfs();
 
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 1aaaadb8daf6..e6b5aa88571f 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -489,7 +489,7 @@ struct uapi_definition {
 		.id = (_attr_id) +                                             \
 		      BUILD_BUG_ON_ZERO((_min_len) == 0 ||                     \
 					(_max_len) >                           \
-						PAGE_SIZE / sizeof(void *) ||  \
+						PAGE_SIZE_MIN / sizeof(void *) || \
 					(_min_len) > (_max_len) ||             \
 					(_access) == UVERBS_ACCESS_NEW ||      \
 					(_access) == UVERBS_ACCESS_DESTROY),   \

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

* Re: [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks
  2026-12-02  3:17 ` [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks Eric Curtin
@ 2026-12-02  3:28   ` sashiko-bot
  0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-12-02  3:28 UTC (permalink / raw)
  To: Eric Curtin; +Cc: linux-rdma

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] RDMA/mlx5: undeclared BFREGS_IN_PAGE_MAX/MIN macros in
  calc_total_bfregs()
- [High] RDMA/mlx5: undeclared PAGE_SIZE_MIN identifier in
  mlx5r_umr_alloc_xlt()
- [Low] RDMA/mlx5: calc_total_bfregs() checks MLX5_MAX_BFREGS against
  _MIN not _MAX
--

commit 399f50a48d3694fc2576c7a4627f236f127ee561
Author: Eric Curtin <eric.curtin@docker.com>

RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks

This commit replaces PAGE_SIZE and MLX5_NON_FP_BFREGS_IN_PAGE in build-time
assertions with min/max page size variants to support boot-time page size
selection.

> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 2ab38068db838..6e7bbd1317a46 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -1910,8 +1910,8 @@ static int calc_total_bfregs(struct mlx5_ib_dev *dev, bool lib_uar_4k,
>  	if (req->total_num_bfregs == 0)
>  		return -EINVAL;
>  
> -	BUILD_BUG_ON(MLX5_MAX_BFREGS % MLX5_NON_FP_BFREGS_IN_PAGE);
> -	BUILD_BUG_ON(MLX5_MAX_BFREGS < MLX5_NON_FP_BFREGS_IN_PAGE);
> +	BUILD_BUG_ON(MLX5_MAX_BFREGS % MLX5_NON_FP_BFREGS_IN_PAGE_MAX);
> +	BUILD_BUG_ON(MLX5_MAX_BFREGS < MLX5_NON_FP_BFREGS_IN_PAGE_MIN);

[Severity: High]
Where are MLX5_NON_FP_BFREGS_IN_PAGE_MAX and MLX5_NON_FP_BFREGS_IN_PAGE_MIN
defined?  Neither identifier exists in the tree, so building mlx5_ib fails
with undeclared identifier errors.  In addition, include/linux/mlx5/device.h
still defines MLX5_UARS_IN_PAGE and MLX5_NON_FP_BFREGS_IN_PAGE as enum
constants initialized from PAGE_SIZE, which fails to compile when PAGE_SIZE
is not an integer constant expression.

[Severity: Low]
Should the second check compare MLX5_MAX_BFREGS against
MLX5_NON_FP_BFREGS_IN_PAGE_MAX instead of MLX5_NON_FP_BFREGS_IN_PAGE_MIN?
To guarantee that MLX5_MAX_BFREGS can hold at least one page of non-fast-path
bfregs across all boot-time page sizes, it needs to be checked against the
largest possible per-page count rather than the smallest.

> diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/umr.c
> index 711075e3d9ea0..1401040526c87 100644
> --- a/drivers/infiniband/hw/mlx5/umr.c
> +++ b/drivers/infiniband/hw/mlx5/umr.c
> @@ -500,7 +500,7 @@ static void *mlx5r_umr_alloc_xlt(size_t *nents, size_t ent_size, gfp_t gfp_mask)
>  	size_t size;
>  	void *res = NULL;
>  
> -	static_assert(PAGE_SIZE % MLX5_UMR_FLEX_ALIGNMENT == 0);
> +	static_assert(PAGE_SIZE_MIN % MLX5_UMR_FLEX_ALIGNMENT == 0);

[Severity: High]
Does this break the build because PAGE_SIZE_MIN is undeclared?  PAGE_SIZE_MIN
is not defined anywhere in the tree, causing drivers/infiniband/hw/mlx5/umr.c
to fail to compile.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202032044.1705331-1-ericcurtin17@gmail.com?part=2

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

* Re: [RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX
  2026-12-02  3:17 ` [RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX Eric Curtin
@ 2026-12-02  3:29   ` sashiko-bot
  0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-12-02  3:29 UTC (permalink / raw)
  To: Eric Curtin; +Cc: linux-rdma

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] RDMA/hns: build failure due to undeclared PAGE_SIZE_MAX
--

commit 9e38d632a1eb90afcf10550005a979cf315bbdfd
Author: Eric Curtin <eric.curtin@docker.com>

RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX

This commit converts HNS_ROCE_DB_PER_PAGE into a macro and introduces
HNS_ROCE_DB_PER_PAGE_MAX based on PAGE_SIZE_MAX to size the order0 and
order1 bitmaps in struct hns_roce_db_pgdir.

> diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
> index 5890ee69247c2..1cd57a0477fa1 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_device.h
> +++ b/drivers/infiniband/hw/hns/hns_roce_device.h
> @@ -166,9 +166,8 @@ enum {
>  #define HNS_ROCE_DB_TYPE_COUNT			2
>  #define HNS_ROCE_DB_UNIT_SIZE			4
>  
> -enum {
> -	HNS_ROCE_DB_PER_PAGE = PAGE_SIZE / 4
> -};
> +#define HNS_ROCE_DB_PER_PAGE		(PAGE_SIZE / 4)
> +#define HNS_ROCE_DB_PER_PAGE_MAX	(PAGE_SIZE_MAX / 4)
>  
>  enum hns_roce_reset_stage {
>  	HNS_ROCE_STATE_NON_RST,
> @@ -395,8 +394,9 @@ struct hns_roce_buf {
>  
>  struct hns_roce_db_pgdir {
>  	struct list_head	list;
> -	DECLARE_BITMAP(order0, HNS_ROCE_DB_PER_PAGE);
> -	DECLARE_BITMAP(order1, HNS_ROCE_DB_PER_PAGE / HNS_ROCE_DB_TYPE_COUNT);
> +	DECLARE_BITMAP(order0, HNS_ROCE_DB_PER_PAGE_MAX);
> +	DECLARE_BITMAP(order1,
> +		       HNS_ROCE_DB_PER_PAGE_MAX / HNS_ROCE_DB_TYPE_COUNT);
>  	unsigned long		*bits[HNS_ROCE_DB_TYPE_COUNT];
>  	u32			*page;
>  	dma_addr_t		db_dma;

[Severity: High]
Where is PAGE_SIZE_MAX defined?  No header in the tree defines
PAGE_SIZE_MAX, so expanding HNS_ROCE_DB_PER_PAGE_MAX in struct
hns_roce_db_pgdir fails to compile with an undeclared identifier error
whenever drivers/infiniband/hw/hns/ is built.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202032044.1705331-1-ericcurtin17@gmail.com?part=3

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

* Re: [RFC PATCH v2 4/5] RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN
  2026-12-02  3:17 ` [RFC PATCH v2 4/5] RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN Eric Curtin
@ 2026-12-02  3:31   ` sashiko-bot
  0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-12-02  3:31 UTC (permalink / raw)
  To: Eric Curtin; +Cc: linux-rdma

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] RDMA/efa: undeclared PAGE_SIZE_MIN in pbl_indirect_initialize()
  breaks build
--

commit 91d66f3b0542356c1efcafa903e48e7d4de94576
Author: Eric Curtin <eric.curtin@docker.com>

RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN

This commit replaces PAGE_SIZE with PAGE_SIZE_MIN in the BUILD_BUG_ON()
check in pbl_indirect_initialize().

> diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
> index d56eb132545b5..1c27484e5b399 100644
> --- a/drivers/infiniband/hw/efa/efa_verbs.c
> +++ b/drivers/infiniband/hw/efa/efa_verbs.c
> @@ -1478,7 +1478,7 @@ static int pbl_indirect_initialize(struct efa_dev *dev, struct pbl_context *pbl)
>  	struct scatterlist *sgl;
>  	int sg_dma_cnt, err;
>  
> -	BUILD_BUG_ON(EFA_CHUNK_PAYLOAD_SIZE > PAGE_SIZE);
> +	BUILD_BUG_ON(EFA_CHUNK_PAYLOAD_SIZE > PAGE_SIZE_MIN);

[Severity: High]
Does this break the build when CONFIG_INFINIBAND_EFA is enabled?
PAGE_SIZE_MIN is not defined anywhere in the kernel headers, so compiling
drivers/infiniband/hw/efa/efa_verbs.c fails with an undeclared identifier
error.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202032044.1705331-1-ericcurtin17@gmail.com?part=4

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

* Re: [RFC PATCH v2 5/5] RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs
  2026-12-02  3:17 ` [RFC PATCH v2 5/5] RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs Eric Curtin
@ 2026-12-02  3:36   ` sashiko-bot
  0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-12-02  3:36 UTC (permalink / raw)
  To: Eric Curtin; +Cc: linux-rdma

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] RDMA: undeclared identifier PAGE_SIZE_MIN in ipoib.h and
  uverbs_ioctl.h
--

commit 9e5b709f6747c196f7838e46f6a5bb87fdb0b541
Author: Eric Curtin <eric.curtin@docker.com>

RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs

This commit replaces compile-time uses of PAGE_SIZE in FRMR pools, IPoIB,
and uverbs with runtime allocations or PAGE_SIZE_MIN-based macros to
support boot-time page size selection.

> diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
> index 143e03b649021..34a19e96d0a0a 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib.h
> +++ b/drivers/infiniband/ulp/ipoib/ipoib.h
> @@ -70,8 +70,6 @@ enum {
>  
>  	IPOIB_CM_MTU		  = 0x10000 - 0x10, /* padding to align header to 16 */
>  	IPOIB_CM_BUF_SIZE	  = IPOIB_CM_MTU  + IPOIB_ENCAP_LEN,
> -	IPOIB_CM_HEAD_SIZE	  = IPOIB_CM_BUF_SIZE % PAGE_SIZE,
> -	IPOIB_CM_RX_SG		  = ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE) / PAGE_SIZE,
>  	IPOIB_RX_RING_SIZE	  = 256,
>  	IPOIB_TX_RING_SIZE	  = 128,
>  	IPOIB_MAX_QUEUE_SIZE	  = 8192,
> @@ -118,6 +116,13 @@ enum {
>  	IPOIB_RTNL_CHILD	  = 2,
>  };
>  
> +#define IPOIB_CM_HEAD_SIZE	((int)(IPOIB_CM_BUF_SIZE % PAGE_SIZE))
> +#define IPOIB_CM_HEAD_SIZE_MIN	((int)(IPOIB_CM_BUF_SIZE % PAGE_SIZE_MIN))
> +#define IPOIB_CM_RX_SG		\
> +	((unsigned int)(ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE) / PAGE_SIZE))
> +#define IPOIB_CM_RX_SG_MAX	\
> +	((int)(ALIGN(IPOIB_CM_BUF_SIZE, PAGE_SIZE_MIN) / PAGE_SIZE_MIN))
> +
>  #define	IPOIB_OP_RECV   (1ul << 31)
>  #ifdef CONFIG_INFINIBAND_IPOIB_CM
>  #define	IPOIB_OP_CM     (1ul << 30)
> @@ -259,7 +264,7 @@ struct ipoib_cm_tx {
>  
>  struct ipoib_cm_rx_buf {
>  	struct sk_buff *skb;
> -	u64 mapping[IPOIB_CM_RX_SG];
> +	u64 mapping[IPOIB_CM_RX_SG_MAX];
>  };

[Severity: High]
Where is PAGE_SIZE_MIN defined?

PAGE_SIZE_MIN is not defined anywhere in the tree, so expanding
IPOIB_CM_RX_SG_MAX in struct ipoib_cm_rx_buf, IPOIB_CM_HEAD_SIZE_MIN in
ipoib_init_module(), or UVERBS_ATTR_IDRS_ARR() in
include/rdma/uverbs_ioctl.h breaks the build with an undeclared identifier
error when CONFIG_INFINIBAND_IPOIB or consumers such as
drivers/infiniband/hw/mlx5/fs.c are compiled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202032044.1705331-1-ericcurtin17@gmail.com?part=5

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

end of thread, other threads:[~2026-12-02  3:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261202032044.1705331-1-ericcurtin17@gmail.com>
2026-12-02  3:17 ` [RFC PATCH v2 1/5] RDMA/mthca: Make the direct buffer size limits macros Eric Curtin
2026-12-02  3:17 ` [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks Eric Curtin
2026-12-02  3:28   ` sashiko-bot
2026-12-02  3:17 ` [RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX Eric Curtin
2026-12-02  3:29   ` sashiko-bot
2026-12-02  3:17 ` [RFC PATCH v2 4/5] RDMA/efa: Check EFA_CHUNK_PAYLOAD_SIZE against PAGE_SIZE_MIN Eric Curtin
2026-12-02  3:31   ` sashiko-bot
2026-12-02  3:17 ` [RFC PATCH v2 5/5] RDMA: Avoid compile-time PAGE_SIZE in FRMR pools, IPoIB and uverbs Eric Curtin
2026-12-02  3:36   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox