drm: use trace_printk rather than printk in drm_dbg.
Subsystems (2)
PATCH v2 1/1 drm: use trace_printk rather than printk in drm_dbg.
In drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c, amdgpu_ih_process calls DRM_DEBUG which calls drm_dbg and finally calls printk.
As amdgpu_ih_process is called from an interrupt handler, and interrupt handler should be short as possible.
As printk may lead to bogging down the system or can even create a live lock. printk should not be used in IRQ context. Instead, trace_printk is recommended in IRQ context.
---
Changes in v2:
- Only make the interrupt uses the trace_printk to avoid all 4000+ drm_dbg/DRM_DEBUG uses emitting a trace_printk.
drivers/gpu/drm/drm_print.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_print.c +7 -3
@@ -236,9 +236,13 @@ void drm_dbg(unsigned int category, const char *format, ...) vaf.fmt = format; vaf.va = &args; -printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , -__builtin_return_address (0 ), &vaf); - +if (in_interrupt ()) { +trace_printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }else { +printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }va_end (args); }EXPORT_SYMBOL (drm_dbg);
Signature · 1 line
2.11.0
Quoted 6 lines · Fuqian Huang
In
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c,amdgpu_ih_processcallsDRM_DEBUGwhich callsdrm_dbgand finally calls printk.
Asamdgpu_ih_processis called from an interrupt handler, and interrupt handler should be short as possible.
Quoted 6 lines
As printk may lead to bogging down the system or can even create a live lock. printk should not be used in IRQ context. Instead,
trace_printkis recommended in IRQ context.Reviewed-by Joe Perches <[email protected]>
I made a suggestion. I did not review this.
Please do not add signatures like this if
not specifically given by someone.
Quoted 30 lines
Signed-off-by Fuqian Huang <[email protected]>---
Changes in v2:
- Only make the interrupt uses thetrace_printkto avoid all 4000+ drm_dbg/DRM_DEBUG uses emitting atrace_printk.drivers/gpu/drm/drm_print.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_print.c +7
-3@@ -236,9 +236,13 @@ void drm_dbg(unsigned int category, const char *format, ...) vaf.fmt = format; vaf.va = &args; -printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , -__builtin_return_address (0 ), &vaf); - +if (in_interrupt ()) { +trace_printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }else { +printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }va_end (args); }EXPORT_SYMBOL (drm_dbg);
Quoted 12 lines · Joe Perches
Quoted 11 lines · Fuqian Huang
In
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c,amdgpu_ih_processcallsDRM_DEBUGwhich callsdrm_dbgand finally calls printk.
Asamdgpu_ih_processis called from an interrupt handler, and interrupt handler should be short as possible.As printk may lead to bogging down the system or can even create a live lock. printk should not be used in IRQ context. Instead,
trace_printkis recommended in IRQ context.
Quoted 6 lines
Quoted 1 line
Reviewed-by Joe Perches <[email protected]>I made a suggestion. I did not review this.
Please do not add signatures like this if
not specifically given by someone.
+1
Quoted 6 lines
Quoted 6 lines
Signed-off-by Fuqian Huang <[email protected]>---
Changes in v2:
- Only make the interrupt uses thetrace_printkto avoid all 4000+ drm_dbg/DRM_DEBUG uses emitting atrace_printk.
Quoted 8 lines
drivers/gpu/drm/drm_print.c void drm_dbg(unsigned int category, const char *format, ...)
Quoted 8 lines
drivers/gpu/drm/drm_print.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_print.c +0
-0@@ -236,9 +236,13 @@ void drm_dbg(unsigned int category, const char *format, ...)
Right above here is a check for drm_debug, which defaults to off, so in production this all has 0 impact. But changing all the debug output from dmesg to tracing is sure to break everyone's CI and test setups.
I'm all for cleaning up the drm logging stuff (it's a real mess), but it's a very delicate house of cards and with thousands of users, not easy to change. Unfortunately I don't really have a solid recommendation for what the ideal drm logging should look like. Plus we already have a pile of competing approaches ...
-Daniel
Quoted 17 lines
Quoted 16 lines
drivers/gpu/drm/drm_print.c +7
-3vaf.fmt = format; vaf.va = &args; -printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , -__builtin_return_address (0 ), &vaf); - +if (in_interrupt ()) { +trace_printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }else { +printk (KERN_DEBUG "[" DRM_NAME ":%ps] %pV" , +__builtin_return_address (0 ), &vaf); + }va_end (args); }EXPORT_SYMBOL (drm_dbg);
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch