From: sashiko-bot@kernel.org
To: "Davidlohr Bueso" <dave@stgolabs.net>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v5 1/5] cxl: Add BI register probing and port initialization
Date: Mon, 15 Jun 2026 17:35:41 +0000 [thread overview]
Message-ID: <20260615173541.BE49D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260615145529.13848-2-dave@stgolabs.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] devm mappings for dport BI registers leak on hotplug due to being called outside the dport devres group in cxl_port_add_dport.
--
commit a836080fdf13fa334055f7f13a95491b66ef793f
Author: Davidlohr Bueso <dave@stgolabs.net>
cxl: Add BI register probing and port initialization
This commit adds register probing for BI Route Table and BI Decoder capability
structures. It introduces helpers to map the BI Decoder of a downstream port
at dport-creation time and a port's own BI capability during port probe.
> diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c
> index ada51948d52fa..ca8d8c14b7876 100644
> --- a/drivers/cxl/port.c
> +++ b/drivers/cxl/port.c
[ ... ]
> @@ -261,6 +321,17 @@ static struct cxl_dport *cxl_port_add_dport(struct cxl_port *port,
> /* This group was only needed for early exit above */
> devres_remove_group(&port->dev, no_free_ptr(port_dr_group));
>
> + if (dev_is_pci(dport_dev)) {
> + switch (pci_pcie_type(to_pci_dev(dport_dev))) {
> + case PCI_EXP_TYPE_ROOT_PORT:
> + case PCI_EXP_TYPE_DOWNSTREAM:
> + cxl_dport_map_bi(dport);
[Severity: High]
Does this leak devm mappings if the dport is hot-removed?
Looking at cxl_port_add_dport(), devm_cxl_add_dport_by_dev() creates a
devres group for the dport on the parent port's device. However,
cxl_dport_map_bi() is called after devm_cxl_add_dport_by_dev() returns,
meaning the devres group has already been closed.
Because cxl_dport_map_bi() calls devm_cxl_iomap_block() against the parent
port device, these devm allocations bypass the dport group and attach
directly to the parent port device.
If the dport is hot-removed, the dport devres group is released, but the BI
capability mappings appear to be left behind. If the dport is subsequently
re-added, won't devm_request_mem_region() fail with -EBUSY due to the
physical address region conflict, permanently breaking BI capabilities?
> + break;
> + default:
> + break;
> + }
> + }
> +
> cxl_switch_parse_cdat(dport);
>
> /* New dport added, update the decoder targets */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260615145529.13848-1-dave@stgolabs.net?part=1
next prev parent reply other threads:[~2026-06-15 17:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 14:55 [PATCH v5 0/5] cxl: Support Back-Invalidate Davidlohr Bueso
2026-06-15 14:55 ` [PATCH v5 1/5] cxl: Add BI register probing and port initialization Davidlohr Bueso
2026-06-15 17:35 ` sashiko-bot [this message]
2026-06-15 14:55 ` [PATCH v5 2/5] cxl/pci: Add BI topology enable/disable Davidlohr Bueso
2026-06-15 17:34 ` sashiko-bot
2026-06-15 14:55 ` [PATCH v5 3/5] cxl/hdm: Add BI coherency support for endpoint decoders Davidlohr Bueso
2026-06-15 17:32 ` sashiko-bot
2026-06-15 14:55 ` [PATCH v5 4/5] cxl: Add HDM-DB region creation Davidlohr Bueso
2026-06-15 17:41 ` sashiko-bot
2026-06-15 14:55 ` [PATCH v5 5/5] cxl/hdm: Rename decoder coherency flags Davidlohr Bueso
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=20260615173541.BE49D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dave@stgolabs.net \
--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