From: sashiko-bot@kernel.org
To: "Anisa Su" <anisa.su887@gmail.com>
Cc: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: Re: [PATCH v15 2/8] cxl/mem: Read dynamic capacity configuration from the device
Date: Wed, 07 Oct 2026 20:29:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-163339@kernel.org> (raw)
In-Reply-To: <20261007201828.952-3-anisa.su@samsung.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] cxl: cxl_configure_dcd() falsely fails overlap check and double-counts total DPA capacity
--
commit e491a6175f0241ed507a397807a28860fd54aadf
Author: Ira Weiny <iweiny@kernel.org>
cxl/mem: Read dynamic capacity configuration from the device
This commit implements Dynamic Capacity (DC) mailbox commands to read and
store DCD configuration information. It validates the first dynamic capacity
partition and configures it as dynamic ram, disabling DCD if the
configuration is invalid.
> diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
> index b3419df586b9c..def26c490dfe4 100644
> --- a/drivers/cxl/core/memdev.c
> +++ b/drivers/cxl/core/memdev.c
[ ... ]
> @@ -643,6 +643,53 @@ int cxl_mem_dpa_fetch(struct cxl_memdev_state *mds, struct cxl_dpa_info *info)
> }
> EXPORT_SYMBOL_NS_GPL(cxl_mem_dpa_fetch, "CXL");
>
> +int cxl_configure_dcd(struct cxl_memdev_state *mds, struct cxl_dpa_info *info)
> +{
[ ... ]
> + if (dc_info.start < info->size) {
> + dev_err(dev,
> + "DC partition 0 base %#llx overlaps static capacity ending at %#llx\n",
> + dc_info.start, info->size);
> + return -EINVAL;
> + }
[Severity: High]
Will this overlap check unconditionally fail for any valid DCD configuration?
Earlier in the execution flow, cxl_mem_dpa_fetch() initializes info->size to
the total DPA capacity (including both static and dynamic capacity):
info->size = mds->total_bytes;
Since the DC partition is placed within this total space, dc_info.start will
always be strictly less than the total info->size. This appears to cause a
regression where cxl_pci_probe() silently disables DCD support.
[ ... ]
> + if (check_add_overflow(info->size, dc_info.size, &total)) {
> + dev_err(dev,
> + "DC partition 0 size %#llx overflows DPA space ending at %#llx\n",
> + dc_info.size, info->size);
> + return -EINVAL;
> + }
> +
> + info->size = total;
[Severity: High]
If the above overlap check were bypassed, would this assignment double-count
the dynamic capacity size?
Since info->size already includes the dynamic capacity initialized from
cxl_mem_dpa_fetch(), adding dc_info.size again to the total could cause
cxl_dpa_setup() to allocate a dpa_res root resource larger than the physical
device limit.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261007201828.952-1-anisa.su@samsung.com?part=2
next prev parent reply other threads:[~2026-10-07 20:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 20:16 [PATCH v15 0/8] DCD Prep Series Anisa Su
2026-10-07 20:16 ` [PATCH v15 1/8] cxl/mbox: Flag support for Dynamic Capacity Devices (DCD) Anisa Su
2026-10-07 20:16 ` [PATCH v15 2/8] cxl/mem: Read dynamic capacity configuration from the device Anisa Su
2026-10-07 20:29 ` sashiko-bot [this message]
2026-10-07 21:25 ` Anisa Su
2026-10-07 23:43 ` Alison Schofield
2026-10-08 8:15 ` Anisa Su
2026-10-08 8:33 ` Richard Cheng
2026-10-07 20:16 ` [PATCH v15 3/8] cxl/cdat: Gather DSMAS data for DCD partitions Anisa Su
2026-10-07 20:33 ` sashiko-bot
2026-10-07 23:45 ` Alison Schofield
2026-10-08 21:29 ` Dave Jiang
2026-10-07 20:16 ` [PATCH v15 4/8] cxl/events: Split event msgnum configuration from irq setup Anisa Su
2026-10-07 20:16 ` [PATCH v15 5/8] cxl/pci: Factor out interrupt policy check Anisa Su
2026-10-07 20:16 ` [PATCH v15 6/8] cxl/mem: Configure dynamic capacity interrupts Anisa Su
2026-10-07 20:30 ` sashiko-bot
2026-10-07 23:46 ` Alison Schofield
2026-10-08 8:58 ` Richard Cheng
2026-10-07 20:16 ` [PATCH v15 7/8] cxl/core: Enforce partition order/simplify partition calls Anisa Su
2026-10-07 20:16 ` [PATCH v15 8/8] Documentation/cxl: Document DPA partition layout and ordering rules Anisa Su
2026-10-08 8:26 ` [PATCH v15 0/8] DCD Prep Series Anisa Su
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=sashiko-outbox-163339@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=anisa.su887@gmail.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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