Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eric Curtin" <ericcurtin17@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/5] RDMA/mlx5: Use PAGE_SIZE_MIN/MAX in build-time page size checks
Date: Wed, 02 Dec 2026 03:28:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-244781@kernel.org> (raw)
In-Reply-To: <20261202032044.1705331-3-ericcurtin17@gmail.com>

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

  reply	other threads:[~2026-12-02  3:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-244781@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ericcurtin17@gmail.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox