From: Dan Williams <dan.j.williams@intel.com>
To: dave.jiang@intel.com
Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
alejandro.lucero-palau@amd.com
Subject: [RFC PATCH 3/4] cxl/region: Block region delete for locked regions
Date: Fri, 3 Apr 2026 14:00:49 -0700 [thread overview]
Message-ID: <20260403210050.1058650-4-dan.j.williams@intel.com> (raw)
In-Reply-To: <20260403210050.1058650-1-dan.j.williams@intel.com>
In support of reducing the number of failure conditions an accelerator
driver needs to consider, block user initiated delete of locked regions.
This might turn out to be too heavy and some region unlock mechanism needs
to be considered, but in the interest of doing something simple to get
accelerators enabled, take this coarse step.
Switch to scope-based cleanup now that there is an early exit case.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/cxl/core/region.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 600c96be0888..11bc0b88b05f 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -2768,17 +2768,20 @@ static ssize_t delete_region_store(struct device *dev,
{
struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(dev);
struct cxl_port *port = to_cxl_port(dev->parent);
- struct cxl_region *cxlr;
- cxlr = cxl_find_region_by_name(cxlrd, buf);
+ struct cxl_region *cxlr __free(put_cxl_region) =
+ cxl_find_region_by_name(cxlrd, buf);
if (IS_ERR(cxlr))
return PTR_ERR(cxlr);
+ if (test_bit(CXL_REGION_F_LOCK, &cxlr->flags))
+ return -EBUSY;
+
devm_release_action(port->uport_dev, unregister_region, cxlr);
- put_device(&cxlr->dev);
return len;
}
+
DEVICE_ATTR_WO(delete_region);
static void cxl_pmem_region_release(struct device *dev)
--
2.53.0
next prev parent reply other threads:[~2026-04-03 20:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 21:00 [RFC PATCH 0/4] cxl: Region attach for accelerators Dan Williams
2026-04-03 21:00 ` [RFC PATCH 1/4] cxl/mem: Add support to cleanly continue after attach Dan Williams
2026-04-09 22:02 ` Cheatham, Benjamin
2026-04-11 22:33 ` Dan Williams
2026-04-03 21:00 ` [RFC PATCH 2/4] cxl/region: Move region lock error code to -EBUSY Dan Williams
2026-04-03 21:00 ` Dan Williams [this message]
2026-04-03 21:00 ` [RFC PATCH 4/4] cxl/region: Introduce cxl_memdev_attach_region Dan Williams
2026-04-07 10:25 ` Alejandro Lucero Palau
2026-04-11 21:42 ` Dan Williams
2026-04-14 15:41 ` Alejandro Lucero Palau
2026-04-15 12:57 ` Alejandro Lucero Palau
2026-04-09 22:02 ` Cheatham, Benjamin
2026-04-11 23:02 ` Dan Williams
2026-04-12 8:57 ` Lukas Wunner
2026-04-13 14:25 ` Cheatham, Benjamin
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=20260403210050.1058650-4-dan.j.williams@intel.com \
--to=dan.j.williams@intel.com \
--cc=alejandro.lucero-palau@amd.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@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