From: Gregory Price <gourry@gourry.net>
To: linux-cxl@vger.kernel.org
Cc: dan.j.williams@intel.com, dave.jiang@intel.com,
jonathan.cameron@huawei.com, alison.schofield@intel.com,
ira.weiny@intel.com, dave@stgolabs.net,
linux-kernel@vger.kernel.org, kernel-team@meta.com,
vishal.l.verma@intel.com, david@kernel.org,
benjamin.cheatham@amd.com
Subject: Re: cxl/region.c improvements and DAX/Hotplug plumbing
Date: Thu, 22 Jan 2026 11:28:10 -0500 [thread overview]
Message-ID: <aXJQGlRr7WrLyiU-@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <aXErSP1zKnv4koKG@gourry-fedora-PF4VCD3F>
On Wed, Jan 21, 2026 at 02:38:48PM -0500, Gregory Price wrote:
> --------------------------------
> Problem: Per-region usage policy
> --------------------------------
... snip ...
>
> ABI: (RW) regionN/region_driver
> Read: Displays what region driver is assigned
> Write: Changing an uncommitted region's underlying driver
>
> ABI: regionN/rctl/*
> Exposes region_driver specific controls / information
> example: auto-online policy for sysram_region
>
Referencing this thread and questions from Ira:
https://lore.kernel.org/linux-cxl/aXGHgtAHNVWJsZbo@gourry-fedora-PF4VCD3F/
the appropriate design here is likely breaking out new drivers with
their own bind functions and leaving cxl/drivers/region/bind to be the
auto-decoder / compat interface.
so this turns into:
ABI:
cxl/drivers/dax_region/bind
cxl/drivers/pmem_region/bind
cxl/drivers/sysram_region/bind
Private regions likely remain internal interaces for device drivers
(there's no way for userland to configure a set of callbacks)
(Note for Dan: Each probe function here can determine which
PARTMODE's are valid for that driver - so we can prevent
pmem from ever using non-pmem drivers)
This implies some changes to dax_region to at least not immediately
probe the dax device on creation so that policy can be programmed.
(see: dax_bus_probe() - unconditionally probes at discovery)
So laying out the current workflow:
CURRENT: region/bind auto-decoder / compat workflow
----------------------------------------------------
echo region0 > decoder0.0/create_ram_region
=> creates region0
/* program region (decoders, targets */
echo region0 > cxl/drivers/region/bind
=> probe() creates dax_region
=> dax_region creates, configures, and registers dev_dax
=> dax_bus_probe discovers dev_dax and selects a driver
=> IORESOURCE_DAX_KMEM = dax_kmem if KMEM built in
=> otherwise device_dax
=> dev_dax probe happens automatically from bus_probe()
=> if device_dax driver, make /dev/dax/* and stop
=> if kmem driver, engage memory-hotplug.c
=> system default hotplug policy is applied
All of this basically just happens automagically
----------------------------------------------------
The new workflows for manually created/programmed regions:
Manual dax_region Workflow
------------------------------------
echo region0 > decoder0.0/create_ram_region
=> creates region0
/* program region0 (decoders, targets) */
echo region0 > cxl/drivers/dax_region/bind
=> creates dax_region
=> selects device_dax driver
=> creates unprobed dev_dax
/* program dax_region controls */
echo daxN.M > dax/drivers/device_dax/bind
=> probes daxN.M
=> creates /dev/dax/ file
------------------------------------
Manual sysram_region Workflow
---------------------------------------
echo region0 > decoder0.0/create_ram_region
=> creates region0
/* program region0 (decoders, targets) */
echo region0 > cxl/drivers/sysram_region/bind
=> creates sysram_region which
=> creates dax_region
=> creates unprobed dev_dax
=> selects dev_kmem driver for dev_dax
/* program hotplug policy */
echo online_movable > sysram_region/hotplug
=> dax_region.hotplug_mode = MMOP_ONLINE_MOVABLE
echo daxN.M > dax/drivers/kmem/bind
=> probe daxN.M
=> add_memory_driver_managed(..., dax_region.hotplug_mod);
---------------------------------------
And for dynamic capacity regions, you can use these same drivers, it
just changes the default behavior of [dax,sysram]_region when probed.
Manual dc_region workflow
---------------------------------------
echo region0 > decoder0.0/create_dc_region
=> creates region0
/* program region0 (decoders, targets) */
echo region0 > cxl/drivers/[dax, sysram]/bind
=> creates xxx_region WITHOUT dev_dax
/* At this point, the extent discovery process takes over */
extent set arrives:
=> dc code calls `[dax,sysram]_region.add_extents(tag, extents)`
=> dax_region -> create new device_dax w/ set
=> sysram_region -> create new dax_kmem w/ set
---------------------------------------
cxl-cli
---------------------------------------
What this should look like to cxl-cli is something like:
cxl create-region -t [pmem,ram,dc] --driver=[pmem,dax,sysram,] ...
/* if not --driver ... -c --controller ? */
And since `[dax,sysram,...]_region/bind` will restrict which PARTMODE is
valid (pmem=>[pmem], ram=>[dax, sysram], dc=>[dax, sysram, ...]),
We have a clean failure condition that lets us undo the probe process
above if the user selects a bad combination.
cxl create-region -t pmem --driver=sysram ... => -ENOSUPP
----------------------------------------
I think this detangles most of region.c probe/policy issues.
From here most everything else I describe can be implemented in the
relevant driver directory. (replaces region0/rctl/ in original email)
region0/sysram_region/* - policy controls
region0/sysram_region/dax_region/* - account daxN.M's
region0/sysram_region/dax_region/daxN.M/hotplug - atomic hotplug
~Gregory
next prev parent reply other threads:[~2026-01-22 16:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 19:38 Gregory Price
2026-01-22 16:28 ` Gregory Price [this message]
2026-01-22 22:14 ` David Hildenbrand (Red Hat)
2026-01-23 0:28 ` Gregory Price
2026-03-18 8:53 ` David Hildenbrand (Arm)
2026-03-19 15:14 ` Gregory Price
2026-03-19 19:35 ` David Hildenbrand (Arm)
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=aXJQGlRr7WrLyiU-@gourry-fedora-PF4VCD3F \
--to=gourry@gourry.net \
--cc=alison.schofield@intel.com \
--cc=benjamin.cheatham@amd.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=david@kernel.org \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=kernel-team@meta.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®