Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alison Schofield" <alison.schofield@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v2 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active
Date: Fri, 09 Oct 2026 22:24:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-166129@kernel.org> (raw)
In-Reply-To: <08e082b7f77318f295fe700b2ec917e0e0815c08.1791582353.git.alison.schofield@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] cxl_test: mock HMEM and region APIs still hardcode inactive mock_cfmws[0]
--

commit ab47ae118b5deca13e8e911d3065f4b4d5bbbf01
Author: Alison Schofield <alison.schofield@intel.com>

tools/testing/cxl: Skip the auto region when no volatile window is active

This commit updates the mock auto region in the CXL testing infrastructure to
dynamically locate an active volatile window instead of hardcoding CFMWS0.
It sets up the auto region only when a volatile window is available, avoiding
issues where endpoint decoders are programmed at HPA 0 during XOR interleave
tests.

> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index aa140307e0c3c..46a87633e9621 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -423,6 +423,18 @@ struct acpi_cedt_cxims *mock_cxims[1] = {
>  	[0] = &mock_cedt.cxims0.cxims,
>  };
>  
> +static struct acpi_cedt_cfmws *mock_auto_region_cfmws(void)
> +{
> +	for (int i = cfmws_start; i <= cfmws_end; i++) {
> +		struct acpi_cedt_cfmws *window = mock_cfmws[i];
> +
> +		if (window->restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
> +			return window;
> +	}
> +
> +	return NULL;
> +}
> +

[ ... ]

> @@ -1135,9 +1154,9 @@ static bool mock_decoder_handle_saved(struct cxl_decoder *cxld, struct cxl_test_
>  }
>  
>  static void mock_init_hdm_type2_cxled(struct cxl_endpoint_decoder *cxled,
> -				      struct cxl_port *port)
> +				      struct cxl_port *port,
> +				      struct acpi_cedt_cfmws *window)
>  {
> -	struct acpi_cedt_cfmws *window = mock_cfmws[0];
>  	struct cxl_decoder *cxld = &cxled->cxld;

[Severity: Medium]
With this patch introducing `mock_auto_region_cfmws()` and removing the
hardcoded `mock_cfmws[0]` here, should the mock HMEM and region APIs also be
updated to use the dynamic window?

Looking at `mock_walk_hmem_resources()`, `mock_region_intersects()`, and
`mock_region_intersects_soft_reserve()`, they all still unconditionally
reference `mock_cfmws[0]`:

tools/testing/cxl/test/cxl.c:mock_walk_hmem_resources() {
	struct acpi_cedt_cfmws *cfmws = mock_cfmws[0];
	struct resource window =
		DEFINE_RES_MEM(cfmws->base_hpa, cfmws->window_size / 2);
    ...
}

If `interleave_arithmetic=1` (XOR tests) is active, `mock_cfmws[0]` is inactive
and its HPA base is left as 0. Will these functions falsely report soft-reserved
memory and CXL intersections at HPA 0 instead of the real volatile window?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791582353.git.alison.schofield@intel.com?part=2

  reply	other threads:[~2026-10-09 22:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 22:11 [PATCH v2 0/3] cxl/test: mockfixups and new topology support Alison Schofield
2026-10-09 22:11 ` [PATCH v2 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
2026-10-09 23:00   ` Dave Jiang
2026-10-09 22:11 ` [PATCH v2 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active Alison Schofield
2026-10-09 22:24   ` sashiko-bot [this message]
2026-10-09 22:39     ` Alison Schofield
2026-10-09 23:02   ` Dave Jiang
2026-10-09 22:11 ` [PATCH v2 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests Alison Schofield
2026-10-09 23:03   ` Dave Jiang

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-166129@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alison.schofield@intel.com \
    --cc=linux-cxl@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