From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 01/26] drm/i915: Split out verbose PPGTT dumping Date: Thu, 20 Mar 2014 11:57:42 +0000 Message-ID: <20140320115742.GA4463@nuc-i3427.alporthouse.com> References: <1395121738-29126-1-git-send-email-benjamin.widawsky@intel.com> <1395121738-29126-2-git-send-email-benjamin.widawsky@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from fireflyinternet.com (mail.fireflyinternet.com [87.106.93.118]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A9F96E01C for ; Thu, 20 Mar 2014 04:57:45 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1395121738-29126-2-git-send-email-benjamin.widawsky@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Ben Widawsky Cc: Intel GFX List-Id: intel-gfx@lists.freedesktop.org On Mon, Mar 17, 2014 at 10:48:33PM -0700, Ben Widawsky wrote: > There often is not enough memory to dump the full contents of the PPGTT. > As a temporary bandage, to continue getting valuable basic PPGTT info, > wrap the dangerous, memory hungry part inside of a new verbose version > of the debugfs file. > > Also while here we can split out the ppgtt print function so it's more > reusable. > > I'd really like to get ppgtt info into our error state, but I found it too > difficult to make work in the limited time I have. Maybe Mika can find a way. ppgtt_info is not printing out the user contexts - those are the most interesting ones that should get dynamically allocated. =0 ickle:/usr/src/linux$ git diff | cat diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 04d40fa..442a075 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1749,17 +1749,6 @@ static int i915_swizzle_info(struct seq_file *m, void *data) return 0; } -static int per_file_ctx(int id, void *ptr, void *data) -{ - struct i915_hw_context *ctx = ptr; - struct seq_file *m = data; - struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(ctx); - - ppgtt->debug_dump(ppgtt, m); - - return 0; -} - static void gen8_ppgtt_info(struct seq_file *m, struct drm_device *dev, int verbose) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -1804,7 +1793,21 @@ static void print_ppgtt(struct seq_file *m, struct i915_hw_ppgtt *ppgtt, const c { seq_printf(m, "%s:\n", name); seq_printf(m, "pd gtt offset: 0x%08x\n", ppgtt->pd.pd_offset); - seq_printf(m, "\tpd pages: %zu\n", gen6_ppgtt_count_pt_pages(ppgtt)); + seq_printf(m, "\tpd pages: %zu / %d\n", gen6_ppgtt_count_pt_pages(ppgtt), ppgtt->num_pd_entries); +} + +static int per_file_ctx(int id, void *ptr, void *data) +{ + struct i915_hw_context *ctx = ptr; + struct seq_file *m = (void *)((unsigned long)data & ~1); + bool verbose = (unsigned long)data & 1; + struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(ctx); + + print_ppgtt(m, ppgtt, ctx->id == DEFAULT_CONTEXT_ID ? "Default context" : "User context"); + if (verbose) + ppgtt->debug_dump(ppgtt, m); + + return 0; } static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev, bool verbose) @@ -1838,14 +1841,11 @@ static void gen6_ppgtt_info(struct seq_file *m, struct drm_device *dev, bool ver list_for_each_entry_reverse(file, &dev->filelist, lhead) { struct drm_i915_file_private *file_priv = file->driver_priv; - struct i915_hw_ppgtt *pvt_ppgtt; - pvt_ppgtt = ctx_to_ppgtt(file_priv->private_default_ctx); seq_printf(m, "proc: %s\n", get_pid_task(file->pid, PIDTYPE_PID)->comm); - print_ppgtt(m, pvt_ppgtt, "Default context"); - if (verbose) - idr_for_each(&file_priv->context_idr, per_file_ctx, m); + idr_for_each(&file_priv->context_idr, per_file_ctx, + (void *)((unsigned long)m | verbose)); } } -- Chris Wilson, Intel Open Source Technology Centre