From: sashiko-bot@kernel.org
To: "Richard Cheng" <icheng@nvidia.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v3 1/2] cxl/hdm: Allow zero sized HDM decoders
Date: Sun, 07 Jun 2026 05:51:00 +0000 [thread overview]
Message-ID: <20260607055101.672B91F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260607053837.4389-2-icheng@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Unbalanced lifecycle operation: manually advancing `port->hdm_end` for a zero-size decoder permanently breaks DPA resource freeing for all preceding decoders.
- [High] The patch modifies the port's DPA watermark (`port->hdm_end`) for zero-sized decoders without acquiring the required `cxl_rwsem.dpa` lock.
--
commit 9ef90cd8aa01ad12f98b0af61f61ae8863b14582
Author: Richard Cheng <icheng@nvidia.com>
cxl/hdm: Allow zero sized HDM decoders
This patch permits committing an HDM decoder with a size of 0. It enumerates
the decoder into the topology and manually advances the port's DPA watermark
to pass in-order checks without reserving actual DPA space.
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
[ ... ]
> @@ -1096,6 +1100,15 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
> if (!committed)
> return 0;
>
> + /*
> + * A committed zero-size decoder reserves no DPA, but still advance
> + * the port's DPA watermark.
> + */
> + if (size == 0) {
> + port->hdm_end = cxld->id;
[Severity: High]
Does modifying port->hdm_end here require the cxl_rwsem.dpa lock?
It appears other reads and writes to port->hdm_end are protected by the DPA
read-write semaphore. Since devm_cxl_enumerate_decoders() iteratively adds
decoders and exposes them to sysfs before the enumeration loop finishes,
could a concurrent sysfs operation on a previously added decoder race with
this assignment?
[Severity: High]
Could advancing port->hdm_end without registering a devres cleanup action
break DPA freeing for earlier decoders?
Normally devm_cxl_dpa_reserve() registers a cleanup that manages teardown.
If we advance port->hdm_end here but cxl_dpa_free() exits early when it sees
no DPA resource:
cxl_dpa_free() {
if (!cxled->dpa_res)
return 0;
...
if (cxled->cxld.id != port->hdm_end) {
return -EBUSY;
}
...
}
Will port->hdm_end remain permanently trapped at this zero-size decoder's
ID, preventing the strict LIFO un-provisioning of any preceding valid
decoders and breaking manual sysfs teardown?
> + return 0;
> + }
> +
> dpa_size = div_u64_rem(size, cxld->interleave_ways, &remainder);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260607053837.4389-1-icheng@nvidia.com?part=1
next prev parent reply other threads:[~2026-06-07 5:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 5:38 [PATCH v3 0/2] Support zero-sized HDM decoders Richard Cheng
2026-06-07 5:38 ` [PATCH v3 1/2] cxl/hdm: Allow zero sized " Richard Cheng
2026-06-07 5:51 ` sashiko-bot [this message]
2026-06-07 8:16 ` Richard Cheng
2026-06-07 5:38 ` [PATCH v3 2/2] tools/testing/cxl: Enable zero sized decoder under hb0 Richard Cheng
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=20260607055101.672B91F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=icheng@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--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