Skip to contentSkip to conversation

use printk_ratelimit() inside DRM_DEBUG

PATCH In review Glauber de Oliveira Costa 2 participants 2 messages Nov 1, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use printk_ratelimit() inside DRM_DEBUG

the DRM_DEBUG macro can be called within functions very oftenly triggered, thus generating lots of message load and potentially compromising system

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
drivers/char/drm/drmP.h renamed from drivers/char/drm/drmP.h.orig +1 -1
@@ -185,7 +185,7 @@
 #if DRM_DEBUG_CODE
 #define DRM_DEBUG(fmt, arg...)						\
 	do {								\
-		if ( drm_debug )			\
+		if ( drm_debug && printk_ratelimit() )			\
 			printk(KERN_DEBUG				\
 			       "[" DRM_NAME ":%s] " fmt ,	\
 			       __FUNCTION__ , ##arg);			\
#1 lore raw
Quoted 16 lines · On Wed, 1 Nov 2006 10:50:51 -0300 Glauber de Oliveira Costa…

the DRM_DEBUG macro can be called within functions very oftenly triggered, thus generating lots of message load and potentially compromising system

Signature · 6 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"


[drm_debug.patch  text/plain (444B)]

drivers/char/drm/drmP.h line 191

Quoted 8 lines
drivers/char/drm/drmP.h renamed from drivers/char/drm/drmP.h.orig +1 -1
@@ -185,7 +185,7 @@
 #if DRM_DEBUG_CODE
 #define DRM_DEBUG(fmt, arg...)						\
 	do {								\
-		if ( drm_debug )			\
+		if ( drm_debug && printk_ratelimit() )			\
 			printk(KERN_DEBUG				\
 			       "[" DRM_NAME ":%s] " fmt ,	\
 			       __FUNCTION__ , ##arg);			\

DRM_DEBUG() should be disabled in production code, and enabled only when developers are developing stuff. In the latter case, the developer wants to see all the messages.

IOW, don't load the drm module with the `debug' parameter.