From: Richard Cheng <icheng@nvidia.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v6 2/2] tools/testing/cxl: Enable zero sized decoders under hb0
Date: Thu, 2 Jul 2026 15:31:18 +0800 [thread overview]
Message-ID: <akYTPc5texS6oUo9@MWDK4CY14F> (raw)
In-Reply-To: <20260625094602.8DB0E1F00A3A@smtp.kernel.org>
On Thu, Jun 25, 2026 at 09:46:01AM +0800, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Incorrect HPA base for zero-sized mock decoders causes them to overlap the start of decoder[0].
> --
>
> commit e4836660bfdfee0da74cc6f18fe1e3c9826c4c04
> Author: Richard Cheng <icheng@nvidia.com>
>
> tools/testing/cxl: Enable zero sized decoders under hb0
>
> This commit introduces a mock_zero_size_decoders module parameter to cxl_test.
> It is intended to exercise zero-size DPA reservations by mocking committed,
> empty decoders above the auto-region under host-bridge0.
>
> > diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> > index 418669927fb00..117691b3c62f5 100644
> > --- a/tools/testing/cxl/test/cxl.c
> > +++ b/tools/testing/cxl/test/cxl.c
> [ ... ]
> > @@ -1145,6 +1178,20 @@ static bool mock_init_hdm_decoder(struct cxl_decoder *cxld)
> > base = window->base_hpa;
> > if (extended_linear_cache)
> > base += mock_auto_region_size;
> > +
> > + /*
> > + * With mock_zero_size_decoders, decoders 1 and 2 of the special
> > + * endpoints mock committed, locked, empty decoders above the
> > + * decoder[0] auto-region (CXL r4.0 8.2.4.20.12). commit_end then
> > + * points at a zero-size decoder, exercising the zero-size
> > + * reservation and poison-by-endpoint code paths.
> > + */
> > + if (cxld->id == 1 || cxld->id == 2) {
> > + size_zero_mock_decoder_ep(cxld, base);
>
> [Severity: Medium]
> Since the comment indicates these decoders are mocked above the decoder[0]
> auto-region, should base + mock_auto_region_size be passed here instead
> of base?
>
> Passing base appears to set the zero-sized decoder's HPA to the start of the
> region, causing it to overlap with decoder[0].
>
> > + port->commit_end = cxld->id;
> > + WARN_ON_ONCE(!cxld_registry_new(cxld));
> > + return false;
> > + }
> [ ... ]
> > @@ -1214,6 +1263,26 @@ static bool mock_init_hdm_decoder(struct cxl_decoder *cxld)
> >
> > cxld_registry_update(cxld);
> > put_device(dev);
> > +
> > + if (!mock_zero_size_decoders)
> > + continue;
> > +
> > + /*
> > + * Mirror the endpoint: commit the next two switch decoders
> > + * as zero-size + locked so the empty-decoder layout extends
> > + * end-to-end through the switch and host bridge.
> > + */
> > + for (id = 1; id <= 2; id++) {
> > + dev = device_find_child(&iter->dev, &id,
> > + match_decoder_by_index);
> > + if (WARN_ON(!dev))
> > + continue;
> > + cxld = to_cxl_decoder(dev);
> > + size_zero_mock_decoder_sw(cxld, base, i);
>
> [Severity: Medium]
> Similarly, does this incorrectly place the switch zero-sized mock decoders
> at the start of decoder[0]'s HPA range instead of above it?
>
> > + iter->commit_end = id;
> > + cxld_registry_update(cxld);
> > + put_device(dev);
> > + }
> > }
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260625092857.41139-1-icheng@nvidia.com?part=2
This doesn't stand neither, [base, base-1] is an empty range, it decodes nothing and can't
overlap decoder[0]. Region assembly never sees it, endpoint empty decoder are skipped via cxled_empty(), and
the switch matching predicates compare range ends, which an empty range can never satisfy.
--Richard
next prev parent reply other threads:[~2026-07-02 7:31 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
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 [this message]
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=akYTPc5texS6oUo9@MWDK4CY14F \
--to=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