* [PATCH] drm: print the current->comm alongside the pid
@ 2020-05-18 8:33 Emil Velikov
2020-05-18 15:04 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Emil Velikov @ 2020-05-18 8:33 UTC (permalink / raw)
To: dri-devel; +Cc: Bob Beckett, Pekka Paalanen, Mauro Rossi, emil.l.velikov
From: Emil Velikov <emil.velikov@collabora.com>
The question of "what process is this pid" keeps on popping up, so lets
print the process name alongside the pid.
Cc: Mauro Rossi <issor.oruam@gmail.com>
Cc: Bob Beckett <bob.beckett@collabora.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
drivers/gpu/drm/drm_file.c | 7 ++++---
drivers/gpu/drm/drm_ioc32.c | 4 ++--
drivers/gpu/drm/drm_ioctl.c | 11 ++++++-----
3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index 7194e67e78bd..9b79bfc60ad7 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -253,8 +253,8 @@ void drm_file_free(struct drm_file *file)
dev = file->minor->dev;
- DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
- task_pid_nr(current),
+ DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, open_count=%d\n",
+ current->comm, task_pid_nr(current),
(long)old_encode_dev(file->minor->kdev->devt),
atomic_read(&dev->open_count));
@@ -345,7 +345,8 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
if (dev->switch_power_state != DRM_SWITCH_POWER_ON && dev->switch_power_state != DRM_SWITCH_POWER_DYNAMIC_OFF)
return -EINVAL;
- DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor->index);
+ DRM_DEBUG("comm=\"%s\", pid=%d, minor=%d\n", current->comm,
+ task_pid_nr(current), minor->index);
priv = drm_file_alloc(minor);
if (IS_ERR(priv))
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index 22c7fd7196c8..ff5d40036e21 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -985,8 +985,8 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (!fn)
return drm_ioctl(filp, cmd, arg);
- DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
- task_pid_nr(current),
+ DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, %s\n",
+ current->comm, task_pid_nr(current),
(long)old_encode_dev(file_priv->minor->kdev->devt),
file_priv->authenticated,
drm_compat_ioctls[nr].name);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 73e31dd4e442..b03c34fb4467 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -852,8 +852,8 @@ long drm_ioctl(struct file *filp,
out_size = 0;
ksize = max(max(in_size, out_size), drv_size);
- DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
- task_pid_nr(current),
+ DRM_DEBUG("comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n",
+ current->comm, task_pid_nr(current),
(long)old_encode_dev(file_priv->minor->kdev->devt),
file_priv->authenticated, ioctl->name);
@@ -890,15 +890,16 @@ long drm_ioctl(struct file *filp,
err_i1:
if (!ioctl)
- DRM_DEBUG("invalid ioctl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
- task_pid_nr(current),
+ DRM_DEBUG("invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
+ current->comm, task_pid_nr(current),
(long)old_encode_dev(file_priv->minor->kdev->devt),
file_priv->authenticated, cmd, nr);
if (kdata != stack_kdata)
kfree(kdata);
if (retcode)
- DRM_DEBUG("pid=%d, ret = %d\n", task_pid_nr(current), retcode);
+ DRM_DEBUG("comm=\"%s\", pid=%d, ret = %d\n", current->comm,
+ task_pid_nr(current), retcode);
return retcode;
}
EXPORT_SYMBOL(drm_ioctl);
--
2.25.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: print the current->comm alongside the pid
2020-05-18 8:33 [PATCH] drm: print the current->comm alongside the pid Emil Velikov
@ 2020-05-18 15:04 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2020-05-18 15:04 UTC (permalink / raw)
To: Emil Velikov; +Cc: Bob Beckett, Pekka Paalanen, Mauro Rossi, dri-devel
On Mon, May 18, 2020 at 09:33:15AM +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov@collabora.com>
>
> The question of "what process is this pid" keeps on popping up, so lets
> print the process name alongside the pid.
>
> Cc: Mauro Rossi <issor.oruam@gmail.com>
> Cc: Bob Beckett <bob.beckett@collabora.com>
> Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
> drivers/gpu/drm/drm_file.c | 7 ++++---
> drivers/gpu/drm/drm_ioc32.c | 4 ++--
> drivers/gpu/drm/drm_ioctl.c | 11 ++++++-----
> 3 files changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 7194e67e78bd..9b79bfc60ad7 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -253,8 +253,8 @@ void drm_file_free(struct drm_file *file)
>
> dev = file->minor->dev;
>
> - DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
> - task_pid_nr(current),
> + DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, open_count=%d\n",
> + current->comm, task_pid_nr(current),
> (long)old_encode_dev(file->minor->kdev->devt),
> atomic_read(&dev->open_count));
>
> @@ -345,7 +345,8 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
> if (dev->switch_power_state != DRM_SWITCH_POWER_ON && dev->switch_power_state != DRM_SWITCH_POWER_DYNAMIC_OFF)
> return -EINVAL;
>
> - DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor->index);
> + DRM_DEBUG("comm=\"%s\", pid=%d, minor=%d\n", current->comm,
> + task_pid_nr(current), minor->index);
>
> priv = drm_file_alloc(minor);
> if (IS_ERR(priv))
> diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
> index 22c7fd7196c8..ff5d40036e21 100644
> --- a/drivers/gpu/drm/drm_ioc32.c
> +++ b/drivers/gpu/drm/drm_ioc32.c
> @@ -985,8 +985,8 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> if (!fn)
> return drm_ioctl(filp, cmd, arg);
>
> - DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
> - task_pid_nr(current),
> + DRM_DEBUG("comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, %s\n",
> + current->comm, task_pid_nr(current),
> (long)old_encode_dev(file_priv->minor->kdev->devt),
> file_priv->authenticated,
> drm_compat_ioctls[nr].name);
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 73e31dd4e442..b03c34fb4467 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -852,8 +852,8 @@ long drm_ioctl(struct file *filp,
> out_size = 0;
> ksize = max(max(in_size, out_size), drv_size);
>
> - DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
> - task_pid_nr(current),
> + DRM_DEBUG("comm=\"%s\" pid=%d, dev=0x%lx, auth=%d, %s\n",
> + current->comm, task_pid_nr(current),
> (long)old_encode_dev(file_priv->minor->kdev->devt),
> file_priv->authenticated, ioctl->name);
>
> @@ -890,15 +890,16 @@ long drm_ioctl(struct file *filp,
>
> err_i1:
> if (!ioctl)
> - DRM_DEBUG("invalid ioctl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
> - task_pid_nr(current),
> + DRM_DEBUG("invalid ioctl: comm=\"%s\", pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n",
> + current->comm, task_pid_nr(current),
> (long)old_encode_dev(file_priv->minor->kdev->devt),
> file_priv->authenticated, cmd, nr);
>
> if (kdata != stack_kdata)
> kfree(kdata);
> if (retcode)
> - DRM_DEBUG("pid=%d, ret = %d\n", task_pid_nr(current), retcode);
> + DRM_DEBUG("comm=\"%s\", pid=%d, ret = %d\n", current->comm,
Nit: Since you adjust them all, also delete the spaces around the = here
in ret = %d. With that
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> + task_pid_nr(current), retcode);
> return retcode;
> }
> EXPORT_SYMBOL(drm_ioctl);
> --
> 2.25.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-18 15:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 8:33 [PATCH] drm: print the current->comm alongside the pid Emil Velikov
2020-05-18 15:04 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).