From: "Dan Williams (nvidia)" <djbw@kernel.org>
To: Alejandro Lucero Palau <alucerop@amd.com>,
"Dan Williams (nvidia)" <djbw@kernel.org>,
alejandro.lucero-palau@amd.com, linux-cxl@vger.kernel.org,
edward.cree@amd.com, davem@davemloft.net, kuba@kernel.org,
pabeni@redhat.com, edumazet@google.com, dave.jiang@intel.com
Subject: Re: [PATCH v26 6/8] cxl: attach region to an accelerator/type2 memdev
Date: Thu, 14 May 2026 18:42:32 -0700 [thread overview]
Message-ID: <6a067a087ed90_a617410062@djbw-dev.notmuch> (raw)
In-Reply-To: <9aaf07a6-ffc9-4474-835c-bbc6ddf84472@amd.com>
Alejandro Lucero Palau wrote:
>
> On 5/2/26 01:46, Dan Williams (nvidia) wrote:
> > Alejandro Lucero Palau wrote:
> > [..]
> >>>> + }
> >>> A couple problems here.
> >>>
> >>> 1/ Nothing stops a CXL class device from implementing a decoder with
> >>> CXL_DECODER_DEVMEM (HDM-DB).
> >> Uhmmm...
> > Consider a helpful expander that does not require the host OS to use
> > cpu_cache_invalidate_memregion() whenever DPA space is changed. I
> > imagine that would be useful for DCD where there could be a higher
> > frequency of extent changes.
>
>
> What do you want here then? We had a param for specifically asking for
> creating a dax device for the region, but it was considered unnecessary,
> and I think it was you then. Should I put it back?
This comment was referring to the proposal to change the way region's
are released based on their decoder type. My point is that the way
region's are released must not depend on details like that.
Now, it took me longer than I wanted but I have a generic solution now
in hand, will post, that allows regions to be safely deleted either by
an endpoint callback or the root. It also addresses the issue Sungwoo
posted. There is still a tiny theoretical race if you are able to time
region deletion with devres_release_all(), but the practical /
repeatable devm_release_action() warning and double unregister bug is
gone.
> >>>> + /* hold endpoint lock to setup autoremove of the region */
> >>>> + guard(device)(&endpoint->dev);
> >>> This does not handle the case when ->endpoint is an ERR_PTR() because
> >>> the memdev never attached in the first instance.
> >> Not sure about this but, is it not the success of devm_cxl_add_memdev()
> >> ensuring this can not happen?
> > That is only ensured by using the "attach" mechanism.
> > devm_cxl_add_memdev(..., NULL) is only for the generic memory expander
> > case. Where the entire usage model is governed by memdev ABIs.
> >
>
> Is your concern that the memdev probe could not happen synchronously so
> a further call like the one implemented here could fail due to the
> endpoint not there yet?
The concern is dropping and retaking locks which exposes some lifetime
details. I have a patch that introduces a devm_cxl_probe_mem() call,
that hides all the attachment details. It is functionally equivalent to
a standalone helper. I like that part of your proposal.
[..snip detach discussion, my proposal is leave out custom detach
complication for now..]
> > All drivers must already be prepared to be unloaded. So we start with
> > the simple semantic first to get this functionality landed and then
> > think about adding sophistication like live fallback to PCI operation.
>
>
> Ok. Let's try this one. You want to trigger device_release_driver or
> something similar on the pci_dev->dev linked to the memdev. Right?
>
> Do we have this support now?
Yes, cxl_test tests it for a long time with the existing type3 device,
and I tested it now again with Dave's type2 cxl_test device and the
proposed devm_cxl_probe_mem(). Thanks, Dave!
> If we do not, have you evaluated the complexity required for ensuring
> no deadlocks if this is triggered while the sfc driver is still
> probing?
The cxl_core invokes device_release_driver() from its own workqueue
context.
> Maybe I'm overthinking this option, so if you have a clear idea about
> how to do this, please tell me, assuming it is a matter of calling such
> a pci_dev "unbinding" from its current driver.
I do not blame you, especially with all the details getting generic
region teardown working. However, it is working and minimizes the
exported complexity outside the core.
next prev parent reply other threads:[~2026-05-15 1:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 18:05 [PATCH v26 0/8] Type2 device basic support alejandro.lucero-palau
2026-04-23 18:05 ` [PATCH v26 1/8] sfc: add cxl support alejandro.lucero-palau
2026-04-29 21:14 ` Cheatham, Benjamin
2026-05-01 10:07 ` Alejandro Lucero Palau
2026-04-23 18:05 ` [PATCH v26 2/8] cxl/sfc: Map cxl regs alejandro.lucero-palau
2026-04-23 18:05 ` [PATCH v26 3/8] cxl/sfc: Initialize dpa without a mailbox alejandro.lucero-palau
2026-04-23 18:05 ` [PATCH v26 4/8] cxl: Prepare memdev creation for type2 alejandro.lucero-palau
2026-04-30 23:23 ` Dan Williams (nvidia)
2026-04-23 18:05 ` [PATCH v26 5/8] sfc: create type2 cxl memdev alejandro.lucero-palau
2026-04-23 18:05 ` [PATCH v26 6/8] cxl: attach region to an accelerator/type2 memdev alejandro.lucero-palau
2026-04-29 21:14 ` Cheatham, Benjamin
2026-05-01 10:35 ` Alejandro Lucero Palau
2026-05-01 2:00 ` Dan Williams (nvidia)
2026-05-01 10:59 ` Alejandro Lucero Palau
2026-05-02 0:46 ` Dan Williams (nvidia)
2026-05-05 20:51 ` Alejandro Lucero Palau
2026-05-15 1:42 ` Dan Williams (nvidia) [this message]
2026-04-23 18:05 ` [PATCH v26 7/8] cxl: Avoid dax creation for accelerators alejandro.lucero-palau
2026-04-29 21:14 ` Cheatham, Benjamin
2026-05-13 17:23 ` Alison Schofield
2026-05-13 18:19 ` Alejandro Lucero Palau
2026-04-23 18:05 ` [PATCH v26 8/8] sfc: support pio mapping based on cxl alejandro.lucero-palau
2026-04-23 22:07 ` [PATCH v26 0/8] Type2 device basic support Dave Jiang
2026-05-13 17:33 ` Alison Schofield
2026-05-13 18:29 ` Alejandro Lucero Palau
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=6a067a087ed90_a617410062@djbw-dev.notmuch \
--to=djbw@kernel.org \
--cc=alejandro.lucero-palau@amd.com \
--cc=alucerop@amd.com \
--cc=dave.jiang@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=edward.cree@amd.com \
--cc=kuba@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.