dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Gurchetan Singh <gurchetansingh@chromium.org>
To: dri-devel@lists.freedesktop.org
Cc: kaleshsingh@google.com, daniel@ffwll.ch, rostedt@goodmis.org
Subject: [RFC PATCH 5/8] drm: start using drm_gem_trace_gpu_mem_instance
Date: Wed, 20 Oct 2021 20:10:24 -0700	[thread overview]
Message-ID: <20211021031027.537-6-gurchetansingh@chromium.org> (raw)
In-Reply-To: <20211021031027.537-1-gurchetansingh@chromium.org>

- drm_gem_handle_create_tail(..) increases the per instance
  memory counter.

- drm_gem_object_release_handle(..) decreases the per instance
  memory counter.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
---
 drivers/gpu/drm/drm_gem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 528d7b29dccf..6f70419f2c90 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -298,6 +298,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
 {
 	struct drm_file *file_priv = data;
 	struct drm_gem_object *obj = ptr;
+	struct drm_device *dev = file_priv->minor->dev;
 
 	if (obj->funcs->close)
 		obj->funcs->close(obj, file_priv);
@@ -305,6 +306,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
 	drm_gem_remove_prime_handles(obj, file_priv);
 	drm_vma_node_revoke(&obj->vma_node, file_priv);
 
+	drm_gem_trace_gpu_mem_instance(dev, file_priv, -obj->size, false);
 	drm_gem_object_handle_put_unlocked(obj);
 
 	return 0;
@@ -447,6 +449,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
 			goto err_revoke;
 	}
 
+	drm_gem_trace_gpu_mem_instance(dev, file_priv, obj->size, false);
 	*handlep = handle;
 	return 0;
 
-- 
2.25.1


  parent reply	other threads:[~2021-10-21  3:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  3:10 [RFC PATCH 0/8] GPU memory tracepoints Gurchetan Singh
2021-10-21  3:10 ` [RFC PATCH 1/8] tracing/gpu: modify gpu_mem_total Gurchetan Singh
2021-10-21 11:56   ` Daniel Vetter
2021-10-21 13:07     ` Steven Rostedt
2021-10-28 15:21       ` Daniel Vetter
2021-10-21  3:10 ` [RFC PATCH 2/8] drm: add new tracepoint fields to drm_device and drm_file Gurchetan Singh
2021-10-21  3:10 ` [RFC PATCH 3/8] drm: add helper functions for gpu_mem_total and gpu_mem_instance Gurchetan Singh
2021-10-21  3:10 ` [RFC PATCH 4/8] drm: start using drm_gem_trace_gpu_mem_total Gurchetan Singh
2021-10-21  3:49   ` Steven Rostedt
2021-10-21  3:10 ` Gurchetan Singh [this message]
2021-10-21  3:50   ` [RFC PATCH 5/8] drm: start using drm_gem_trace_gpu_mem_instance Steven Rostedt
2021-11-05  8:24   ` [drm] a31246115b: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2021-10-21  3:10 ` [RFC PATCH 6/8] drm: track real and fake imports in drm_prime_member Gurchetan Singh
2021-10-21  3:10 ` [RFC PATCH 7/8] drm: trace memory import per DRM file Gurchetan Singh
2021-10-21  3:10 ` [RFC PATCH 8/8] drm: trace memory import per DRM device Gurchetan Singh
2021-10-21 12:00 ` [RFC PATCH 0/8] GPU memory tracepoints Daniel Vetter
2021-10-21 22:38   ` Kalesh Singh
2021-11-01 18:54     ` Kalesh Singh
2021-11-17 18:06       ` Kalesh Singh

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=20211021031027.537-6-gurchetansingh@chromium.org \
    --to=gurchetansingh@chromium.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kaleshsingh@google.com \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).