From: Dave Jiang <dave.jiang@intel.com>
To: Dan Williams <djbw@kernel.org>, linux-cxl@vger.kernel.org
Cc: alejandro.lucero-palau@amd.com, jic23@kernel.org
Subject: Re: [PATCH 3/5] cxl/memdev: Pin parents for entire memdev lifetime
Date: Tue, 19 May 2026 15:24:56 -0700 [thread overview]
Message-ID: <fd7fbb4a-3deb-4d90-9ca4-15a14368effc@intel.com> (raw)
In-Reply-To: <20260519210158.1499795-4-djbw@kernel.org>
On 5/19/26 2:01 PM, Dan Williams wrote:
> In order to be able to manage the driver that uses a memdev attach
> mechanism the parent needs to stick around for the
> device_release_driver(cxlmd->dev.parent) event.
>
> Fixes: 29317f8dc6ed ("cxl/mem: Introduce cxl_memdev_attach for CXL-dependent operation")
> Signed-off-by: Dan Williams <djbw@kernel.org>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Maybe a comment above get_device() to make note of why we are taking the reference.
> ---
> drivers/cxl/core/memdev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
> index 80e65690eb77..91c99eeea92c 100644
> --- a/drivers/cxl/core/memdev.c
> +++ b/drivers/cxl/core/memdev.c
> @@ -25,9 +25,11 @@ static DEFINE_IDA(cxl_memdev_ida);
> static void cxl_memdev_release(struct device *dev)
> {
> struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
> + struct device *parent = dev->parent;
>
> ida_free(&cxl_memdev_ida, cxlmd->id);
> kfree(cxlmd);
> + put_device(parent);
> }
>
> static char *cxl_memdev_devnode(const struct device *dev, umode_t *mode, kuid_t *uid,
> @@ -707,7 +709,7 @@ static struct cxl_memdev *cxl_memdev_alloc(struct cxl_dev_state *cxlds,
> dev = &cxlmd->dev;
> device_initialize(dev);
> lockdep_set_class(&dev->mutex, &cxl_memdev_key);
> - dev->parent = cxlds->dev;
> + dev->parent = get_device(cxlds->dev);
> dev->bus = &cxl_bus_type;
> dev->devt = MKDEV(cxl_mem_major, cxlmd->id);
> dev->type = &cxl_memdev_type;
next prev parent reply other threads:[~2026-05-19 22:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 21:01 [PATCH 0/5] cxl: Introduce devm_cxl_probe_mem() and fix region deletion Dan Williams
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 [this message]
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=fd7fbb4a-3deb-4d90-9ca4-15a14368effc@intel.com \
--to=dave.jiang@intel.com \
--cc=alejandro.lucero-palau@amd.com \
--cc=djbw@kernel.org \
--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