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 v6 1/2] cxl/hdm: Allow zero sized HDM decoders
Date: Thu, 25 Jun 2026 09:47:18 +0000	[thread overview]
Message-ID: <20260625094718.8D3FD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260625092857.41139-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, permanently stranding their DPA reservation and breaking LIFO decoder teardown.
--

commit 0afce63a5399c17fcedf2e4f736d16ed9b2f7179
Author: Richard Cheng <icheng@nvidia.com>

cxl/hdm: Allow zero sized HDM decoders

This commit allows empty (zero-sized) HDM decoders to be treated as first
class instead of being rejected. It backs them with a kmalloc'd resource
since the resource tree cannot represent an empty range, while keeping the
skip and hdm_end accounting intact.

> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index 0c80b76a5f9b4..ccbab2e21f060 100644
> --- 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))
>  		return 0;

[Severity: High]
Does this early return permanently strand the DPA reservation and break LIFO
decoder teardown for zero-sized decoders?

By returning early for zero-sized decoders here, the cleanup logic inside
devm_cxl_dpa_release() is bypassed. This means the kmalloc'd 0-size
resource and any associated skip range aren't freed, and port->hdm_end is
not decremented.

Consequently, any attempt to resize a zero-sized decoder would fail with
-EBUSY because the reservation isn't actually freed. Attempting to free any
lower-indexed decoder would also fail with -EBUSY due to the port->hdm_end
ID mismatch.

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

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

  reply	other threads:[~2026-06-25  9:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25  9:28 [PATCH v6 0/2] Support zero-sized HDM decoders Richard Cheng
2026-06-25  9:28 ` [PATCH v6 1/2] cxl/hdm: Allow zero sized " Richard Cheng
2026-06-25  9:47   ` sashiko-bot [this message]
2026-07-02  7:28     ` Richard Cheng
2026-07-06 16:32       ` Dave Jiang
2026-06-25  9:28 ` [PATCH v6 2/2] tools/testing/cxl: Enable zero sized decoders under hb0 Richard Cheng
2026-06-25  9:46   ` sashiko-bot
2026-07-02  7:31     ` Richard Cheng
2026-07-06 16:43       ` Dave Jiang
2026-07-06 17:01   ` 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=20260625094718.8D3FD1F000E9@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