Linux CXL
 help / color / mirror / Atom feed
From: <dan.j.williams@intel.com>
To: Gregory Price <gourry@gourry.net>, <dan.j.williams@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	"Dave Jiang" <dave.jiang@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	"Ira Weiny" <ira.weiny@intel.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH 1/2] cxl/region: Timeout auto region assembly waiting for endpoints
Date: Fri, 30 Jan 2026 10:26:06 -0800	[thread overview]
Message-ID: <697cf7bed7112_1d6f100b0@dwillia2-mobl4.notmuch> (raw)
In-Reply-To: <aXztmSYih24WZgsr@gourry-fedora-PF4VCD3F>

Gregory Price wrote:
> On Thu, Jan 29, 2026 at 08:58:09PM -0800, dan.j.williams@intel.com wrote:
> > 
> > > Cancel the timeout when all expected endpoints attach or the region is
> > > unregistered for any reason.
> > 
> > Setting aside the above, this looks like policy, and every time I see
> > policy the first question is "can userspace do it?". It would be
> > straightforward for userspace to kick a 30 second watchdog upon each
> > region KOBJ_ADD event. Each time that fires go cleanup partially
> > assembled regions.
> > 
> > For example there is no automatic cleanup of partially assembled RAID
> > arrays. So, precedent leans towards letting userspace decide what
> > happens when composite devices fail assembly.
> 
> Sounds like there'll be a nasty race implied here.
> 
> Lets assume a kmem region that gets auto-onlined
> 
> 0) Region is waiting for a device
>    1) Final device arrives and starts probing, locking the region

"locking?". There is no IORESOURCE_BUSY contention until the final
driver attaches.

>    2) Userspace timeout occurs, firing a cleanup request
> 2) Region finishes probing
>    2a) this creates the dax region
>    2b) this creates the dax_kmem device
>    2c) this may auto-hotplug into ZONE_NORMAL
>    2d) kernel page gets allocated on the memory region
> 3) Userspace cleanup arrives to unbind
>    3a) dax_kmem is online and can't hot-unplug

Right, userspace needs to honor typical managed hotplug and not force
removal.

>    3b) dax_kmem abandons hope and leaves the memory online
>        (see dev_dax_kmem_remove and remove_memory)
>    3c) region cleans up
> 
> Final state: region can't be rebound because memory is left online
> and unassociated with any device

I do not see how we get into this situation. If dax_kmem comes up, then
there is nothing to clean up. Yes, these can race, but typical locking
should ensure full forward progress or cleanup.

  reply	other threads:[~2026-01-30 18:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30  4:23 [PATCH 1/2] cxl/region: Timeout auto region assembly waiting for endpoints Alison Schofield
2026-01-30  4:23 ` [PATCH 2/2] cxl/region: Unregister auto-created region when assembly fails Alison Schofield
2026-01-30 17:45   ` dan.j.williams
2026-01-31  1:04     ` Alison Schofield
2026-01-31 15:49       ` Gregory Price
2026-02-05  0:32         ` Alison Schofield
2026-02-05  4:22           ` Gregory Price
2026-02-03  3:07       ` dan.j.williams
2026-02-05  0:20         ` Alison Schofield
2026-02-05  1:03           ` dan.j.williams
2026-01-30  4:58 ` [PATCH 1/2] cxl/region: Timeout auto region assembly waiting for endpoints dan.j.williams
2026-01-30 17:42   ` Gregory Price
2026-01-30 18:26     ` dan.j.williams [this message]
2026-01-30 19:03       ` Gregory Price
2026-01-30 22:46         ` dan.j.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=697cf7bed7112_1d6f100b0@dwillia2-mobl4.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gourry@gourry.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