Skip to contentSkip to conversation

device-mapper: use dynamic debug instead of compile-time config option

PATCH Superseded Hannes Reinecke 3 participants 7 messages May 13, 2020 Device mapper

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device-mapper: use dynamic debug instead of compile-time config option

Switch to use dynamic debug to avoid having recompile the kernel just to enable debugging messages.

---
 include/linux/device-mapper.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
include/linux/device-mapper.h +1 -6
index e2d506dd805e..3d4365fd3001 100644
@@ -556,13 +556,8 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
 #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
 #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
 
-#ifdef CONFIG_DM_DEBUG
-#define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__)
+#define DMDEBUG(fmt, ...) pr_debug(DM_FMT(fmt), ##__VA_ARGS__)
 #define DMDEBUG_LIMIT(fmt, ...) pr_debug_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
-#else
-#define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
-#define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
-#endif
 
 #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
 			  0 : scnprintf(result + sz, maxlen - sz, x))
Signature · 1 line
2.25.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Hannes Reinecke

Switch to use dynamic debug to avoid having recompile the kernel just to enable debugging messages.

---
 include/linux/device-mapper.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
include/linux/device-mapper.h +0 -0
index e2d506dd805e..3d4365fd3001 100644

include/linux/device-mapper.h void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · line 559

Quoted 4 lines
include/linux/device-mapper.h +0 -1
@@ -556,13 +556,8 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
 #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
 #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
 
-#ifdef CONFIG_DM_DEBUG

Can we remove this from Kconfig as a config option ?

include/linux/device-mapper.h void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · line 563

Quoted 11 lines
include/linux/device-mapper.h +1 -5
-#define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__)
+#define DMDEBUG(fmt, ...) pr_debug(DM_FMT(fmt), ##__VA_ARGS__)
 #define DMDEBUG_LIMIT(fmt, ...) pr_debug_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
-#else
-#define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
-#define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
-#endif
 
 #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
 			  0 : scnprintf(result + sz, maxlen - sz, x))

Otherwise, looks good to me.

Signature · 2 lines
Damien Le Moal
Western Digital Research
#2 lore raw
Quoted 17 lines · Damien Le Moal
Quoted 16 lines · Hannes Reinecke

Switch to use dynamic debug to avoid having recompile the kernel just to enable debugging messages.

---
  include/linux/device-mapper.h | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
include/linux/device-mapper.h +0 -0
index e2d506dd805e..3d4365fd3001 100644
@@ -556,13 +556,8 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
  #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
  #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
 
Quoted 4 lines

include/linux/device-mapper.h void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · line 559

Quoted 1 line
include/linux/device-mapper.h +0 -1
-#ifdef CONFIG_DM_DEBUG

Can we remove this from Kconfig as a config option ?

No, we can't, it's being used by dm-snap and dm-integrity.

Cheers,

Hannes

Signature · 10 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
#3 lore raw
Quoted 21 lines · Hannes Reinecke
Quoted 9 lines · Damien Le Moal
Quoted 8 lines · Hannes Reinecke

Switch to use dynamic debug to avoid having recompile the kernel just to enable debugging messages.

---
 include/linux/device-mapper.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
Quoted 11 lines

include/linux/device-mapper.h void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · line 558

Quoted 8 lines
include/linux/device-mapper.h +0 -1
index e2d506dd805e..3d4365fd3001 100644
@@ -556,13 +556,8 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
 #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
 #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
-#ifdef CONFIG_DM_DEBUG

Can we remove this from Kconfig as a config option ?

Quoted 1 line

No, we can't, it's being used by dm-snap and dm-integrity.

Yeah, they provide additional debugging if its set.

But shouldn't we preserve old-style DMDEBUG if CONFIG_DM_DEBUG is set (compile time printing of debugging) but if not set, use dynamic debugging?

Think I'd prefer that as the incremental improvement... thoughts?

Mike

#4 lore raw
Quoted 26 lines · Mike Snitzer
Quoted 21 lines · Hannes Reinecke
Quoted 9 lines · Damien Le Moal
Quoted 8 lines · Hannes Reinecke

Switch to use dynamic debug to avoid having recompile the kernel just to enable debugging messages.

---
  include/linux/device-mapper.h | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
