On Fri, Sep 12, 2025 at 07:03:42PM +0200, Luca Ceresoli wrote:
> The usefulness of /sys/kernel/debug/dri/bridges is limited as it only shows
> bridges between drm_bridge_add() and drm_bridge_remove(). However
> refcounted bridges can stay allocated for a long time after
> drm_bridge_remove(), and a memory leak due to a missing drm_bridge_put()
> would not be visible in this debugfs file.
> 
> Add removed bridges to the /sys/kernel/debug/dri/bridges output.
> 
> Signed-off-by: Luca Ceresoli <luca.ceres...@bootlin.com>
> 
> ---
> 
> Changes in v8:
> - updated to rename bridge_removed_list -> bridge_lingering_list
> 
> Changes in v7:
> - rebased on current code which is in drm_bridge.c now
> - removed if (drm_bridge_is_refcounted(bridge)), refcounting is not
>   optional
> - don't show bridge address
> - improve commit message
> 
> This patch was added in v6.
> ---
>  drivers/gpu/drm/drm_bridge.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 
> 9491ae7c884d355be4a82fb02a43a42d17fa8e0c..fccc42017fd4df6ecfb596325df2dc4d17566f39
>  100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -1491,17 +1491,20 @@ EXPORT_SYMBOL(devm_drm_put_bridge);
>  
>  static void drm_bridge_debugfs_show_bridge(struct drm_printer *p,
>                                          struct drm_bridge *bridge,
> -                                        unsigned int idx)
> +                                        unsigned int idx,
> +                                        bool removed)
>  {
>       drm_printf(p, "bridge[%u]: %ps\n", idx, bridge->funcs);
>  
> -     drm_printf(p, "\trefcount: %u\n", kref_read(&bridge->refcount));
> +     drm_printf(p, "\trefcount: %u%s\n", kref_read(&bridge->refcount),
> +                removed ? " [removed]" : "");

I would use lingering here too, and your commit logs haven't been
updated either.

Maxime

Attachment: signature.asc
Description: PGP signature

Reply via email to