Linux CXL
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Pawel Mielimonka <pawel.mielimonka@fujitsu.com>
Cc: <dan.j.williams@intel.com>,
	<Smita.KoralahalliChannabasappa@amd.com>,
	<linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<dave@stgolabs.net>, <jonathan.cameron@huawei.com>,
	<dave.jiang@intel.com>, <vishal.l.verma@intel.com>,
	<ira.weiny@intel.com>
Subject: Re: [RFC PATCH v1 0/2] cxl/cli: HPA-ordered destroy-region teardown
Date: Tue, 2 Dec 2025 19:38:18 -0800	[thread overview]
Message-ID: <aS-wqvEjYUGEUs-s@aschofie-mobl2.lan> (raw)
In-Reply-To: <20251125143826.282312-1-pawel.mielimonka@fujitsu.com>

On Tue, Nov 25, 2025 at 11:38:22PM +0900, Pawel Mielimonka wrote:
> This series addresses an issue in destroy-region, where
> region teardown relied on libcxl enumeration order, which is not
> guaranteed to match the increasing HPA order exposed by the kernel. 
> When a decoder window is fully populated, attempting to destroy a
> non-last region causes kernel-side validation to fail (e.g.
> set_dpa_size(..., 0) returns an error), and subsequent destroy/create
> sequences may become impossible.
> 
> The CXL specification requires that decoder programming (and the
> implicit teardown path) must preserve continuous HPA coverage and
> proceed strictly in order: decoder m before decoder m+1, with each
> covering an HPA range below the next one. Practically, this means that
> region teardown must follow HPA-descending order and must stop as soon
> as a gap in the requested suffix is encountered.
> 
> The patch introduces destroy_multiple_regions(), which collects all
> regions under a given root decoder, sorts them by HPA, and destroys
> only the suffix requested by the user (or all regions in the case of
> “all”). The implementation guarantees that only valid teardown
> sequences are attempted and prevents decoder state inconsistencies
> observed during repeated destroy/create cycles.
> 
> Enable/disable paths and all existing bus/port/decoder filtering
> remain unchanged.

Hi Pawel,

Thanks - this is much needed!

It's very valuable that now trying to destroy any region out of 
order will fail 'gracefully'.

This worked for 'all' and needs a small fixup for the decoder option.
That's noted in Patch 2 reply. I didn't test the other filtering yet
but started updating a unit test to cover these cases.

See https://github.com/pmem/ndctl/blob/main/CONTRIBUTING.md for
a few housekeeping tips on submitting to NDCTL.

-- Alison


> 
> Pawel Mielimonka (2):
>   cxl/cli: add helpers to collect and sort regions by HPA
>   cxl/cli: enforce HPA-descending teardown order for destroy-region
> 
>  cxl/region.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 111 insertions(+), 3 deletions(-)
> 
> -- 
> 2.45.1.windows.1
> 
> 

  parent reply	other threads:[~2025-12-03  3:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25 14:38 [RFC PATCH v1 0/2] cxl/cli: HPA-ordered destroy-region teardown Pawel Mielimonka
2025-11-25 14:38 ` [RFC PATCH v1 1/2] cxl/cli: add helpers to collect and sort regions by HPA Pawel Mielimonka
2025-12-03  3:52   ` Alison Schofield
2025-12-03  9:09     ` Paweł Mielimonka
2025-11-25 14:38 ` [RFC PATCH v1 2/2] cxl/cli: enforce HPA-descending teardown order for destroy-region Pawel Mielimonka
2025-12-03  4:15   ` Alison Schofield
2025-12-03 10:13     ` Paweł Mielimonka
2025-12-03 23:46       ` Alison Schofield
2025-12-07  0:28   ` Alison Schofield
2025-12-03  3:38 ` Alison Schofield [this message]
2026-01-20 14:32 ` [PATCH v2 0/1] cxl/cli: HPA-ordered destroy-region teardown Pawel Mielimonka
2026-01-20 14:32   ` [PATCH v2 1/1] cxl/cli: enforce HPA-descening teardown order for destroy-region Pawel Mielimonka
2026-01-21 18:45   ` [PATCH v2 0/1] cxl/cli: HPA-ordered destroy-region teardown 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=aS-wqvEjYUGEUs-s@aschofie-mobl2.lan \
    --to=alison.schofield@intel.com \
    --cc=Smita.KoralahalliChannabasappa@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pawel.mielimonka@fujitsu.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