Linux CXL
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Yuquan Wang <wangyuquan1236@phytium.com.cn>
Cc: rafael@kernel.org, lenb@kernel.org, dave@stgolabs.net,
	jonathan.cameron@huawei.com, dave.jiang@intel.com,
	vishal.l.verma@intel.com, ira.weiny@intel.com,
	dan.j.williams@intel.com, rrichter@amd.com, bfaccini@nvidia.com,
	rppt@kernel.org, haibo1.xu@intel.com, chenbaozi@phytium.com.cn,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-cxl@vger.kernel.org
Subject: Re: [PATCH v2] ACPI: NUMA: debug invalid unused PXM value for CFMWs
Date: Thu, 13 Mar 2025 09:28:46 -0700	[thread overview]
Message-ID: <Z9MHvp6GA_iGwfg0@aschofie-mobl2.lan> (raw)
In-Reply-To: <20250313060907.2381416-1-wangyuquan1236@phytium.com.cn>

On Thu, Mar 13, 2025 at 02:09:07PM +0800, Yuquan Wang wrote:
> The absence of SRAT would cause the fake_pxm to be -1 and increment
> to 0, then send to acpi_parse_cfmws(). If there exists CXL memory
> ranges that are defined in the CFMWS and not already defined in the
> SRAT, the new node (node0) for the CXL memory would be invalid, as
> node0 is already in "used".
> 
> This utilizes disable_srat() & srat_disabled() to fail CXL init.

Seems like this fixup has drifted from adjusting the fake_pxm to 
shutting down CXL parsing. More below -

> 
> Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
> ---
> 
> Changes in v2:
> - Add disable_srat() when fake_pxm is invalid
> - Add srat_disabled() check in cxl_acpi_probe() and acpi_parse_cfmws()
> 
> 
>  drivers/acpi/numa/srat.c | 10 ++++++++++
>  drivers/cxl/acpi.c       |  4 ++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
> index 00ac0d7bb8c9..2dac25c9258a 100644
> --- a/drivers/acpi/numa/srat.c
> +++ b/drivers/acpi/numa/srat.c
> @@ -441,6 +441,11 @@ static int __init acpi_parse_cfmws(union acpi_subtable_headers *header,
>  	start = cfmws->base_hpa;
>  	end = cfmws->base_hpa + cfmws->window_size;
>  
> +	if (srat_disabled()) {
> +		pr_err("SRAT is missing or bad while processing CFMWS.\n");
> +		return -EINVAL;
> +	}
> +

This goes too far by shutting down cfmws parsing for lack of SRAT.

>  	/*
>  	 * The SRAT may have already described NUMA details for all,
>  	 * or a portion of, this CFMWS HPA range. Extend the memblks
> @@ -646,6 +651,11 @@ int __init acpi_numa_init(void)
>  		if (node_to_pxm_map[i] > fake_pxm)
>  			fake_pxm = node_to_pxm_map[i];
>  	}
> +
> +	/* Make sure CFMWs fake nodes start at node[1] */
> +	if (fake_pxm < 0)
> +		disable_srat();
> +

How does the code above make sure fake node starts at node[1]?
Would an explicit adjustment like this work?

-       last_real_pxm = fake_pxm;
-       fake_pxm++;
+       fake_pxm = max(fake_pxm, 1);
+       last_real_pxm = fake_pxm--;

>  	last_real_pxm = fake_pxm;
>  	fake_pxm++;
>  	acpi_table_parse_cedt(ACPI_CEDT_TYPE_CFMWS, acpi_parse_cfmws,
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index cb14829bb9be..e75a8ead99f6 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -829,6 +829,10 @@ static int cxl_acpi_probe(struct platform_device *pdev)
>  	if (rc)
>  		return rc;
>  
> +	/* CXL must be in a NUMA system */
> +	if (srat_disabled())
> +		return -EINVAL;
> +
>  	cxl_res = devm_kzalloc(host, sizeof(*cxl_res), GFP_KERNEL);
>  	if (!cxl_res)
>  		return -ENOMEM;
> -- 
> 2.34.1
> 

  parent reply	other threads:[~2025-03-13 16:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13  6:09 [PATCH v2] ACPI: NUMA: debug invalid unused PXM value for CFMWs Yuquan Wang
2025-03-13 15:02 ` Gregory Price
2025-03-14 10:12   ` Jonathan Cameron
2025-03-14 13:38     ` Gregory Price
2025-03-14 16:55       ` Jonathan Cameron
2025-03-13 16:28 ` Alison Schofield [this message]
2025-03-14  7:55   ` Yuquan Wang
2025-03-14 16:55     ` Alison Schofield

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=Z9MHvp6GA_iGwfg0@aschofie-mobl2.lan \
    --to=alison.schofield@intel.com \
    --cc=bfaccini@nvidia.com \
    --cc=chenbaozi@phytium.com.cn \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=haibo1.xu@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rppt@kernel.org \
    --cc=rrichter@amd.com \
    --cc=vishal.l.verma@intel.com \
    --cc=wangyuquan1236@phytium.com.cn \
    /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