Quoted 11 lines

include/linux/device-mapper.h void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · line 558

Quoted 8 lines
include/linux/device-mapper.h +0 -1
index e2d506dd805e..3d4365fd3001 100644
@@ -556,13 +556,8 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
  #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
  #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
-#ifdef CONFIG_DM_DEBUG

Can we remove this from Kconfig as a config option ?

Quoted 1 line

No, we can't, it's being used by dm-snap and dm-integrity.

Quoted 8 lines

Yeah, they provide additional debugging if its set.

But shouldn't we preserve old-style DMDEBUG if CONFIG_DM_DEBUG is set (compile time printing of debugging) but if not set, use dynamic debugging?

Think I'd prefer that as the incremental improvement... thoughts?

Works for me; I just don't want to recompile the kernel anytime I need to debug device-mapper stuff.

Will be resending.

Cheers,

Hannes

Signature · 10 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
#5 lore raw
Quoted 33 lines · Hannes Reinecke
Quoted 32 lines · Mike Snitzer
Quoted 21 lines · Hannes Reinecke
Quoted 9 lines · Damien Le Moal
Quoted 8 lines · Hannes Reinecke

Switch to use dynamic debug to avoid having recompile the kernel just to enable debugging messages.

---
 include/linux/device-mapper.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
Quoted 11 lines

include/linux/device-mapper.h void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · line 558

Quoted 8 lines
include/linux/device-mapper.h +0 -1
index e2d506dd805e..3d4365fd3001 100644
@@ -556,13 +556,8 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
 #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
 #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
-#ifdef CONFIG_DM_DEBUG

Can we remove this from Kconfig as a config option ?

Quoted 1 line

No, we can't, it's being used by dm-snap and dm-integrity.

Yeah, they provide additional debugging if its set.

But shouldn't we preserve old-style DMDEBUG if CONFIG_DM_DEBUG is set (compile time printing of debugging) but if not set, use dynamic debugging?

Quoted 6 lines
Quoted 2 lines

Think I'd prefer that as the incremental improvement... thoughts?

Works for me; I just don't want to recompile the kernel anytime I need to debug device-mapper stuff.

Will be resending.

Does the use of pr_debug() cause missing newlines (with your patch)?

Only thought to ask this because I'm chasing another DM issue at the moment and happened to see __dm_suspend()'s use of pr_debug() includes an explicit extra \n.

Mike

#6 lore raw
Quoted 41 lines · Mike Snitzer
Quoted 38 lines · Hannes Reinecke
Quoted 26 lines · Mike Snitzer
Quoted 21 lines · Hannes Reinecke
Quoted 9 lines · Damien Le Moal
Quoted 8 lines · Hannes Reinecke

Switch to use dynamic debug to avoid having recompile the kernel just to enable debugging messages.

---
  include/linux/device-mapper.h | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
Quoted 11 lines

include/linux/device-mapper.h void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); · line 558

Quoted 8 lines
include/linux/device-mapper.h +0 -1
index e2d506dd805e..3d4365fd3001 100644
@@ -556,13 +556,8 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
  #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
  #define DMINFO_LIMIT(fmt, ...) pr_info_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
-#ifdef CONFIG_DM_DEBUG

Can we remove this from Kconfig as a config option ?

Quoted 1 line

No, we can't, it's being used by dm-snap and dm-integrity.

Quoted 8 lines

Yeah, they provide additional debugging if its set.

But shouldn't we preserve old-style DMDEBUG if CONFIG_DM_DEBUG is set (compile time printing of debugging) but if not set, use dynamic debugging?

Think I'd prefer that as the incremental improvement... thoughts?

Works for me; I just don't want to recompile the kernel anytime I need to debug device-mapper stuff.

Quoted 8 lines
Quoted 1 line

Will be resending.

Does the use of pr_debug() cause missing newlines (with your patch)?

Only thought to ask this because I'm chasing another DM issue at the moment and happened to see __dm_suspend()'s use of pr_debug() includes an explicit extra \n.

Hmm. Not that I've noticed; but yeah, typically one would have to add '\n' to any of the pr_XXX calls. But then it depends on the wrapper being used. I'll check.

Cheers,

Hannes

Signature · 10 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel