public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: <dan.j.williams@intel.com>
To: Alison Schofield <alison.schofield@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	"Dave Jiang" <dave.jiang@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	"Dan Williams" <dan.j.williams@intel.com>,
	Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Cc: <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH] cxl/region: Delay inserting iomem resource until auto region commit
Date: Thu, 12 Feb 2026 11:29:04 -0800	[thread overview]
Message-ID: <698e2a0041223_8c32100a5@dwillia2-mobl4.notmuch> (raw)
In-Reply-To: <20260212062250.1219043-1-alison.schofield@intel.com>

Alison Schofield wrote:
> During auto region assembly the region driver inserts the region
> resource into the iomem tree when the first endpoint arrives and
> region assembly begins. If the region later fails to assemble, the
> resource can remain stranded in the iomem tree, making it appear like
> a DAX region is a child of the CXL region, when that is not true.
> 
> For example:
> 68e80000000-8d37fffffff : CXL Window 9
>   68e80000000-70e7fffffff : Soft Reserved
>     68e80000000-70e7fffffff : region9
>       68e80000000-70e7fffffff : dax19.0
>         68e80000000-70e7fffffff : System RAM (kmem)

...but it *is* telling the truth. The truth is that multiple objects
have laid a claim to that address range. The region9 object has reserved
part of the CXL window for its use. If the "Soft Reserved" and "dax19.0"
reservations are removed then the address space should still be reserved
for the region. The collision only occurs when drivers for those
competing objects try to mark the range IORESOURCE_BUSY. Competing
claims to the same address range are why IORESOURCE_BUSY exists, benign
overlaps are ok.

Note that CXL Window 9 is also reserving more address space than is
actually in use. Like region9 70e80000000-8d37fffffff is reserved
address space with no active decode.

> In the above case, region9 failed to assemble, yet proc/iomem shows
> the DAX region as being parented under a CXL region. In reality, the
> CXL region is in a disabled state and the DAX region is managed by the
> HMEM driver.

iomem resource parenting shows registration ordering, not actual
parenting. Most of the time the registration order and the parenting
lines up, but I would be surprised if any use case depends on this.

> Examining /proc/iomem is one way users inspect the memory topology,
> and with this patch that view remains accurate.

The ambiguity of iomem resource parenting can be resolved by looking the
device-path for dax19.0 ("daxctl list -RDu"). It is also resolved by
noticing that the CXL region and the DAX region are using separate
memregion_id values (9 vs 19).

The extra effort for incremental precision is not needed, the contents
of /proc/iomem are accurate.

> Delay insertion of the iomem resource until the auto region reaches
> the commit state. Introduce the res_want_insert field to track whether
> the region's resource should be inserted into the iomem tree.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> 
> Putting this out for comments and I expect to rebase on 7.0-rc1 if 
> this is wanted.
> 
> Today it is built upon Smita's v6 Soft Reserved set [1] because it
> is with that set where the failover to DAX starts happening and the
> confusing /proc/iomem can appear. Without that set, the resource of 
> the failed region appears in /proc/iomem, but it's less confusing
> since it doesn't show any children.
> 
> There is an option for Smita's set to teardown the CXL regions when
> it takes over the resource for HMEM DAX, however latest revision, v6,
> has taken a gentler approach and leaves the regions intact.
> 
> 
> [1] https://lore.kernel.org/linux-cxl/20260210064501.157591-1-Smita.KoralahalliChannabasappa@amd.com/
> 
> 
>  drivers/cxl/core/region.c | 32 ++++++++++++++++++++------------
>  drivers/cxl/cxl.h         |  4 ++++
>  2 files changed, 24 insertions(+), 12 deletions(-)
> 
[..]
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index c796c3db36e0..2b977ab33af6 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -480,6 +480,9 @@ enum cxl_config_state {
>   * @interleave_ways: number of endpoints in the region
>   * @interleave_granularity: capacity each endpoint contributes to a stripe
>   * @res: allocated iomem capacity for this region
> + * @res_want_insert: true if the resource should be inserted into the iomem
> + *		tree. Set to false after the first attempt to insert or if
> + *		res originates from the iomem tree via alloc_free_mem_region()

This is too much "control flow in a data structure" for my taste, but is
moot given the comments above that this extra effort is not necessary.

  parent reply	other threads:[~2026-02-12 19:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12  6:22 [PATCH] cxl/region: Delay inserting iomem resource until auto region commit Alison Schofield
2026-02-12 17:18 ` Gregory Price
2026-02-12 18:58   ` Alison Schofield
2026-02-12 19:29 ` dan.j.williams [this message]
2026-02-23 21:25   ` Alison Schofield
2026-03-12 23:55     ` Dan Williams

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=698e2a0041223_8c32100a5@dwillia2-mobl4.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=Smita.KoralahalliChannabasappa@amd.com \
    --cc=alison.schofield@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=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