dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/framebuffer: Print task that allocated the fb in debug info.
Date: Wed, 20 Dec 2017 11:26:49 +0100	[thread overview]
Message-ID: <20171220102649.GO26573@phenom.ffwll.local> (raw)
In-Reply-To: <20171220093545.613-3-maarten.lankhorst@linux.intel.com>

On Wed, Dec 20, 2017 at 10:35:44AM +0100, Maarten Lankhorst wrote:
> This is is very useful to finding sources of leaked framebufers.
> The fbcon fb is annotated with [fbcon], to give it a better name
> than kworker.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

I think we can polish this more later on, it's a good start.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_fb_helper.c   | 1 +
>  drivers/gpu/drm/drm_framebuffer.c | 2 ++
>  include/drm/drm_framebuffer.h     | 6 ++++++
>  3 files changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 04a3a5ce370a..d396d74a7dda 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -1848,6 +1848,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
>  	if (ret < 0)
>  		return ret;
>  
> +	strcpy(fb_helper->fb->comm, "[fbcon]");
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index d63d4c2ac4c8..5a13ff29f4f0 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -664,6 +664,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
>  	INIT_LIST_HEAD(&fb->filp_head);
>  
>  	fb->funcs = funcs;
> +	strcpy(fb->comm, current->comm);
>  
>  	ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB,
>  				    false, drm_framebuffer_free);
> @@ -978,6 +979,7 @@ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
>  	struct drm_format_name_buf format_name;
>  	unsigned int i;
>  
> +	drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm);
>  	drm_printf_indent(p, indent, "refcount=%u\n",
>  			  drm_framebuffer_read_refcount(fb));
>  	drm_printf_indent(p, indent, "format=%s\n",
> diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
> index dccb897951ba..c50502c656e5 100644
> --- a/include/drm/drm_framebuffer.h
> +++ b/include/drm/drm_framebuffer.h
> @@ -121,6 +121,12 @@ struct drm_framebuffer {
>  	 * @base: base modeset object structure, contains the reference count.
>  	 */
>  	struct drm_mode_object base;
> +
> +	/**
> +	 * @comm: Name of the process allocating the fb, used for fb dumping.
> +	 */
> +	char comm[TASK_COMM_LEN];
> +
>  	/**
>  	 * @format: framebuffer format information
>  	 */
> -- 
> 2.15.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-12-20 10:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20  9:35 [PATCH 0/3] drm: Plug framebuffer leaks Maarten Lankhorst
2017-12-20  9:35 ` [PATCH 1/3] drm/plane: Make framebuffer refcounting the responsibility of setplane_internal callers Maarten Lankhorst
2017-12-20 10:23   ` Daniel Vetter
2017-12-20  9:35 ` [PATCH 2/3] drm/framebuffer: Print task that allocated the fb in debug info Maarten Lankhorst
2017-12-20 10:26   ` Daniel Vetter [this message]
2017-12-20  9:35 ` [PATCH 3/3] drm/i915: Disable all planes for load detection, v2 Maarten Lankhorst
2017-12-20 10:28   ` Daniel Vetter
2017-12-21  9:58     ` Maarten Lankhorst

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=20171220102649.GO26573@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /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