[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z8sQoh1UPHidhMPv@rric.localdomain>
Date: Fri, 7 Mar 2025 16:28:34 +0100
From: Robert Richter <rrichter@....com>
To: Ira Weiny <ira.weiny@...el.com>
Cc: Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Davidlohr Bueso <dave@...olabs.net>, linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org, Gregory Price <gourry@...rry.net>,
Terry Bowman <terry.bowman@....com>
Subject: Re: [PATCH 1/2] cxl/pci: Ignore downstream ports with duplicate port
IDs
Hi Ira,
thanks for your review.
On 05.03.25 09:09:52, Ira Weiny wrote:
> Robert Richter wrote:
> > If a link is inactive, the port ID in the PCIe Link Capability
> > Register of a downstream port may not be assigned yet. Another
> > downstream port with an inactive link on the same Downstream Switch
> > Port may have the same port ID.
>
> Is it possible that an active link would have the same ID?
>
> I'm not clear why failing with a duplicate port ID is a bad thing.
>
> >
> > In this case the port enumeration of
> > the root or downstream port fails due to duplicate port IDs
> > (devm_cxl_port_enumerate_dports()/add_dport()).
> >
> > Relax the check and just ignore downstream ports with duplicate port
> > IDs.
>
> Ah. So do not add the dport...
>
> It may not matter but I __think__ this adds a subtle memory leak where the
> dport object is allocated, not added to the xarray, and upon the port
> being probed later a new dport object is allocated in it's place. That
> might be ok as the memory will be recovered when the switch device is
> destroyed (via devm). But could a series of unplug/hotplugs cause issues?
No, this patches do not change anything regarding devm allocation.
I have looked into __devm_cxl_add_dport(). If the function returns an
error, there might be allocated memory left which is not released
before the host device is released. This is current implementation and
these patches do not change anything here. If at all, it is a general
issue with the devm implementation in that function (and probably not
only there).
-Robert
Powered by blists - more mailing lists