Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Richard Cheng" <icheng@nvidia.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v7 1/2 RESEND] cxl/hdm: Allow zero sized HDM decoders
Date: Tue, 21 Jul 2026 09:16:24 +0000	[thread overview]
Message-ID: <20260721091624.9CDD61F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260721085715.39322-2-icheng@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] cxl_dpa_free() returns early for zero-sized decoders, bypassing resource release, leaking the DPA reservation, and permanently breaking port LIFO teardown.
--

--- Patch [1]: [PATCH v7 1/2 RESEND] cxl/hdm: Allow zero sized HDM decoders ---
commit 69f9a310ab608be9b469a96819d45389f215c346
Author: Richard Cheng <icheng@nvidia.com>

cxl/hdm: Allow zero sized HDM decoders

This commit allows the CXL subsystem to accept zero-sized HDM decoders
instead of rejecting them during port enumeration. It treats empty decoders
as first-class by backing them with a kmalloc'd resource and keeping the
skip and hdm_end accounting intact.

> 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

[ ... ]

> @@ -545,7 +569,7 @@ int cxl_dpa_free(struct cxl_endpoint_decoder *cxled)
>  	struct device *dev = &cxled->cxld.dev;
>  
>  	guard(rwsem_write)(&cxl_rwsem.dpa);
> -	if (!cxled->dpa_res)
> +	if (cxled_empty(cxled))

[Severity: High]
Does this early return skip the necessary cleanup for zero-sized decoders?

When cxled_empty(cxled) evaluates to true for a zero-sized decoder that
has a valid dpa_res, returning 0 here skips devm_cxl_dpa_release().
Since the reservation is backed by a kmalloc'd resource from
cxl_dpa_request_region(), does this leak the dpa_res memory?

Additionally, skipping devm_cxl_dpa_release() means port->hdm_end is not
decremented. Because CXL DPA management strictly enforces LIFO teardown,
will this strand the hdm_end watermark and permanently break the ability
to free or reconfigure prior decoders on the same port?

>  		return 0;
>  	if (cxled->cxld.region) {
>  		dev_dbg(dev, "decoder assigned to: %s\n",

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721085715.39322-1-icheng@nvidia.com?part=1

  reply	other threads:[~2026-07-21  9:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  8:57 [PATCH v7 0/2 RESEND] Support zero-sized HDM decoders Richard Cheng
2026-07-21  8:57 ` [PATCH v7 1/2 RESEND] cxl/hdm: Allow zero sized " Richard Cheng
2026-07-21  9:16   ` sashiko-bot [this message]
2026-07-21  9:39     ` Richard Cheng
2026-07-21 16:08   ` Dave Jiang
2026-07-22  0:38   ` Jonathan Cameron
2026-07-24  6:50     ` Richard Cheng
2026-07-21  8:57 ` [PATCH v7 2/2 RESEND] tools/testing/cxl: Enable zero sized decoders under hb0 Richard Cheng
2026-07-21  9:08   ` sashiko-bot
2026-07-21 16:10   ` Dave Jiang
2026-07-22  0:41   ` Jonathan Cameron
2026-07-22  0:07 ` [PATCH v7 0/2 RESEND] Support zero-sized HDM decoders Jonathan Cameron
2026-07-24  6:38   ` 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=20260721091624.9CDD61F00A3D@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