From: Davidlohr Bueso <dave@stgolabs.net>
To: sashiko-reviews@lists.linux.dev, dave.jiang@intel.com
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v7 2/8] cxl/pci: Add BI topology enable/disable
Date: Mon, 3 Aug 2026 11:55:06 -0700 [thread overview]
Message-ID: <20260803185506.wynluncuhpda2tw7@offworld> (raw)
In-Reply-To: <20260728151629.20F0D1F000E9@smtp.kernel.org>
On Tue, 28 Jul 2026, sashiko-bot@kernel.org wrote:
>Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
>- [High] Topology walk loop exits early, completely skipping CXL Root Ports and breaking BI enablement.
No, we already covered this.
>- [High] Missing explicit hardware commit for Endpoints and Root Ports.
No, we already covered this.
>- [High] Premature BI disablement on shared Switch DSPs due to missing `nr_bi` reference counting.
No, we already covered this.
>- [Medium] Hardware register state is leaked (left enabled) when a downstream port fails to commit.
Yes, that's a corner case which I've fixed up but should not be a show stopper for v7.
The fix is trivial, see below.
>- [Medium] Writing to the BI_COMMIT control bit without waiting for the BI_COMMITTED status bit to clear introduces a race condition.
False positive. This is guaranteed per hw - see Table 8-158.
...
>> +static int cxl_bi_enable_path(struct cxl_dev_state *cxlds,
>> + struct cxl_port *port, struct cxl_dport *dport)
>> +{
>> + struct cxl_dport *dport_iter, *failed;
>> + struct cxl_port *port_iter;
>> + int rc;
>> +
>> + port_iter = port;
>> + dport_iter = dport;
>> + while (!is_cxl_root(port_iter)) {
>> + rc = cxl_bi_ctrl_dport_enable(dport_iter);
>> + if (rc)
>> + goto err_rollback;
>> +
>> + dport_iter = port_iter->parent_dport;
>> + port_iter = dport_iter->port;
>> + }
>
>[Severity: High]
>Does this also skip enabling the Root Port?
>
>Using the same !is_cxl_root() condition as cxl_bi_dealloc(), this loop will
>exit before calling cxl_bi_ctrl_dport_enable() for the Root Port, leaving the
>host path incomplete.
>
>[ ... ]
>> +err_rollback:
>> + failed = dport_iter;
>> + dport_iter = dport;
>> + port_iter = port;
>> + while (!is_cxl_root(port_iter) && dport_iter != failed) {
>> + cxl_bi_ctrl_dport_disable(dport_iter);
>> + dport_iter = port_iter->parent_dport;
>> + port_iter = dport_iter->port;
>> + }
>> + return rc;
>> +}
>
>[Severity: Medium]
>Should the failed dport be included in the rollback loop?
No, we've already covered that. But we can fix the register
rollback:
--- a/drivers/cxl/core/pci.c
+++ b/drivers/cxl/core/pci.c
@@ -1161,12 +1161,11 @@ static int __cxl_bi_ctrl_dport(struct cxl_dport *dport, bool enable)
writel(value, bi + CXL_BI_DECODER_CTRL_OFFSET);
rc = __cxl_bi_commit_decoder(dport->dport_dev, bi);
- if (rc)
- return rc;
-
- if (port->regs.bi_rt)
- return __cxl_bi_commit_rt(&port->dev, port->regs.bi_rt);
- return 0;
+ if (!rc && port->regs.bi_rt)
+ rc = __cxl_bi_commit_rt(&port->dev, port->regs.bi_rt);
+ if (rc && enable) /* undo previous enablement */
+ writel(ctrl, bi + CXL_BI_DECODER_CTRL_OFFSET);
+ return rc;
default:
return -EINVAL;
}
>
>If cxl_bi_ctrl_dport_enable() writes the enable bit but the hardware commit
>fails, the control register has still been modified.
>
>By stopping the rollback when dport_iter != failed,
>cxl_bi_ctrl_dport_disable() is never called for it, potentially leaking the
>hardware register state as left enabled.
>
>--
>Sashiko AI review · https://sashiko.dev/#/patchset/20260728144136.709882-1-dave@stgolabs.net?part=2
next prev parent reply other threads:[~2026-08-03 19:01 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 14:41 [PATCH v7 0/8] cxl: Support Back-Invalidate Davidlohr Bueso
2026-07-28 14:41 ` [PATCH v7 1/8] cxl: Add BI register probing and port initialization Davidlohr Bueso
2026-08-04 21:13 ` Dave Jiang
2026-08-05 0:42 ` Alison Schofield
2026-08-05 10:41 ` Li Ming
2026-08-07 5:38 ` Richard Cheng
2026-07-28 14:41 ` [PATCH v7 2/8] cxl/pci: Add BI topology enable/disable Davidlohr Bueso
2026-07-28 15:16 ` sashiko-bot
2026-08-03 18:55 ` Davidlohr Bueso [this message]
2026-08-05 12:49 ` Li Ming
2026-08-05 13:33 ` Li Ming
2026-08-07 6:54 ` Richard Cheng
2026-07-28 14:41 ` [PATCH v7 3/8] cxl/hdm: Add BI coherency support for endpoint decoders Davidlohr Bueso
2026-07-28 15:26 ` sashiko-bot
2026-07-28 18:44 ` Davidlohr Bueso
2026-07-28 14:41 ` [PATCH v7 4/8] cxl: Add HDM-DB region creation Davidlohr Bueso
2026-08-04 22:28 ` Dave Jiang
2026-08-05 0:11 ` Alison Schofield
2026-08-05 19:10 ` Davidlohr Bueso
2026-08-07 11:50 ` Richard Cheng
2026-07-28 14:41 ` [PATCH v7 5/8] cxl/hdm: Rename decoder coherency flags Davidlohr Bueso
2026-08-05 1:13 ` Alison Schofield
2026-07-28 14:41 ` [PATCH v7 6/8] cxl/region: Log the coherency model at region creation Davidlohr Bueso
2026-08-04 22:51 ` Dave Jiang
2026-07-28 14:41 ` [PATCH v7 7/8] cxl/pci: Split BI capability probe from setup Davidlohr Bueso
2026-08-04 23:07 ` Dave Jiang
2026-07-28 14:41 ` [PATCH v7 8/8] cxl: Allow auto-committed BI hdm decoders Davidlohr Bueso
2026-07-28 15:46 ` sashiko-bot
2026-08-03 19:04 ` Davidlohr Bueso
2026-08-04 23:22 ` Dave Jiang
2026-08-05 0:51 ` Alison Schofield
2026-08-05 20:53 ` Davidlohr Bueso
2026-08-07 12:03 ` 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=20260803185506.wynluncuhpda2tw7@offworld \
--to=dave@stgolabs.net \
--cc=dave.jiang@intel.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