[Intel-gfx] [PATCH 11/15] drm/i915: Trim i915_guc_info() stack usage

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 28 11:35:59 UTC 2016


On Mon, Nov 28, 2016 at 11:15:27AM +0000, Tvrtko Ursulin wrote:
> 
> On 25/11/2016 09:30, Chris Wilson wrote:
> >i915_guc_info() (part of debugfs output) tries to avoid holding
> >struct_mutex for a long period by copying onto the stack. This causes a
> >warning that the stack frame is massive, so stop doing that. We can even
> >forgo holding the struct_mutex here as that doesn't serialise the values
> >being read (and the lists used exist for the device lifetime).
> >
> >Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> >---
> > drivers/gpu/drm/i915/i915_debugfs.c | 39 +++++++++++++------------------------
> > 1 file changed, 14 insertions(+), 25 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> >index 8eb8c29b7492..7676e88ae5f2 100644
> >--- a/drivers/gpu/drm/i915/i915_debugfs.c
> >+++ b/drivers/gpu/drm/i915/i915_debugfs.c
> >@@ -2434,47 +2434,36 @@ static void i915_guc_client_info(struct seq_file *m,
> > static int i915_guc_info(struct seq_file *m, void *data)
> > {
> > 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
> >-	struct drm_device *dev = &dev_priv->drm;
> >-	struct intel_guc guc;
> >-	struct i915_guc_client client = {};
> >+	const struct intel_guc *guc = &dev_priv->guc;
> > 	struct intel_engine_cs *engine;
> > 	enum intel_engine_id id;
> >-	u64 total = 0;
> >+	u64 total;
> >
> > 	if (!HAS_GUC_SCHED(dev_priv))
> > 		return 0;
> >
> >-	if (mutex_lock_interruptible(&dev->struct_mutex))
> >-		return 0;
> >-
> >-	/* Take a local copy of the GuC data, so we can dump it at leisure */
> >-	guc = dev_priv->guc;
> >-	if (guc.execbuf_client)
> >-		client = *guc.execbuf_client;
> 
> So this used to print out all zeros when GuC submission is disabled.
> Should we instead just skip all the counter dumping if
> execbuf_client == NULL and just print "disabled" or something?

That would be the sensible escape instead of HAS_GUC_SCHED.

if (!dev_priv->guc.execbuf_client) {
	seq_puts(m, "GuC scheduling %s\n",
		 HAS_GUC_SCHED(dev_priv) ?  "disabled" : "not supported");
	return 0;
}
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list