Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Edward Srouji" <edwards@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next 09/11] RDMA/mlx5: Cache the CQ core device and resolve it via cq_to_mdev()
Date: Wed, 18 Nov 2026 14:04:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-221138@kernel.org> (raw)
In-Reply-To: <20261117-mlx5-sd-prep-v1-9-8efd124c7895@nvidia.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] RDMA/mlx5: hardcoded CQE size breaks kernel CQ resize in
  mlx5_ib_resize_cq() [1]
--

commit f7f9b358d0115bb8244e5cdf7d781d650dc
Author: Akiva Goldberger <agoldberger@nvidia.com>

RDMA/mlx5: Cache the CQ core device and resolve it via cq_to_mdev()

This commit caches the mlx5_core_dev pointer in struct mlx5_ib_cq at CQ
creation time and introduces the cq_to_mdev() helper to resolve it instead
of going through dev->mdev.

> diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
> index b28ce05fab8f3..5eaf50fe7f540 100644
> --- a/drivers/infiniband/hw/mlx5/cq.c
> +++ b/drivers/infiniband/hw/mlx5/cq.c

[ ... ]

> @@ -1394,7 +1398,7 @@ int mlx5_ib_resize_cq(struct ib_cq *ibcq, unsigned int entries,
>  		struct mlx5_frag_buf *frag_buf;
>  
>  		cqe_size = 64;
> -		err = resize_kernel(dev, cq, entries, cqe_size);
> +		err = resize_kernel(cq, entries, cqe_size);
>  		if (err)
>  			goto ex;
>  		frag_buf = &cq->resize_buf->frag_buf;

[Severity: Critical]
This problem wasn't introduced by this patch, but does hardcoding
cqe_size = 64 here break kernel CQ resize on systems with a 128-byte
cache line size [1]?

mlx5_ib_create_cq() initializes kernel CQs with a 128-byte CQE size when
cache_line_size() == 128.  Allocating the resize buffer with cqe_size = 64
causes copy_resize_cqes() to reject the mismatch with -EINVAL after
mlx5_core_modify_cq() has already modified the CQ in hardware, leaving the
software and hardware CQ state out of sync:

drivers/infiniband/hw/mlx5/cq.c:copy_resize_cqes() {
    ...
	ssize = cq->buf.cqe_size;
	dsize = cq->resize_buf->cqe_size;
	if (ssize != dsize) {
		mlx5_ib_warn(dev, "resize from different cqe size is not supported\n");
		return -EINVAL;
	}
    ...
}

[1] https://sashiko.dev/#/bug/linux-a14c4506-9ca5-444f-8be1-7990d9e001b0

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-mlx5-sd-prep-v1-0-8efd124c7895@nvidia.com?part=9

  reply	other threads:[~2026-11-18 14:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 14:01 [PATCH rdma-next 00/11] RDMA/mlx5: Preparation for SD support Edward Srouji
2026-11-17 14:01 ` [PATCH rdma-next 01/11] RDMA/mlx5: Enforce dev/mdev naming for device pointers Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 02/11] RDMA/mlx5: Rename to_mdev() helpers that return an IB device Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 03/11] RDMA/mlx5: Select the PD and SRQ core device through the PD Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 04/11] RDMA/mlx5: Select the core device through PD for QP commands Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 05/11] RDMA/mlx5: Cache the MR core device and resolve the MW's via its PD Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 06/11] RDMA/mlx5: Select the AH core device through their PD Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 07/11] RDMA/mlx5: Select the QP core device through its PD Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 08/11] RDMA/mlx5: Resolve core device from ucontext for DEVX resources Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 09/11] RDMA/mlx5: Cache the CQ core device and resolve it via cq_to_mdev() Edward Srouji
2026-11-18 14:04   ` sashiko-bot [this message]
2026-11-17 14:01 ` [PATCH rdma-next 10/11] RDMA/mlx5: Resolve the bfreg UAR-index core device from the ucontext Edward Srouji
2026-11-18 14:04   ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 11/11] RDMA/mlx5: Resolve UAR and mmap core devices via " Edward Srouji
2026-11-18 14:04   ` 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-221138@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=edwards@nvidia.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