* [PATCH] drm: Print pid in drm log
@ 2015-12-18 22:11 Harry Wentland
2015-12-21 8:59 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Harry Wentland @ 2015-12-18 22:11 UTC (permalink / raw)
To: dri-devel; +Cc: Andrey Grodzovsky
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Add task ids to all DRM prints so it is easier to resolve
concurency issues and understand the logic.
Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
---
drivers/gpu/drm/drm_drv.c | 16 +++++++++++++---
include/drm/drmP.h | 6 ++++--
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7dd6728dd092..7b17a9ae0b07 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -55,6 +55,16 @@ static struct idr drm_minors_idr;
static struct dentry *drm_debugfs_root;
+pid_t get_my_pid(void) {
+
+ if (!in_interrupt())
+ return current->pid;
+
+ return 0;
+}
+
+EXPORT_SYMBOL(get_my_pid);
+
void drm_err(const char *format, ...)
{
struct va_format vaf;
@@ -65,8 +75,8 @@ void drm_err(const char *format, ...)
vaf.fmt = format;
vaf.va = &args;
- printk(KERN_ERR "[" DRM_NAME ":%ps] *ERROR* %pV",
- __builtin_return_address(0), &vaf);
+ printk(KERN_ERR "[%u][" DRM_NAME ":%ps] *ERROR* %pV",
+ get_my_pid(),__builtin_return_address(0), &vaf);
va_end(args);
}
@@ -81,7 +91,7 @@ void drm_ut_debug_printk(const char *function_name, const char *format, ...)
vaf.fmt = format;
vaf.va = &args;
- printk(KERN_DEBUG "[" DRM_NAME ":%s] %pV", function_name, &vaf);
+ printk(KERN_DEBUG "[%u][" DRM_NAME ":%s] %pV",get_my_pid(), function_name, &vaf);
va_end(args);
}
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 5531d7bbe851..4b17f890ca14 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -183,11 +183,13 @@ void drm_err(const char *format, ...);
drm_err(fmt, ##__VA_ARGS__); \
})
+pid_t get_my_pid(void);
+
#define DRM_INFO(fmt, ...) \
- printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
+ printk(KERN_INFO "[%u][" DRM_NAME "] " fmt,get_my_pid(), ##__VA_ARGS__)
#define DRM_INFO_ONCE(fmt, ...) \
- printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
+ printk_once(KERN_INFO "[%u][" DRM_NAME "] " fmt,get_my_pid(), ##__VA_ARGS__)
/**
* Debug output.
--
2.1.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: Print pid in drm log
2015-12-18 22:11 [PATCH] drm: Print pid in drm log Harry Wentland
@ 2015-12-21 8:59 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2015-12-21 8:59 UTC (permalink / raw)
To: Harry Wentland; +Cc: Andrey Grodzovsky, dri-devel
On Fri, Dec 18, 2015 at 05:11:45PM -0500, Harry Wentland wrote:
> From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
>
> Add task ids to all DRM prints so it is easier to resolve
> concurency issues and understand the logic.
>
> Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Not sure pid is all that useful, so next patch will add comm and then
more. I think it'd be better to instead have a Kconfig option to convert
drm debug noise over to dynamic printk subsystem, iirc that has tons of
features and hopefully should cover this. If it's doesn't then
trace_printk will give you very nice profiles (again with a compile
option).
Cheers, Daniel
> ---
> drivers/gpu/drm/drm_drv.c | 16 +++++++++++++---
> include/drm/drmP.h | 6 ++++--
> 2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 7dd6728dd092..7b17a9ae0b07 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -55,6 +55,16 @@ static struct idr drm_minors_idr;
>
> static struct dentry *drm_debugfs_root;
>
> +pid_t get_my_pid(void) {
> +
> + if (!in_interrupt())
> + return current->pid;
> +
> + return 0;
> +}
> +
> +EXPORT_SYMBOL(get_my_pid);
> +
> void drm_err(const char *format, ...)
> {
> struct va_format vaf;
> @@ -65,8 +75,8 @@ void drm_err(const char *format, ...)
> vaf.fmt = format;
> vaf.va = &args;
>
> - printk(KERN_ERR "[" DRM_NAME ":%ps] *ERROR* %pV",
> - __builtin_return_address(0), &vaf);
> + printk(KERN_ERR "[%u][" DRM_NAME ":%ps] *ERROR* %pV",
> + get_my_pid(),__builtin_return_address(0), &vaf);
>
> va_end(args);
> }
> @@ -81,7 +91,7 @@ void drm_ut_debug_printk(const char *function_name, const char *format, ...)
> vaf.fmt = format;
> vaf.va = &args;
>
> - printk(KERN_DEBUG "[" DRM_NAME ":%s] %pV", function_name, &vaf);
> + printk(KERN_DEBUG "[%u][" DRM_NAME ":%s] %pV",get_my_pid(), function_name, &vaf);
>
> va_end(args);
> }
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 5531d7bbe851..4b17f890ca14 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -183,11 +183,13 @@ void drm_err(const char *format, ...);
> drm_err(fmt, ##__VA_ARGS__); \
> })
>
> +pid_t get_my_pid(void);
> +
> #define DRM_INFO(fmt, ...) \
> - printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> + printk(KERN_INFO "[%u][" DRM_NAME "] " fmt,get_my_pid(), ##__VA_ARGS__)
>
> #define DRM_INFO_ONCE(fmt, ...) \
> - printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> + printk_once(KERN_INFO "[%u][" DRM_NAME "] " fmt,get_my_pid(), ##__VA_ARGS__)
>
> /**
> * Debug output.
> --
> 2.1.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://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
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-21 8:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18 22:11 [PATCH] drm: Print pid in drm log Harry Wentland
2015-12-21 8:59 ` Daniel Vetter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.