[PATCH] drm: Include task->name and master status in debugfs clients info
David Herrmann
dh.herrmann at gmail.com
Mon Sep 1 07:11:43 PDT 2014
Hi
On Sat, Aug 9, 2014 at 8:22 AM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Showing who is the current master is useful for trying to decypher
> errors when trying to acquire master (e.g. a race with X taking over
> from plymouth). By including the process name as well as the pid
> simplifies the task of grabbing enough information remotely at the point
> of error.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/drm_info.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
> index 15ec9f4..d813430 100644
> --- a/drivers/gpu/drm/drm_info.c
> +++ b/drivers/gpu/drm/drm_info.c
> @@ -184,14 +184,21 @@ int drm_clients_info(struct seq_file *m, void *data)
> struct drm_file *priv;
>
> mutex_lock(&dev->struct_mutex);
> - seq_printf(m, "a dev pid uid magic\n\n");
> - list_for_each_entry(priv, &dev->filelist, lhead) {
> - seq_printf(m, "%c %3d %5d %5d %10u\n",
> - priv->authenticated ? 'y' : 'n',
> - priv->minor->index,
> + seq_printf(m, " pid dev master a uid magic\n");
Maybe mention "task" here? Or is this supposed to be a logical part of "pid"?
> + list_for_each_entry_reverse(priv, &dev->filelist, lhead) {
No idea why you do backwards traversal, but ok..
> + struct task_struct *task;
> +
> + rcu_read_lock();
What's that rcu-lock for? task->comm is pre-allocated, priv->pid is
static, kuid... no idea?
Anyway, patch looks good otherwise. Especially task->comm sounds
really handy in that list.
Thanks
David
> + task = pid_task(priv->pid, PIDTYPE_PID);
> + seq_printf(m, "%20s %5d %3d %c %c %5d %10u\n",
> + task ? task->comm : "<unknown>",
> pid_vnr(priv->pid),
> + priv->minor->index,
> + priv->is_master ? 'y' : 'n',
> + priv->authenticated ? 'y' : 'n',
> from_kuid_munged(seq_user_ns(m), priv->uid),
> priv->magic);
> + rcu_read_unlock();
> }
> mutex_unlock(&dev->struct_mutex);
> return 0;
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list