Skip to contentSkip to conversation

drm: use trace_printk rather than printk in drm_dbg.

PATCH Superseded Fuqian Huang 2 participants 3 messages Jul 31, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 drivers/gpu/drm/drm_print.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_print.c +1 -1
index a17c8a14dba4..90cded140146 100644
@@ -236,7 +236,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	vaf.fmt = format;
 	vaf.va = &args;
 
-	printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
+	trace_printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
 	       __builtin_return_address(0), &vaf);
 
 	va_end(args);
Signature · 1 line
2.11.0
#1 lore raw
Quoted 10 lines · Fuqian Huang

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.

[]

drivers/gpu/drm/drm_print.c

Quoted 1 line
drivers/gpu/drm/drm_print.c +0 -0

[]

drivers/gpu/drm/drm_print.c void drm_dbg(unsigned int category, const char *format, ...) · line 242

Quoted 9 lines
drivers/gpu/drm/drm_print.c +1 -1
@@ -236,7 +236,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	vaf.fmt = format;
 	vaf.va = &args;
 
-	printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
+	trace_printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
 	       __builtin_return_address(0), &vaf);
 
 	va_end(args);

This makes all 4000+ drm_dbg/DRM_DEBUG uses emit
a trace_printk.

I suggest instead you make only the interrupt uses use a different function and not drm_dbg.

Or maybe add an in_interrupt() check like

	if (in_interrupt())
		printk(KERN_DEBUG etc...)
	else
		trace_printk(etc...)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Joe Perches <[email protected]> 於 2019年7月31日週三 下午2:06寫道:

Quoted 31 lines · Fuqian Huang
Quoted 10 lines

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.

[]

drivers/gpu/drm/drm_print.c

Quoted 1 line
drivers/gpu/drm/drm_print.c +0 -0

[]

drivers/gpu/drm/drm_print.c void drm_dbg(unsigned int category, const char *format, ...) · line 242

Quoted 9 lines
drivers/gpu/drm/drm_print.c +1 -1
@@ -236,7 +236,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
      vaf.fmt = format;
      vaf.va = &args;
 
-     printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
+     trace_printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
             __builtin_return_address(0), &vaf);
 
      va_end(args);

This makes all 4000+ drm_dbg/DRM_DEBUG uses emit
a trace_printk.

I suggest instead you make only the interrupt uses use a different function and not drm_dbg.

Quoted 6 lines

Or maybe add an in_interrupt() check like

        if (in_interrupt())
                printk(KERN_DEBUG etc...)
        else
                trace_printk(etc...)

I will send a v2 patch to fix this.