Message ID | 1463922152-2709-8-git-send-email-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 22/05/16 14:02, Chris Wilson wrote: > Print the context's owner (via the pid under file_priv) under debugfs. > > Note that since this was originally introducing > dev_priv->kernel_context, there are a couple of leftover minor chunks. > > 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 | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > index ae28e6e9d603..945fe4710b37 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -2014,9 +2014,22 @@ static int i915_context_status(struct seq_file *m, void *unused) > continue; > > seq_printf(m, "HW context %u ", ctx->hw_id); > + if (IS_ERR(ctx->file_priv)) { > + seq_puts(m, "(deleted) "); > + } else if (ctx->file_priv) { > + struct pid *pid = ctx->file_priv->file->pid; Hm, can you deref file_priv after the file has been closed / client exited? We could still have the context on the list after that point.. > + struct task_struct *task; > + > + task = get_pid_task(pid, PIDTYPE_PID); > + if (task) { > + seq_printf(m, "(%s [%d]) ", > + task->comm, task->pid); > + put_task_struct(task); > + } > + } else > + seq_puts(m, "(kernel) "); > + > describe_ctx(m, ctx); > - if (ctx == dev_priv->kernel_context) > - seq_printf(m, "(kernel context) "); > > if (i915.enable_execlists) { > seq_putc(m, '\n'); > Regards, Tvrtko
On Mon, May 23, 2016 at 10:42:42AM +0100, Tvrtko Ursulin wrote: > > > On 22/05/16 14:02, Chris Wilson wrote: > >Print the context's owner (via the pid under file_priv) under debugfs. > > > >Note that since this was originally introducing > >dev_priv->kernel_context, there are a couple of leftover minor chunks. > > > >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 | 17 +++++++++++++++-- > > 1 file changed, 15 insertions(+), 2 deletions(-) > > > >diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > >index ae28e6e9d603..945fe4710b37 100644 > >--- a/drivers/gpu/drm/i915/i915_debugfs.c > >+++ b/drivers/gpu/drm/i915/i915_debugfs.c > >@@ -2014,9 +2014,22 @@ static int i915_context_status(struct seq_file *m, void *unused) > > continue; > > > > seq_printf(m, "HW context %u ", ctx->hw_id); > >+ if (IS_ERR(ctx->file_priv)) { > >+ seq_puts(m, "(deleted) "); > >+ } else if (ctx->file_priv) { > >+ struct pid *pid = ctx->file_priv->file->pid; > > Hm, can you deref file_priv after the file has been closed / client > exited? We could still have the context on the list after that > point.. Hmm, this was extracted from after the context_close patch because I didn't think we had that bug... We do. That's easy enough to mark as closed when the file is, which is what we need later anyway. -Chris
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index ae28e6e9d603..945fe4710b37 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2014,9 +2014,22 @@ static int i915_context_status(struct seq_file *m, void *unused) continue; seq_printf(m, "HW context %u ", ctx->hw_id); + if (IS_ERR(ctx->file_priv)) { + seq_puts(m, "(deleted) "); + } else if (ctx->file_priv) { + struct pid *pid = ctx->file_priv->file->pid; + struct task_struct *task; + + task = get_pid_task(pid, PIDTYPE_PID); + if (task) { + seq_printf(m, "(%s [%d]) ", + task->comm, task->pid); + put_task_struct(task); + } + } else + seq_puts(m, "(kernel) "); + describe_ctx(m, ctx); - if (ctx == dev_priv->kernel_context) - seq_printf(m, "(kernel context) "); if (i915.enable_execlists) { seq_putc(m, '\n');
Print the context's owner (via the pid under file_priv) under debugfs. Note that since this was originally introducing dev_priv->kernel_context, there are a couple of leftover minor chunks. 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 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)