From patchwork Thu Apr 19 14:16:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 10350607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 572C76053C for ; Thu, 19 Apr 2018 14:16:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48EF728A0F for ; Thu, 19 Apr 2018 14:16:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B4E528A19; Thu, 19 Apr 2018 14:16:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0109128A0F for ; Thu, 19 Apr 2018 14:16:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D4DE6E029; Thu, 19 Apr 2018 14:16:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA6936E029 for ; Thu, 19 Apr 2018 14:16:52 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 07:16:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,469,1517904000"; d="scan'208";a="33796351" Received: from rosetta.fi.intel.com ([10.237.72.186]) by fmsmga008.fm.intel.com with ESMTP; 19 Apr 2018 07:16:50 -0700 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id 865B8840755; Thu, 19 Apr 2018 17:16:17 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Thu, 19 Apr 2018 17:16:16 +0300 Message-Id: <20180419141616.1100-1-mika.kuoppala@linux.intel.com> X-Mailer: git-send-email 2.14.1 Subject: [Intel-gfx] [PATCH] drm/i915: Show number of objects without client X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eero Tamminen MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Output the number of objects not tied to a client or to a vma. This amount should be quite small and on oom issues we can rule out significant bo leaks quickly by inspecting these values. Note that we are not fully accurate due to how we take and release the locks during transversal of related lists. Cc: Chris Wilson Cc: Eero Tamminen Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/i915_debugfs.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index e0274f41bc76..b1cbecfca716 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -354,8 +354,8 @@ static int per_file_stats(int id, void *ptr, void *data) stats.unbound); \ } while (0) -static void print_batch_pool_stats(struct seq_file *m, - struct drm_i915_private *dev_priv) +static unsigned int print_batch_pool_stats(struct seq_file *m, + struct drm_i915_private *dev_priv) { struct drm_i915_gem_object *obj; struct file_stats stats; @@ -375,6 +375,7 @@ static void print_batch_pool_stats(struct seq_file *m, } print_file_stats(m, "[k]batch pool", stats); + return stats.count; } static int per_file_ctx_stats(int id, void *ptr, void *data) @@ -392,8 +393,8 @@ static int per_file_ctx_stats(int id, void *ptr, void *data) return 0; } -static void print_context_stats(struct seq_file *m, - struct drm_i915_private *dev_priv) +static unsigned int print_context_stats(struct seq_file *m, + struct drm_i915_private *dev_priv) { struct drm_device *dev = &dev_priv->drm; struct file_stats stats; @@ -412,6 +413,7 @@ static void print_context_stats(struct seq_file *m, mutex_unlock(&dev->struct_mutex); print_file_stats(m, "[k]contexts", stats); + return stats.count; } static int i915_gem_object_info(struct seq_file *m, void *data) @@ -422,7 +424,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data) u32 count, mapped_count, purgeable_count, dpy_count, huge_count; u64 size, mapped_size, purgeable_size, dpy_size, huge_size; struct drm_i915_gem_object *obj; - unsigned int page_sizes = 0; + unsigned int page_sizes = 0, client_count = 0, vma_count = 0; struct drm_file *file; char buf[80]; int ret; @@ -462,6 +464,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data) } } seq_printf(m, "%u unbound objects, %llu bytes\n", count, size); + vma_count += count; size = count = dpy_size = dpy_count = 0; list_for_each_entry(obj, &dev_priv->mm.bound_list, mm.link) { @@ -490,6 +493,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data) } } spin_unlock(&dev_priv->mm.obj_lock); + vma_count += count; seq_printf(m, "%u bound objects, %llu bytes\n", count, size); @@ -511,11 +515,11 @@ static int i915_gem_object_info(struct seq_file *m, void *data) buf, sizeof(buf))); seq_putc(m, '\n'); - print_batch_pool_stats(m, dev_priv); + client_count += print_batch_pool_stats(m, dev_priv); mutex_unlock(&dev->struct_mutex); mutex_lock(&dev->filelist_mutex); - print_context_stats(m, dev_priv); + client_count += print_context_stats(m, dev_priv); list_for_each_entry_reverse(file, &dev->filelist, lhead) { struct file_stats stats; struct drm_i915_file_private *file_priv = file->driver_priv; @@ -543,12 +547,18 @@ static int i915_gem_object_info(struct seq_file *m, void *data) request->ctx->pid : file->pid, PIDTYPE_PID); print_file_stats(m, task ? task->comm : "", stats); + client_count += stats.count; rcu_read_unlock(); mutex_unlock(&dev->struct_mutex); } mutex_unlock(&dev->filelist_mutex); + seq_printf(m, "\n%d objects without vma\n", + dev_priv->mm.object_count - vma_count); + seq_printf(m, "%d objects without client\n", + dev_priv->mm.object_count - client_count); + return 0; }