Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Srirangan Madhavan" <smadhavan@nvidia.com>,
	linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v18 19/19] cxl: Add KUnit checks for HDM decoder unpacking
Date: Sat, 05 Dec 2026 04:38:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-251093@kernel.org> (raw)
In-Reply-To: <20261205041453.3946529-20-smadhavan@nvidia.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] cxl: KUnit test violates CXL placement, module, and suite naming
  rules
- [Low] cxl: unconditional non-KUnit export and unused cxl_core
  allowlist entry
--

commit 898a6ebae0ecbe24f0a8fe116f43eeee40e4d537
Author: Srirangan Madhavan <smadhavan@nvidia.com>

cxl: Add KUnit checks for HDM decoder unpacking

This commit adds a KUnit test suite for cxl_hdm_unpack_decoder() and extends
its module export list so the new test module can call it.

> diff --git a/drivers/cxl/core/hdm_regs.c b/drivers/cxl/core/hdm_regs.c
> index 358e2ba7495de..0c43956c3c86c 100644
> --- a/drivers/cxl/core/hdm_regs.c
> +++ b/drivers/cxl/core/hdm_regs.c
> @@ -188,7 +188,7 @@ int cxl_hdm_unpack_decoder(struct cxl_decoder_config *config, int id,
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_FOR_MODULES(cxl_hdm_unpack_decoder, "cxl_core");
> +EXPORT_SYMBOL_FOR_MODULES(cxl_hdm_unpack_decoder, "cxl_core,cxl_hdm_unpack_kunit");

[Severity: Low]
Does cxl_hdm_unpack_decoder() still need an unconditional export or cxl_core
in its allowlist?

Outside drivers/cxl/core/hdm_regs.c, only this KUnit test calls
cxl_hdm_unpack_decoder(); cxl_core calls cxl_hdm_read_decoder() instead.
This keeps a test-only helper exported in vmlinux even when KUnit is
disabled.

Using VISIBLE_IF_KUNIT and EXPORT_SYMBOL_IF_KUNIT() would restrict the export
to KUnit builds.

[ ... ]

> diff --git a/drivers/cxl/tests/hdm_unpack_kunit.c b/drivers/cxl/tests/hdm_unpack_kunit.c
> new file mode 100644
> index 0000000000000..c1131e1457574
> --- /dev/null
> +++ b/drivers/cxl/tests/hdm_unpack_kunit.c
> @@ -0,0 +1,91 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/* Copyright (c) 2026 NVIDIA Corporation & Affiliates */
> +#include <kunit/test.h>
> +#include <linux/bitfield.h>
> +#include <linux/sizes.h>
> +
> +#include "cxl.h"
> +#include "../core/core.h"

[ ... ]

> +static struct kunit_suite cxl_hdm_test_suite = {
> +	.name = "cxl-hdm-unpack",
> +	.test_cases = cxl_hdm_test_cases,
> +};

[Severity: Low]
Should this suite live in drivers/cxl/core/tests/ and use underscores in its
name?

Because cxl_hdm_test_suite sets .name to "cxl-hdm-unpack" with hyphens
instead of underscores, running KUnit with a cxl_* filter glob silently skips
it while running the sibling CXL suites (cxl_hdm_encoding and cxl_core_mbox).

Documentation/driver-api/cxl/testing.rst also expects tests beside the code
under test with path-derived underscore names, matching
drivers/cxl/core/tests/mbox_kunit.c.

Moving this file to drivers/cxl/core/tests/hdm_unpack_kunit.c with module
cxl_core_hdm_unpack_kunit and suite cxl_core_hdm_unpack would follow that
convention and avoid including "../core/core.h".

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205041453.3946529-1-smadhavan@nvidia.com?part=19

      reply	other threads:[~2026-12-05  4:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  4:14 [PATCH v18 00/19] PCI/CXL: Add CXL reset support for Type 2 devices Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 01/19] cxl: Clarify decoder interleave limit Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 02/19] cxl: Share CXL port upstream PCI device lookup Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 03/19] cxl: Move decoder declarations to shared header Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 04/19] cxl: Embed decoder configuration in a standalone structure Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 05/19] cxl: Introduce endpoint HDM decoder settings Srirangan Madhavan
2026-12-05  4:30   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 06/19] cxl: Move HDM decoder helpers to built-in code Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 07/19] cxl: Share HDM decoder register unpacking Srirangan Madhavan
2026-12-05  4:30   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 08/19] cxl: Move cxl_rwsem into built-in code Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 09/19] cxl: Refresh cached PCI HDM decoder settings Srirangan Madhavan
2026-12-05  4:38   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 10/19] cxl: Build register block helpers into the kernel Srirangan Madhavan
2026-12-05  4:14 ` [PATCH v18 11/19] PCI/CXL: Cache endpoint HDM state during PCI enumeration Srirangan Madhavan
2026-12-05  4:44   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 12/19] PCI/CXL: Add CXL Device Reset sequencing Srirangan Madhavan
2026-12-05  4:38   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 13/19] cxl: Validate and synchronize HDM ranges around reset Srirangan Madhavan
2026-12-05  4:47   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 14/19] PCI/CXL: Reject reset with unsafe function scope Srirangan Madhavan
2026-12-05  4:43   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 15/19] PCI/CXL: Restore CXL state after PCI reset Srirangan Madhavan
2026-12-05  4:50   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 16/19] PCI/CXL: Expose CXL Reset as a PCI reset method Srirangan Madhavan
2026-12-05  4:48   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 17/19] PCI/CXL: Restore CXL state after CXL bus reset Srirangan Madhavan
2026-12-05  4:47   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 18/19] PCI/CXL: Flush host and device caches for " Srirangan Madhavan
2026-12-05  4:54   ` sashiko-bot
2026-12-05  4:14 ` [PATCH v18 19/19] cxl: Add KUnit checks for HDM decoder unpacking Srirangan Madhavan
2026-12-05  4:38   ` sashiko-bot [this message]

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-251093@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=smadhavan@nvidia.com \
    /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