Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jason Gunthorpe" <jgg@nvidia.com>
Cc: kvm@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH v6 03/10] net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h
Date: Thu, 17 Sep 2026 23:52:41 +0000	[thread overview]
Message-ID: <20260917235241.842E61F000FF@smtp.kernel.org> (raw)
In-Reply-To: <3-v6-8af36cf7b73f+e2-mlx5st_jgg@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] net: mlx5: header mlx5_ifc_macros.h is not self-contained
--

commit 0109c2f8560d36d799afcabc263cdbca6ffef5b4
Author: Jason Gunthorpe <jgg@ziepe.ca>
Date:   Wed Sep 16 23:49:51 2026 +0000

net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h

This commit extracts the MLX5_SET/GET macro family and internal helpers
from device.h into a new standalone header mlx5_ifc_macros.h. This allows
code that cannot include device.h, such as VFIO selftests, to use these
macros directly.

> device.h cannot be
> included by the VFIO selftest because it pulls in rdma/ib_verbs.h;
> the macros themselves depend only on endian helpers, BUILD_BUG_ON,
> and basic C types.

Is this commit message entirely accurate? The extracted macros also use
pr_debug in MLX5_GET_PR, which establishes an unstated dependency on
kernel printing utilities.

> diff --git a/include/linux/mlx5/mlx5_ifc_macros.h b/include/linux/mlx5/mlx5_ifc_macros.h
> new file mode 100644
> --- /dev/null
> +++ b/include/linux/mlx5/mlx5_ifc_macros.h
> @@ -0,0 +1,133 @@
[ ... ]
> + * Extracted from device.h so that code which cannot include device.h
> + * (e.g. selftests) can still use the MLX5_SET/GET family directly.
> + */
> +
> +#ifndef MLX5_IFC_MACROS_H
> +#define MLX5_IFC_MACROS_H
> +
> +/* Internal helpers -- 32-bit */

[Severity: Low]
Could this header cause build failures if it is included first in a new
source file or selftest? It relies on u32, BUILD_BUG_ON, offsetof, and
cpu_to_be32, but does not include <linux/types.h>, <linux/stddef.h>, or
<linux/build_bug.h> to satisfy those dependencies.

[ ... ]
> +#define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
> +__mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
> +__mlx5_mask(typ, fld))
> +
> +#define MLX5_GET_PR(typ, p, fld) ({ \
> +	u32 ___t = MLX5_GET(typ, p, fld); \
> +	pr_debug(#fld " = 0x%x\n", ___t); \
> +	___t; \
> +})

[Severity: Low]
Does MLX5_GET_PR introduce a hidden dependency on kernel printing utilities?
Any selftest or driver pulling this header might fail to compile if the
printk headers are not already included, which seems to conflict with the
stated goal of keeping this header lightweight for selftests.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/0-v6-8af36cf7b73f+e2-mlx5st_jgg@nvidia.com?part=3

  reply	other threads:[~2026-09-17 23:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 23:49 [PATCH v6 00/10] mlx5 support for VFIO self test Jason Gunthorpe
2026-09-16 23:49 ` [PATCH v6 01/10] net/mlx5: Add IFC structures for CQE and WQE Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-16 23:49 ` [PATCH v6 02/10] net/mlx5: Move HW constant groups from device.h/cq.h to mlx5_ifc.h Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-16 23:49 ` [PATCH v6 03/10] net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot [this message]
2026-09-16 23:49 ` [PATCH v6 04/10] net/mlx5: Add ONCE and MMIO accessor variants to mlx5_ifc_macros.h Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-16 23:49 ` [PATCH v6 05/10] selftests: Add additional kernel functions to tools/include/ Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-16 23:49 ` [PATCH v6 06/10] vfio: selftests: Allow drivers to specify required region size Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-18 11:52     ` Jason Gunthorpe
2026-09-18 14:58       ` David Matlack
2026-09-18 20:00         ` Jason Gunthorpe
2026-09-21 20:48           ` David Matlack
2026-09-21 22:38             ` Jason Gunthorpe
2026-09-16 23:49 ` [PATCH v6 07/10] vfio: selftests: Add dev_dbg Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-16 23:49 ` [PATCH v6 08/10] vfio: selftests: Add mlx5 driver - HW init and command interface Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-16 23:49 ` [PATCH v6 09/10] vfio: selftests: Add mlx5 driver - data path and memcpy ops Jason Gunthorpe
2026-09-17 23:52   ` sashiko-bot
2026-09-16 23:49 ` [PATCH v6 10/10] vfio: selftests: mlx5 driver - add send_msi support Jason Gunthorpe
2026-09-17 23:52   ` 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=20260917235241.842E61F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --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