Re: [PATCH v3] driver core: fw_devlink: Stop trying to optimize cycle detection logic
From: Luca Ceresoli
Date: Wed Dec 04 2024 - 13:47:18 EST
Hi Geert,
thanks for your feedback.
On Wed, 4 Dec 2024 13:52:56 +0100
Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> Hi Luca,
>
> On Wed, Dec 4, 2024 at 12:48 PM Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx> wrote:
> > On Wed, 30 Oct 2024 10:10:07 -0700
> > Saravana Kannan <saravanak@xxxxxxxxxx> wrote:
> >
> > > In attempting to optimize fw_devlink runtime, I introduced numerous cycle
> > > detection bugs by foregoing cycle detection logic under specific
> > > conditions. Each fix has further narrowed the conditions for optimization.
> > >
> > > It's time to give up on these optimization attempts and just run the cycle
> > > detection logic every time fw_devlink tries to create a device link.
> > >
> > > The specific bug report that triggered this fix involved a supplier fwnode
> > > that never gets a device created for it. Instead, the supplier fwnode is
> > > represented by the device that corresponds to an ancestor fwnode.
> > >
> > > In this case, fw_devlink didn't do any cycle detection because the cycle
> > > detection logic is only run when a device link is created between the
> > > devices that correspond to the actual consumer and supplier fwnodes.
> > >
> > > With this change, fw_devlink will run cycle detection logic even when
> > > creating SYNC_STATE_ONLY proxy device links from a device that is an
> > > ancestor of a consumer fwnode.
> > >
> > > Reported-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
> > > Closes: https://lore.kernel.org/all/1a1ab663-d068-40fb-8c94-f0715403d276@xxxxxxxxxxxxxxxx/
> > > Fixes: 6442d79d880c ("driver core: fw_devlink: Improve detection of overlapping cycles")
> > > Tested-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
> > > Signed-off-by: Saravana Kannan <saravanak@xxxxxxxxxx>
> >
> > After rebasing my work for the hotplug connector driver using device
> > tree overlays [0] on v6.13-rc1 I started getting these OF errors on
> > overlay removal:
> >
> > OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /addon-connector/devices/panel-dsi-lvds
> > OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /addon-connector/devices/backlight-addon
> > OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /addon-connector/devices/battery-charger
> > OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /addon-connector/devices/regulator-addon-5v0-sys
> > OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /addon-connector/devices/regulator-addon-3v3-sys
> >
> > ...and many more. Exactly one per each device in the overlay 'devices'
> > node, each implemented by a platform driver.
>
> FTR, I am not seeing that when loading/removing
> r8a77990-ebisu-cn41-msiof0-25lc040.dtso
> https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/commit/?h=topic/renesas-overlays&id=dd998e8db58b67744eb91f11f13544401c975470
This overlay is adding an SPI device. In my overlay I don't have any
SPI devices, but I have I2C and other devices and I'm getting those
errors only about devices implemented by platform drivers. Not sure
that matters, but that's the first difference that came to mind.
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com