Message ID | 1464003258-23669-12-git-send-email-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 23/05/16 12:34, Chris Wilson wrote: Blah blah blah, this, for that, etc... commit message ofc. :) > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > --- > drivers/gpu/drm/i915/i915_debugfs.c | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > index 30cb26fe2fa9..3d14eb3215e1 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -417,6 +417,40 @@ static void print_batch_pool_stats(struct seq_file *m, > print_file_stats(m, "[k]batch pool", stats); > } > > +static int per_file_ctx_stats(int id, void *ptr, void *data) > +{ > + struct i915_gem_context *ctx = ptr; > + int n; > + > + for (n = 0; n < ARRAY_SIZE(ctx->engine); n++) { > + if (ctx->engine[n].state) > + per_file_stats(0, ctx->engine[n].state, data); > + if (ctx->engine[n].ringbuf) > + per_file_stats(0, ctx->engine[n].ringbuf->obj, data); > + } > + > + return 0; > +} > + > +static void print_context_stats(struct seq_file *m, > + struct drm_i915_private *dev_priv) > +{ > + struct file_stats stats; > + struct drm_file *file; > + > + memset(&stats, 0, sizeof(stats)); > + > + if (dev_priv->kernel_context) > + per_file_ctx_stats(0, dev_priv->kernel_context, &stats); > + > + list_for_each_entry(file, &dev_priv->dev->filelist, lhead) { Existing code which iterates this list grabs dev->filelist_mutex ? > + struct drm_i915_file_private *fpriv = file->driver_priv; > + idr_for_each(&fpriv->context_idr, per_file_ctx_stats, &stats); > + } > + > + print_file_stats(m, "[k]contexts", stats); > +} > + > #define count_vmas(list, member) do { \ > list_for_each_entry(vma, list, member) { \ > size += i915_gem_obj_total_ggtt_size(vma->obj); \ > @@ -521,6 +555,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data) > > seq_putc(m, '\n'); > print_batch_pool_stats(m, dev_priv); > + print_context_stats(m, dev_priv); > > mutex_unlock(&dev->struct_mutex); > > Regards, Tvrtko
On Mon, May 23, 2016 at 01:31:25PM +0100, Tvrtko Ursulin wrote: > > On 23/05/16 12:34, Chris Wilson wrote: > > Blah blah blah, this, for that, etc... commit message ofc. :) > > >Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > >Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > >Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > >--- > > drivers/gpu/drm/i915/i915_debugfs.c | 35 +++++++++++++++++++++++++++++++++++ > > 1 file changed, 35 insertions(+) > > > >diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > >index 30cb26fe2fa9..3d14eb3215e1 100644 > >--- a/drivers/gpu/drm/i915/i915_debugfs.c > >+++ b/drivers/gpu/drm/i915/i915_debugfs.c > >@@ -417,6 +417,40 @@ static void print_batch_pool_stats(struct seq_file *m, > > print_file_stats(m, "[k]batch pool", stats); > > } > > > >+static int per_file_ctx_stats(int id, void *ptr, void *data) > >+{ > >+ struct i915_gem_context *ctx = ptr; > >+ int n; > >+ > >+ for (n = 0; n < ARRAY_SIZE(ctx->engine); n++) { > >+ if (ctx->engine[n].state) > >+ per_file_stats(0, ctx->engine[n].state, data); > >+ if (ctx->engine[n].ringbuf) > >+ per_file_stats(0, ctx->engine[n].ringbuf->obj, data); > >+ } > >+ > >+ return 0; > >+} > >+ > >+static void print_context_stats(struct seq_file *m, > >+ struct drm_i915_private *dev_priv) > >+{ > >+ struct file_stats stats; > >+ struct drm_file *file; > >+ > >+ memset(&stats, 0, sizeof(stats)); > >+ > >+ if (dev_priv->kernel_context) > >+ per_file_ctx_stats(0, dev_priv->kernel_context, &stats); > >+ > >+ list_for_each_entry(file, &dev_priv->dev->filelist, lhead) { > > Existing code which iterates this list grabs dev->filelist_mutex ? Recent invention, curses Daniel! -Chris
On ma, 2016-05-23 at 12:34 +0100, Chris Wilson wrote: > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Some commit message would be nice. > --- > drivers/gpu/drm/i915/i915_debugfs.c | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > index 30cb26fe2fa9..3d14eb3215e1 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -417,6 +417,40 @@ static void print_batch_pool_stats(struct seq_file *m, > print_file_stats(m, "[k]batch pool", stats); > } > > +static int per_file_ctx_stats(int id, void *ptr, void *data) > +{ > + struct i915_gem_context *ctx = ptr; > + int n; > + > + for (n = 0; n < ARRAY_SIZE(ctx->engine); n++) { I would have suggested assigining engine = ctx->engine + n, but it's unnamed :( With commit message; Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Regards, Joonas > + if (ctx->engine[n].state) > + per_file_stats(0, ctx->engine[n].state, data); > + if (ctx->engine[n].ringbuf) > + per_file_stats(0, ctx->engine[n].ringbuf->obj, data); > + } > + > + return 0; > +} > + > +static void print_context_stats(struct seq_file *m, > + struct drm_i915_private *dev_priv) > +{ > + struct file_stats stats; > + struct drm_file *file; > + > + memset(&stats, 0, sizeof(stats)); > + > + if (dev_priv->kernel_context) > + per_file_ctx_stats(0, dev_priv->kernel_context, &stats); > + > + list_for_each_entry(file, &dev_priv->dev->filelist, lhead) { > + struct drm_i915_file_private *fpriv = file->driver_priv; > + idr_for_each(&fpriv->context_idr, per_file_ctx_stats, &stats); > + } > + > + print_file_stats(m, "[k]contexts", stats); > +} > + > #define count_vmas(list, member) do { \ > list_for_each_entry(vma, list, member) { \ > size += i915_gem_obj_total_ggtt_size(vma->obj); \ > @@ -521,6 +555,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data) > > seq_putc(m, '\n'); > print_batch_pool_stats(m, dev_priv); > + print_context_stats(m, dev_priv); > > mutex_unlock(&dev->struct_mutex); >
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 30cb26fe2fa9..3d14eb3215e1 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -417,6 +417,40 @@ static void print_batch_pool_stats(struct seq_file *m, print_file_stats(m, "[k]batch pool", stats); } +static int per_file_ctx_stats(int id, void *ptr, void *data) +{ + struct i915_gem_context *ctx = ptr; + int n; + + for (n = 0; n < ARRAY_SIZE(ctx->engine); n++) { + if (ctx->engine[n].state) + per_file_stats(0, ctx->engine[n].state, data); + if (ctx->engine[n].ringbuf) + per_file_stats(0, ctx->engine[n].ringbuf->obj, data); + } + + return 0; +} + +static void print_context_stats(struct seq_file *m, + struct drm_i915_private *dev_priv) +{ + struct file_stats stats; + struct drm_file *file; + + memset(&stats, 0, sizeof(stats)); + + if (dev_priv->kernel_context) + per_file_ctx_stats(0, dev_priv->kernel_context, &stats); + + list_for_each_entry(file, &dev_priv->dev->filelist, lhead) { + struct drm_i915_file_private *fpriv = file->driver_priv; + idr_for_each(&fpriv->context_idr, per_file_ctx_stats, &stats); + } + + print_file_stats(m, "[k]contexts", stats); +} + #define count_vmas(list, member) do { \ list_for_each_entry(vma, list, member) { \ size += i915_gem_obj_total_ggtt_size(vma->obj); \ @@ -521,6 +555,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data) seq_putc(m, '\n'); print_batch_pool_stats(m, dev_priv); + print_context_stats(m, dev_priv); mutex_unlock(&dev->struct_mutex);
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)