Linux CXL
 help / color / mirror / Atom feed
From: Dan Williams <djbw@kernel.org>
To: linux-cxl@vger.kernel.org
Cc: dave.jiang@intel.com, alejandro.lucero-palau@amd.com,
	jic23@kernel.org, Alejandro Lucero <alucerop@amd.com>,
	Sungwoo Kim <iam@sung-woo.kim>
Subject: [PATCH 0/5] cxl: Introduce devm_cxl_probe_mem() and fix region deletion
Date: Tue, 19 May 2026 14:01:53 -0700	[thread overview]
Message-ID: <20260519210158.1499795-1-djbw@kernel.org> (raw)

The devm_cxl_probe_mem() helper creates a memdev and retrieves a mapped
HPA range for the device. At present the retrieved region information is
expected to be established by platform firmware. A future update will
auto-establish a region if one is not already present. This arranges for a
simple CXL topology detach == Accelerator driver detach scheme.

Now, automatic region establishment on behalf of an accelerator driver
also requires automatic region teardown. The existing scheme of
triggering devm_release_action() of a cxl root device to destroy a
region is racy [1].  There is no path to coordinate multiple devres
actions, or conflicting devres actions, without using the
devm_remove_action_nowarn() workaround.

Instead, move final region cleanup responsibility to the root decoder
teardown path (devres action cxld_unregister()). Expand the root decoder
@range_lock, renamed @regions_lock, to coordinate region creation, sysfs
manageability, and deletion. The @regions_lock also prevents regions
from disappearing mid-auto-assembly.

Changes from the initial RFC [2]:
* tested with Dave's type2 cxl_test
* fix region remove by endpoints (Dave, Alejandro)
* fix user triggered region remove (Sungwoo)
* fix lifetime of the @attach ops (Alison, sashiko)
* hide @attach details inside the CXL core

[1]: http://lore.kernel.org/20260427032010.916681-2-iam@sung-woo.kim
[2]: http://lore.kernel.org/20260403210050.1058650-1-dan.j.williams@intel.com

Dan Williams (5):
  cxl/region: Block region delete during region creation
  cxl/region: Resolve region deletion races
  cxl/memdev: Pin parents for entire memdev lifetime
  cxl/memdev: Introduce cxl_class_memdev_type
  cxl/region: Introduce devm_cxl_probe_mem()

 drivers/cxl/core/core.h      |   2 +
 drivers/cxl/cxl.h            |   8 +-
 drivers/cxl/cxlmem.h         |  27 +++--
 include/cxl/cxl.h            |   3 +
 drivers/cxl/core/memdev.c    |  20 +++-
 drivers/cxl/core/port.c      |   7 +-
 drivers/cxl/core/region.c    | 194 ++++++++++++++++++++++++++++++-----
 drivers/cxl/mem.c            |  95 +++++++++++++----
 drivers/cxl/pci.c            |   2 +-
 tools/testing/cxl/test/mem.c |   2 +-
 10 files changed, 297 insertions(+), 63 deletions(-)


base-commit: 5d6919055dec134de3c40167a490f33c74c12581
-- 
2.53.0


             reply	other threads:[~2026-05-19 21:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 21:01 Dan Williams [this message]
2026-05-19 21:01 ` [PATCH 1/5] cxl/region: Block region delete during region creation Dan Williams
2026-05-19 21:59   ` Dave Jiang
2026-05-21 14:32   ` Alejandro Lucero Palau
2026-05-19 21:01 ` [PATCH 2/5] cxl/region: Resolve region deletion races Dan Williams
2026-05-19 22:17   ` Dave Jiang
2026-05-21 14:33   ` Alejandro Lucero Palau
2026-05-19 21:01 ` [PATCH 3/5] cxl/memdev: Pin parents for entire memdev lifetime Dan Williams
2026-05-19 22:24   ` Dave Jiang
2026-05-21 14:33   ` Alejandro Lucero Palau
2026-05-19 21:01 ` [PATCH 4/5] cxl/memdev: Introduce cxl_class_memdev_type Dan Williams
2026-05-19 22:50   ` Dave Jiang
2026-05-21 14:33   ` Alejandro Lucero Palau
2026-05-19 21:01 ` [PATCH 5/5] cxl/region: Introduce devm_cxl_probe_mem() Dan Williams
2026-05-19 22:56   ` Dave Jiang
2026-05-20 17:37   ` Dave Jiang
2026-05-21 14:44   ` Alejandro Lucero Palau
2026-05-21 14:31 ` [PATCH 0/5] cxl: Introduce devm_cxl_probe_mem() and fix region deletion Alejandro Lucero Palau
2026-06-05  7:56   ` Alejandro Lucero Palau
2026-06-05 15:20     ` Dave Jiang
2026-06-06  6:48       ` Alejandro Lucero Palau
2026-06-08 19:30         ` Dave Jiang
2026-06-12 20:52 ` 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=20260519210158.1499795-1-djbw@kernel.org \
    --to=djbw@kernel.org \
    --cc=alejandro.lucero-palau@amd.com \
    --cc=alucerop@amd.com \
    --cc=dave.jiang@intel.com \
    --cc=iam@sung-woo.kim \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    /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