DEBUG_KOBJECT vs. DYNAMIC_PRINTK_DEBUG
Subsystems (2)
PATCH 1/1 DEBUG_KOBJECT vs. DYNAMIC_PRINTK_DEBUG
DEBUG_KOBJECT has no effect when DYNAMIC_PRINTK_DEBUG is set (and you can get the messages via that feature), so let's make it depend on !DYNAMIC_PRINTK_DEBUG.
--- lib/Kconfig.debug | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
lib/Kconfig.debug +1 -1
@@ -450,7 +450,7 @@ config STACKTRACE config DEBUG_KOBJECT bool "kobject debugging" - depends on DEBUG_KERNEL + depends on DEBUG_KERNEL && !DYNAMIC_PRINTK_DEBUG help If you say Y here, some extra kobject debugging messages will be sent to the syslog.
Quoted 4 lines · Cornelia Huck
DEBUG_KOBJECThas no effect whenDYNAMIC_PRINTK_DEBUGis set (and you can get the messages via that feature), so let's make it depend on !DYNAMIC_PRINTK_DEBUG.
indeed. you raise the more general question of what do if both 'DEBUG' and 'CONFIG_DYNAMIC_PRINTK_DEBUG' are set for a file? I think that in general the 'DEBUG' should take precedence, as you point out. However, I think we should fix this by reshuffling the logic in include/linux/kernel.h by doing:
if (DEBUG)
#define pr_debug printk elseif (CONFIG_DYNAMIC_PRINTK_DEBUG) #define pr_debug dynamic_pr_debug() else #define pr_debug if (0) blah:
endif
make sense? what do you think?
thanks,
-Jason
Quoted 7 lines · Jason Baron
indeed. you raise the more general question of what do if both 'DEBUG' and '
CONFIG_DYNAMIC_PRINTK_DEBUG' are set for a file? I think that in general the 'DEBUG' should take precedence, as you point out. However, I think we should fix this by reshuffling the logic ininclude/linux/kernel.hby doing:if (DEBUG)
Quoted 8 lines
#define pr_debug printk elseif (CONFIG_DYNAMIC_PRINTK_DEBUG) #define pr_debug dynamic_pr_debug() else #define pr_debug if (0) blah:endif
make sense? what do you think?
Yes, that makes sense, I agree. I'll follow up with a patch.
PATCH 1/1 Make DEBUG take precedence over DYNAMIC_PRINTK_DEBUG.
Statically defined DEBUG should take precedence over dynamically enabled debugging; otherwise adding DEBUG (like, for example, via CONFIG_DEBUG_KOBJECT) does not have the expected result of printing pr_debug() messages unconditionally.
--- include/linux/kernel.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/kernel.h +4 -4
@@ -338,13 +338,13 @@ static inline char *pack_hex_byte(char * printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)/* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG ) +#if defined(DEBUG ) +#define pr_debug (fmt, ...) \ + printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG )#define pr_debug (fmt, ...) do { \ dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ } while (0) -#elif defined(DEBUG ) -#define pr_debug (fmt, ...) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#else #define pr_debug (fmt, ...) \ ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
Re: [PATCH] Make DEBUG take precedence over DYNAMIC_PRINTK_DEBUG.
Quoted 21 lines · Cornelia Huck
Statically defined DEBUG should take precedence over dynamically enabled debugging; otherwise adding DEBUG (like, for example, via
CONFIG_DEBUG_KOBJECT) does not have the expected result of printingpr_debug()messages unconditionally.Signed-off-by Cornelia Huck <[email protected]>--- include/linux/kernel.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)include/linux/kernel.h +3
-1@@ -338,13 +338,13 @@ static inline char *pack_hex_byte(char * printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)/* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG ) +#if defined(DEBUG ) +#define pr_debug (fmt, ...) \ + printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
include/linux/kernel.h static inline char *pack_hex_byte(char * · line 350
Quoted 10 lines
include/linux/kernel.h +1
-3+#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG )#define pr_debug (fmt, ...) do { \ dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ } while (0) -#elif defined(DEBUG ) -#define pr_debug (fmt, ...) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#else #define pr_debug (fmt, ...) \ ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
looks good...if you want to also make the analogous change for 'dev_dbg()' in include/linux/device.h, I'll ack it.
thanks,
-Jason
PATCH 1/1 Make DEBUG take precedence over DYNAMIC_PRINTK_DEBUG (v2)
Statically defined DEBUG should take precedence over dynamically enabled debugging; otherwise adding DEBUG (like, for example, via CONFIG_DEBUG_KOBJECT) does not have the expected result of printing pr_debug() and dev_dbg() messages unconditionally.
--- include/linux/device.h | 8 ++++---- include/linux/kernel.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
include/linux/kernel.h +4 -4
@@ -338,13 +338,13 @@ static inline char *pack_hex_byte(char * printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)/* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG ) +#if defined(DEBUG ) +#define pr_debug (fmt, ...) \ + printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG )#define pr_debug (fmt, ...) do { \ dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ } while (0) -#elif defined(DEBUG ) -#define pr_debug (fmt, ...) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#else #define pr_debug (fmt, ...) \ ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
include/linux/device.h +4 -4
@@ -553,13 +553,13 @@ extern const char *dev_driver_string(con #define dev_info(dev, format, arg...) \ dev_printk(KERN_INFO , dev , format , ## arg) -#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG ) +#if defined(DEBUG ) +#define dev_dbg(dev, format, arg...) \ + dev_printk(KERN_DEBUG , dev , format , ## arg) +#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG )#define dev_dbg (dev, format, ...) do { \ dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ } while (0) -#elif defined(DEBUG ) -#define dev_dbg(dev, format, arg...) \ - dev_printk(KERN_DEBUG , dev , format , ## arg)#else #define dev_dbg(dev, format, arg...) \ ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
Re: [PATCH] Make DEBUG take precedence over DYNAMIC_PRINTK_DEBUG (v2)
Quoted 42 lines · Cornelia Huck
Statically defined DEBUG should take precedence over dynamically enabled debugging; otherwise adding DEBUG (like, for example, via
CONFIG_DEBUG_KOBJECT) does not have the expected result of printingpr_debug()anddev_dbg()messages unconditionally.Signed-off-by Cornelia Huck <[email protected]>--- include/linux/device.h | 8 ++++---- include/linux/kernel.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)include/linux/kernel.h +4
-4@@ -338,13 +338,13 @@ static inline char *pack_hex_byte(char * printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)/* If you are writing a driver, please use dev_dbg instead */ -#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG ) +#if defined(DEBUG ) +#define pr_debug (fmt, ...) \ + printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG )#define pr_debug (fmt, ...) do { \ dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ } while (0) -#elif defined(DEBUG ) -#define pr_debug (fmt, ...) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#else #define pr_debug (fmt, ...) \ ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })include/linux/device.h +3
-1@@ -553,13 +553,13 @@ extern const char *dev_driver_string(con #define dev_info(dev, format, arg...) \ dev_printk(KERN_INFO , dev , format , ## arg) -#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG ) +#if defined(DEBUG ) +#define dev_dbg(dev, format, arg...) \ + dev_printk(KERN_DEBUG , dev , format , ## arg)
include/linux/device.h extern const char *dev_driver_string(con · line 565
Quoted 10 lines
include/linux/device.h +1
-3+#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG )#define dev_dbg (dev, format, ...) do { \ dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ } while (0) -#elif defined(DEBUG ) -#define dev_dbg(dev, format, arg...) \ - dev_printk(KERN_DEBUG , dev , format , ## arg)#else #define dev_dbg(dev, format, arg...) \ ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
looks good.
thanks,
-Jason