mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Richard Cheng <icheng@nvidia.com>,
	dave@stgolabs.net, jonathan.cameron@huawei.com,
	alison.schofield@intel.com, vishal.l.verma@intel.com,
	ira.weiny@intel.com, dan.j.williams@intel.com
Cc: fabio.m.de.francesco@linux.intel.com, rrichter@amd.com,
	ming.li@zohomail.com, linux-cxl@vger.kernel.org,
	linux-kernel@vger.kernel.org, newtonl@nvidia.com,
	kristinc@nvidia.com, kaihengf@nvidia.com, kobak@nvidia.com
Subject: Re: [PATCH v4] cxl/test: Enforce PMD alignment for volatile mock regions
Date: Thu, 28 May 2026 08:35:43 -0700	[thread overview]
Message-ID: <45d678e0-b482-4302-abee-db8b66d24900@intel.com> (raw)
In-Reply-To: <20260527090332.30002-1-icheng@nvidia.com>



On 5/27/26 2:03 AM, Richard Cheng wrote:
> cxl_test allocates synthetic CFMWS HPA windows from a gen_pool with
> SZ_256M alignment. On arm64 with CONFIG_ARM64_64K_PAGES=y and
> CONFIG_PGTABLE_LEVELS=3, PMD_SIZE is 512M, so every CXL region carved
> from a volatile window inherits a non-PMD-aligned start, and
> cxl_dax_region_probe() -> alloc_dax_region() fails:
> 
> """
>     cxl_dax_region dax_region1: probe with driver cxl_dax_region failed
>                                 with error -12
> """
> 
> Enforce that every volatile mock CFMWS is PMD-aligned in both start and
> size
> 
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Acked-by: Kai-Heng Feng <kaihengf@nvidia.com>
> Signed-off-by: Richard Cheng <icheng@nvidia.com>

Applied to cxl/next
8850852b25f7884d9804f8de5591edb3881bd674

> ---
> Changelog:
> 
> v3->v4:
>     - Replace compile-time BUILD_BUG_ON() with runtime
>       IS_ALIGNED(mock_auto_region_size, PMD_SIZE) check in
> cxl_test_init().
> 
> v2->v3:
>     - Correct hunk headers
>     - Add base commit SHA
> 
> v1->v2:
>     - Reframe from "fix start alignment" to "enforce PMD invariant for
>       volatile CFMWS"
>     - Bump cfmws5.window_size to max(SZ_256M, PMD_SIZE)
>     - Gate populate_cedt() alignment on
>       ACPI_CEDT_CFMWS_RESTRICT_VOLATILE so PMEM windows stay at SZ_256M
>     - Add BUILD_BUG_ON for MOCK_AUTO_REGION_SIZE_DEFAULT v.s. PMD_SIZE
>       in cxl_test_init()
> 
> Best regards,
> Richard Cheng.
> ---
>  tools/testing/cxl/test/cxl.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index 418669927fb0..6f8fa7504cad 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -318,7 +318,7 @@ static struct {
>  			.restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
>  					ACPI_CEDT_CFMWS_RESTRICT_VOLATILE,
>  			.qtg_id = FAKE_QTG_ID,
> -			.window_size = SZ_256M,
> +			.window_size = SZ_256M > PMD_SIZE ? SZ_256M : PMD_SIZE,
>  		},
>  		.target = { 3 },
>  	},
> @@ -495,9 +495,12 @@ static int populate_cedt(void)
>  
>  	for (i = cfmws_start; i <= cfmws_end; i++) {
>  		struct acpi_cedt_cfmws *window = mock_cfmws[i];
> +		int align = SZ_256M;
>  
>  		cfmws_elc_update(window, i);
> -		res = alloc_mock_res(window->window_size, SZ_256M);
> +		if (window->restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
> +			align = max_t(int, SZ_256M, PMD_SIZE);
> +		res = alloc_mock_res(window->window_size, align);
>  		if (!res)
>  			return -ENOMEM;
>  		window->base_hpa = res->range.start;
> @@ -1826,6 +1829,12 @@ static __init int cxl_test_init(void)
>  	int rc, i;
>  	struct range mappable;
>  
> +	if (!IS_ALIGNED(mock_auto_region_size, PMD_SIZE)) {
> +		pr_err_once("mock_auto_region_size %d must be PMD-aligned\n",
> +			    mock_auto_region_size);
> +		return -EINVAL;
> +	}
> +
>  	cxl_acpi_test();
>  	cxl_core_test();
>  	cxl_mem_test();
> 
> base-commit: 507bd4b66c85d5b65696150cc16d31ac0b2ab151


      parent reply	other threads:[~2026-05-28 15:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  9:03 Richard Cheng
2026-05-28  1:05 ` Alison Schofield
2026-05-28  9:34   ` Richard Cheng
2026-05-28 15:35 ` Dave Jiang [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=45d678e0-b482-4302-abee-db8b66d24900@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=fabio.m.de.francesco@linux.intel.com \
    --cc=icheng@nvidia.com \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kaihengf@nvidia.com \
    --cc=kobak@nvidia.com \
    --cc=kristinc@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=newtonl@nvidia.com \
    --cc=rrichter@amd.com \
    --cc=vishal.l.verma@intel.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

all inboxes | Powered by JetHome®