debug_hex_dump()
Subsystems (7)
Following discussion on linux-wireless,
I separated dynamic hex dump into stand alone patch.
Please review and comment.
Vladimir Kondratiev (1):
dynamic_debug: introduce debug_hex_dump()
Documentation/dynamic-debug-howto.txt | 9 +++++++-- include/linux/dynamic_debug.h | 10 ++++++++++ include/linux/printk.h | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
RFC 1/1 dynamic_debug: introduce debug_hex_dump()
Introduce debug_hex_dump() that can be dynamically controlled, similar to pr_debug.
Implement only 'p' flag (_DPRINTK_FLAGS_PRINT) to keep it simple since hex dump prints multiple lines and long prefix would impact readability.
To provide line/file etc. information, use pr_debug or similar before/after debug_hex_dump()
--- Documentation/dynamic-debug-howto.txt | 9 +++++++-- include/linux/dynamic_debug.h | 10 ++++++++++ include/linux/printk.h | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-)
Documentation/dynamic-debug-howto.txt +7 -2
@@ -6,8 +6,11 @@ This document describes how to use the dynamic debug (dyndbg) feature. Dynamic debug is designed to allow you to dynamically enable/disable kernel code to obtain additional kernel information. Currently, if -CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() calls can -be dynamically enabled per-callsite. +CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() and +debug_hex_dump() calls can be dynamically enabled per-callsite. + +If CONFIG_DYNAMIC_DEBUG is not set, debug_hex_dump() is just shortcut +for print_hex_dump(KERN_DEBUG). Dynamic debug has even more useful features:
@@ -202,6 +205,8 @@ The flags are: t Include thread ID in messages not generated from interrupt context _ No flags are set. (Or'd with others on input) +For debug_hex_dump(), only 'p' flag have meaning, other flags ignored. + For display, the flags are preceded by '=' (mnemonic: what the flags are currently equal to).
include/linux/dynamic_debug.h +10 -0
@@ -95,6 +95,16 @@ do { \ ##__VA_ARGS__); \ } while (0) +#define dynamic_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, prefix_str); \ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) +#else #include <linux/string.h>
include/linux/printk.h +14 -0
@@ -220,6 +220,20 @@ extern void dump_stack(void) __cold; no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#endif +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type,\ + rowsize, groupsize, buf,\ + len, ascii) +#else +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif +/* * Print a one-time message (analogous to WARN_ONCE() et al): */
Signature · 1 line
1.7.10.4
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 2 lines · Vladimir Kondratiev
Introduce
debug_hex_dump()that can be dynamically controlled, similar topr_debug.
(added Jason Baron, Jim Cromie, GregKH and lkml to cc's)
[]
include/linux/printk.h
Quoted 1 line
include/linux/printk.h +0
-0
[]
Quoted 7 lines
include/linux/printk.h +3
-0@@ -220,6 +220,20 @@ extern void dump_stack(void) __cold; no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#endifD +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \
include/linux/printk.h extern void dump_stack(void) __cold; · line 235
Quoted 10 lines
include/linux/printk.h +10
-0+dynamic_hex_dump (prefix_str, prefix_type,\ + rowsize, groupsize, buf,\ + len, ascii) +#else +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif
These should be in a different location after print_hex_dump is declared. Also for #defines, the indentation doesn't need to be so deep.
#if defined(CONFIG_DYNAMIC_DEBUG)
#define debug_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ dynamic_hex_dump(prefix_str, prefix_type, \ rowsize, groupsize, buf, len, ascii) #else #define debug_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \ rowsize, groupsize, buf, len, ascii)
#endif
A better option might be to convert print_hex_dump_bytes() to dynamic_debug as that's already KERN_DEBUG. That could be simpler overall and it makes existing calls become dynamic as well.
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 27 lines · Joe Perches
Quoted 2 lines · Vladimir Kondratiev
Introduce
debug_hex_dump()that can be dynamically controlled, similar topr_debug.(added Jason Baron, Jim Cromie, GregKH and lkml to cc's)
[]
include/linux/printk.h
Quoted 1 line
include/linux/printk.h +0
-0[]
Quoted 15 lines
include/linux/printk.h +9
-0@@ -220,6 +220,20 @@ extern void dump_stack(void) __cold; no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)#endifD +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type,\ + rowsize, groupsize, buf,\ + len, ascii) +#else +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \
Quoted 8 lines
include/linux/printk.h extern void dump_stack(void) __cold; · line 237
Quoted 4 lines
include/linux/printk.h +4
-0+print_hex_dump (KERN_DEBUG , prefix_str, \ + prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif These should be in a different location after
print_hex_dumpis declared. Also for #defines, the indentation doesn't need to be so deep.
Ups, correct.
Quoted 11 lines
#if
defined(CONFIG_DYNAMIC_DEBUG)#define debug_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ dynamic_hex_dump(prefix_str, prefix_type, \ rowsize, groupsize, buf, len, ascii) #else #define debug_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \ rowsize, groupsize, buf, len, ascii)
Quoted 6 lines
#endif
A better option might be to convert
print_hex_dump_bytes()todynamic_debugas that's alreadyKERN_DEBUG. That could be simpler overall and it makes existing calls become dynamic as well.
And, here it goes (can I call it PATCH?):
Quoted 1 line
From
755b74861b66435bfe4875b64a53c45bbe172495Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Wed, 14 Nov 2012 18:14:15 +0200
Subject: [PATCH] dynamic_debug: dynamic hex dump
Introduce debug_hex_dump() that can be dynamically controlled, similar to pr_debug.
Also, make print_hex_dump_bytes() dynamically controlled
Implement only 'p' flag (_DPRINTK_FLAGS_PRINT) to keep it simple since hex dump prints multiple lines and long prefix would impact readability.
To provide line/file etc. information, use pr_debug or similar before/after debug_hex_dump()
--- Documentation/dynamic-debug-howto.txt | 11 +++++++++-- include/linux/dynamic_debug.h | 10 ++++++++++ include/linux/printk.h | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-)
Documentation/dynamic-debug-howto.txt +9 -2
@@ -6,8 +6,12 @@ This document describes how to use the dynamic debug (dyndbg) feature. Dynamic debug is designed to allow you to dynamically enable/disable kernel code to obtain additional kernel information. Currently, if -CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() calls can -be dynamically enabled per-callsite. +CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() and +debug_hex_dump()/print_hex_dump_bytes() calls can be dynamically +enabled per-callsite. + +If CONFIG_DYNAMIC_DEBUG is not set, debug_hex_dump() is just shortcut +for print_hex_dump(KERN_DEBUG). Dynamic debug has even more useful features:
@@ -202,6 +206,9 @@ The flags are: t Include thread ID in messages not generated from interrupt context _ No flags are set. (Or'd with others on input) +For debug_hex_dump() and print_hex_dump_bytes(), only 'p' flag have meaning, +other flags ignored. + For display, the flags are preceded by '=' (mnemonic: what the flags are currently equal to).
include/linux/dynamic_debug.h +10 -0
@@ -95,6 +95,16 @@ do { \ ##__VA_ARGS__); \ } while (0) +#define dynamic_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, prefix_str); \ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) +#else #include <linux/string.h>
include/linux/printk.h +17 -0
@@ -321,8 +321,13 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,extern void print_hex_dump (const char *level,const char *prefix_str,int prefix_type,int rowsize,int groupsize,const void *buf,size_t len,bool ascii); +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \ + dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) +#else extern void print_hex_dump_bytes (const char *prefix_str,int prefix_type,const void *buf,size_t len); +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ #else static inline void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize,
@@ -336,4 +341,16 @@ static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,#endif +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#else +#define debug_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ +#endif
Signature · 1 line
1.7.10.4
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 1 line · Vladimir Kondratiev
And, here it goes (can I call it PATCH?):
Don't see why not.
Quoted 1 line
From: Vladimir Kondratiev <[email protected]>
[]
Quoted 4 lines
Introduce
debug_hex_dump()that can be dynamically controlled, similar topr_debug.Also, make
print_hex_dump_bytes()dynamically controlled
print_hex_dump_debug might be a better name than debug_hex_dump because it's more similar to the other print_hex_dump<_foo> names.
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 8 lines · Joe Perches
Quoted 1 line · Vladimir Kondratiev
And, here it goes (can I call it PATCH?):
Don't see why not.
Quoted 1 line
From: Vladimir Kondratiev <[email protected]>
[]
Quoted 8 lines
Quoted 4 lines
Introduce
debug_hex_dump()that can be dynamically controlled, similar topr_debug.Also, make
print_hex_dump_bytes()dynamically controlled
print_hex_dump_debugmight be a better name thandebug_hex_dumpbecause it's more similar to the other print_hex_dump<_foo> names.
Well, let it be:
Quoted 1 line
From
5c9a79ea32e300f9a228d659f325e30d450b57c1Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Wed, 14 Nov 2012 19:24:51 +0200
Subject: [PATCH] dynamic_debug: dynamic hex dump
Introduce print_hex_dump_debug() that can be dynamically controlled, similar to pr_debug.
Also, make print_hex_dump_bytes() dynamically controlled
Implement only 'p' flag (_DPRINTK_FLAGS_PRINT) to keep it simple since hex dump prints multiple lines and long prefix would impact readability.
To provide line/file etc. information, use pr_debug or similar before/after print_hex_dump_debug()
--- Documentation/dynamic-debug-howto.txt | 11 +++++++++-- include/linux/dynamic_debug.h | 10 ++++++++++ include/linux/printk.h | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-)
Documentation/dynamic-debug-howto.txt +9 -2
@@ -6,8 +6,12 @@ This document describes how to use the dynamic debug (dyndbg) feature. Dynamic debug is designed to allow you to dynamically enable/disable kernel code to obtain additional kernel information. Currently, if -CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() calls can -be dynamically enabled per-callsite. +CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() and +print_hex_dump_debug()/print_hex_dump_bytes() calls can be dynamically +enabled per-callsite. + +If CONFIG_DYNAMIC_DEBUG is not set, print_hex_dump_debug() is just +shortcut for print_hex_dump(KERN_DEBUG). Dynamic debug has even more useful features:
@@ -202,6 +206,9 @@ The flags are: t Include thread ID in messages not generated from interrupt context _ No flags are set. (Or'd with others on input) +For print_hex_dump_debug() and print_hex_dump_bytes(), only 'p' flag +have meaning, other flags ignored. + For display, the flags are preceded by '=' (mnemonic: what the flags are currently equal to).
include/linux/dynamic_debug.h +10 -0
@@ -95,6 +95,16 @@ do { \ ##__VA_ARGS__); \ } while (0) +#define dynamic_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, prefix_str); \ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) +#else #include <linux/string.h>
include/linux/printk.h +17 -0
@@ -321,8 +321,13 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,extern void print_hex_dump (const char *level,const char *prefix_str,int prefix_type,int rowsize,int groupsize,const void *buf,size_t len,bool ascii); +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \ + dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) +#else extern void print_hex_dump_bytes (const char *prefix_str,int prefix_type,const void *buf,size_t len); +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ #else static inline void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize,
@@ -336,4 +341,16 @@ static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,#endif +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#else +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ +#endif
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): 3304277.iqgq3GH3Yo@lx-vladimir
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 50 lines · Vladimir Kondratiev
include/linux/dynamic_debug.h do { \ · line 106
Quoted 9 lines · Vladimir Kondratiev
include/linux/dynamic_debug.h +9
-0+#define dynamic_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, prefix_str); \ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0)There is some problem with the code above. There are existing drivers that use
print_hex_dump_bytes()with theprefix_strbuilt dynamically, like this (seedrivers/tty/ipwireless/hardware.c:362)static void dump_data_bytes(const char *type, const unsigned char *data,
unsigned length){ char prefix[56]; sprintf(prefix, IPWIRELESS_PCCARD_NAME ": %s %s ", type, data_type(data, length)); print_hex_dump_bytes(prefix, 0, (void *)data, length < DUMP_MAX_BYTES ? length : DUMP_MAX_BYTES); }In this case,
prefix_stris not constant, and this solution will not work.I see 2 drivers that use dynamic prefix:
- mentioned above
drivers/tty/ipwireless/hardware.c
-drivers/isdn/hardware/mISDN/I see several options:
1) require
prefix_strto be constant. Patch code mentioned. For example, code above may reads:static void dump_data_bytes(const char *type, const unsigned char *data,
unsigned length){ pr_debug(IPWIRELESS_PCCARD_NAME ": %s %s\n", type, data_type(data, length)); print_hex_dump_bytes(IPWIRELESS_PCCARD_NAME, 0, (void *)data, length < DUMP_MAX_BYTES ? length : DUMP_MAX_BYTES); }2) introduce fixed format string in
DEFINE_DYNAMIC_DEBUG_METADATA, like
Quoted 7 lines
DEFINE_DYNAMIC_DEBUG_METADATA((descriptor, "hexdump");
3) remove
print_hex_dump_bytesfrom this patchI think 1) is the best, opinions?
Thanks, Vladimir
In case of option 1), patches follows. Note there is change in the initial patch as well (I forgot to exclude print_hex_dump_bytes() from compilation in hexdump.c. Please, comment.
PATCH 1/2 dynamic_debug: dynamic hex dump
Quoted 1 line
From
26bb3835fe438622d108716420c3cc191f2e881bMon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Sun, 18 Nov 2012 15:37:20 +0200
Subject: [PATCH 1/2] dynamic_debug: dynamic hex dump
Introduce print_hex_dump_debug() that can be dynamically controlled, similar to pr_debug.
Also, make print_hex_dump_bytes() dynamically controlled
Implement only 'p' flag (_DPRINTK_FLAGS_PRINT) to keep it simple since hex dump prints multiple lines and long prefix would impact readability.
To provide line/file etc. information, use pr_debug or similar before/after print_hex_dump_debug()
--- Documentation/dynamic-debug-howto.txt | 11 +++++++++-- include/linux/dynamic_debug.h | 10 ++++++++++ include/linux/printk.h | 17 +++++++++++++++++ lib/hexdump.c | 4 +++- 4 files changed, 39 insertions(+), 3 deletions(-)
Documentation/dynamic-debug-howto.txt +9 -2
@@ -6,8 +6,12 @@ This document describes how to use the dynamic debug (dyndbg) feature. Dynamic debug is designed to allow you to dynamically enable/disable kernel code to obtain additional kernel information. Currently, if -CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() calls can -be dynamically enabled per-callsite. +CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() and +print_hex_dump_debug()/print_hex_dump_bytes() calls can be dynamically +enabled per-callsite. + +If CONFIG_DYNAMIC_DEBUG is not set, print_hex_dump_debug() is just +shortcut for print_hex_dump(KERN_DEBUG). Dynamic debug has even more useful features:
@@ -202,6 +206,9 @@ The flags are: t Include thread ID in messages not generated from interrupt context _ No flags are set. (Or'd with others on input) +For print_hex_dump_debug() and print_hex_dump_bytes(), only 'p' flag +have meaning, other flags ignored. + For display, the flags are preceded by '=' (mnemonic: what the flags are currently equal to).
include/linux/dynamic_debug.h +10 -0
@@ -95,6 +95,16 @@ do { \ ##__VA_ARGS__); \ } while (0) +#define dynamic_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, prefix_str); \ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) +#else #include <linux/string.h>
include/linux/printk.h +17 -0
@@ -321,8 +321,13 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,extern void print_hex_dump (const char *level,const char *prefix_str,int prefix_type,int rowsize,int groupsize,const void *buf,size_t len,bool ascii); +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \ + dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) +#else extern void print_hex_dump_bytes (const char *prefix_str,int prefix_type,const void *buf,size_t len); +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ #else static inline void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize,
@@ -336,4 +341,16 @@ static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,#endif +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#else +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ +#endif
lib/hexdump.c +3 -1
@@ -227,6 +227,7 @@ void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, }EXPORT_SYMBOL (print_hex_dump); +#if !defined(CONFIG_DYNAMIC_DEBUG )/** * print_hex_dump_bytes - shorthand form of print_hex_dump() with default params * @prefix_str: string to prefix each line with;
@@ -246,4 +247,5 @@ void print_hex_dump_bytes(const char *prefix_str, int prefix_type, buf, len, true); }EXPORT_SYMBOL (print_hex_dump_bytes); -#endif +#endif /* !defined(CONFIG_DYNAMIC_DEBUG) */ +#endif /* defined(CONFIG_PRINTK) */
Signature · 1 line
1.7.10.4
PATCH 2/2 dynamic_debug: use constant format in print_hex_dump_bytes()
In reply to Vladimir KondratievQuoted 1 line
From
cff77ecaa9a1f875327a0530f0ebc7998427bbf4Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Sun, 18 Nov 2012 15:47:09 +0200
Subject: [PATCH 2/2] dynamic_debug: use constant format in
print_hex_dump_bytes()
In order to convert print_hex_dump_bytes() to dynamic debug, it should be wrapped in macro (DEFINE_DYNAMIC_DEBUG_METADATA) to define metadata. This, in turn, require 'format' to be constant string. For practical purposes, it is reasonable to use as 'format' the 'prefix_str' argument for the print_hex_dump_bytes()
This patch fixes usage of dynamically generated prefixes. General approach is to print desired prefix using pr_debug(), following with hex dump using "short" prefix string. This will preserve desired information with little impact on readability.
In fact, result should be even better for human, albeit it may break automatic log parser, should it be based on prefix string.
--- drivers/isdn/hardware/mISDN/avmfritz.c | 12 ++++-------- drivers/isdn/hardware/mISDN/mISDNipac.c | 22 ++++++++-------------- drivers/isdn/hardware/mISDN/netjet.c | 16 ++++++---------- drivers/isdn/hardware/mISDN/w6692.c | 19 ++++++++----------- drivers/net/wireless/ath/ath6kl/debug.c | 3 ++- drivers/net/wireless/libertas_tf/deb_defs.h | 6 ++---- drivers/tty/ipwireless/hardware.c | 9 ++++----- 7 files changed, 34 insertions(+), 53 deletions(-)
drivers/isdn/hardware/mISDN/avmfritz.c +4 -8
@@ -104,7 +104,6 @@ enum {#define AVM_ISACX_DATA 0x08/* data struct */ -#define LOG_SIZE 63struct hdlc_stat_reg {#ifdef __BIG_ENDIAN
@@ -141,7 +140,6 @@ struct fritzcard {struct isac_hw isac;struct hdlc_hw hdlc[2 ];struct bchannel bch[2 ]; -char log[LOG_SIZE +1 ]; };static LIST_HEAD (Cards);
@@ -438,9 +436,8 @@ hdlc_empty_fifo(struct bchannel *bch, int count) cnt +=4 ; }if (p && (debug &DEBUG_HW_BFIFO )) { -snprintf (fc->log,LOG_SIZE ,"B%1d-recv %s %d " , - bch->nr, fc->name, count); -print_hex_dump_bytes (fc->log,DUMP_PREFIX_OFFSET , p, count); +pr_debug ("B%1d-recv %s %d\n" , bch->nr, fc->name, count); +print_hex_dump_bytes ("recv" ,DUMP_PREFIX_OFFSET , p, count); } }
@@ -509,9 +506,8 @@ hdlc_fill_fifo(struct bchannel *bch) } }if ((debug &DEBUG_HW_BFIFO ) && !fillempty) { -snprintf (fc->log,LOG_SIZE ,"B%1d-send %s %d " , - bch->nr, fc->name, count); -print_hex_dump_bytes (fc->log,DUMP_PREFIX_OFFSET , p, count); +pr_debug ("B%1d-send %s %d\n" , bch->nr, fc->name, count); +print_hex_dump_bytes ("send" ,DUMP_PREFIX_OFFSET , p, count); } }
drivers/isdn/hardware/mISDN/mISDNipac.c +8 -14
@@ -137,11 +137,8 @@ isac_empty_fifo(struct isac_hw *isac, int count) isac->read_fifo (isac->dch.hw, isac->off, ptr, count);WriteISAC (isac,ISAC_CMDR ,0x80 );if (isac->dch.debug &DEBUG_HW_DFIFO ) { -char pfx[MISDN_MAX_IDLEN +16 ]; - -snprintf (pfx,MISDN_MAX_IDLEN +15 ,"D-recv %s %d " , - isac->name, count); -print_hex_dump_bytes (pfx,DUMP_PREFIX_OFFSET , ptr, count); +pr_debug ("D-recv %s %d\n" , isac->name, count); +print_hex_dump_bytes ("recv" ,DUMP_PREFIX_OFFSET , ptr, count); } }
@@ -175,11 +172,8 @@ isac_fill_fifo(struct isac_hw *isac) isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE *HZ )/1000 );add_timer (&isac->dch.timer);if (isac->dch.debug &DEBUG_HW_DFIFO ) { -char pfx[MISDN_MAX_IDLEN +16 ]; - -snprintf (pfx,MISDN_MAX_IDLEN +15 ,"D-send %s %d " , - isac->name, count); -print_hex_dump_bytes (pfx,DUMP_PREFIX_OFFSET , ptr, count); +pr_debug ("D-send %s %d\n" , isac->name, count); +print_hex_dump_bytes ("send" ,DUMP_PREFIX_OFFSET , ptr, count); } }
@@ -962,9 +956,9 @@ hscx_empty_fifo(struct hscx_hw *hscx, u8 count)hscx_cmdr (hscx,0x80 );/* RMC */ if (hscx->bch.debug &DEBUG_HW_BFIFO ) { -snprintf (hscx->log,64 ,"B%1d-recv %s %d " , +pr_debug ("B%1d-recv %s %d\n" , hscx->bch.nr, hscx->ip->name, count); -print_hex_dump_bytes (hscx->log,DUMP_PREFIX_OFFSET , p, count); +print_hex_dump_bytes ("recv" ,DUMP_PREFIX_OFFSET , p, count); } }
@@ -1007,9 +1001,9 @@ hscx_fill_fifo(struct hscx_hw *hscx)hscx_cmdr (hscx, more ?0x08 :0x0a );if (hscx->bch.tx_skb && (hscx->bch.debug &DEBUG_HW_BFIFO )) { -snprintf (hscx->log,64 ,"B%1d-send %s %d " , +pr_debug ("B%1d-send %s %d\n" , hscx->bch.nr, hscx->ip->name, count); -print_hex_dump_bytes (hscx->log,DUMP_PREFIX_OFFSET , p, count); +print_hex_dump_bytes ("send" ,DUMP_PREFIX_OFFSET , p, count); } }
drivers/isdn/hardware/mISDN/netjet.c +6 -10
@@ -71,8 +71,6 @@ struct tiger_ch {#define TX_UNDERRUN 0x0100#define RX_OVERRUN 0x0100 -#define LOG_SIZE 64 -struct tiger_hw {struct list_head list;struct pci_dev *pdev;
@@ -94,7 +92,6 @@ struct tiger_hw {u8 auxd;u8 last_is0;u8 irqmask0; -char log[LOG_SIZE ]; };static LIST_HEAD (Cards);
@@ -423,10 +420,9 @@ read_dma(struct tiger_ch *bc, u32 idx, int cnt)if (stat >0 ) {/* valid frame received */ p =skb_put (bc->bch.rx_skb, stat);if (debug &DEBUG_HW_BFIFO ) { -snprintf (card->log,LOG_SIZE , -"B%1d-recv %s %d " , bc->bch.nr, +pr_debug ("B%1d-recv %s %d\n" , bc->bch.nr, card->name, stat); -print_hex_dump_bytes (card->log, +print_hex_dump_bytes ("recv" ,DUMP_PREFIX_OFFSET , p, stat); }
@@ -527,9 +523,9 @@ fill_hdlc_flag(struct tiger_ch *bc) card->send.start[bc->idx++] = v; }if (debug &DEBUG_HW_BFIFO ) { -snprintf (card->log,LOG_SIZE ,"B%1d-send %s %d " , +pr_debug ("B%1d-send %s %d\n" , bc->bch.nr, card->name, count); -print_hex_dump_bytes (card->log,DUMP_PREFIX_OFFSET , p, count); +print_hex_dump_bytes ("send" ,DUMP_PREFIX_OFFSET , p, count); } }
@@ -601,9 +597,9 @@ fill_dma(struct tiger_ch *bc) } }if (debug &DEBUG_HW_BFIFO ) { -snprintf (card->log,LOG_SIZE ,"B%1d-send %s %d " , +pr_debug ("B%1d-send %s %d\n" , bc->bch.nr, card->name, count); -print_hex_dump_bytes (card->log,DUMP_PREFIX_OFFSET , p, count); +print_hex_dump_bytes ("send" ,DUMP_PREFIX_OFFSET , p, count); }if (bc->free)bc_next_frame (bc);
drivers/isdn/hardware/mISDN/w6692.c +8 -11
@@ -81,7 +81,6 @@ struct w6692_hw {u8 state;struct w6692_ch bc[2 ];struct dchannel dch; -char log[64 ]; };static LIST_HEAD (Cards);
@@ -279,9 +278,8 @@ W6692_empty_Dfifo(struct w6692_hw *card, int count)insb (card->addr +W_D_RFIFO , ptr, count);WriteW6692 (card,W_D_CMDR ,W_D_CMDR_RACK );if (debug &DEBUG_HW_DFIFO ) { -snprintf (card->log,63 ,"D-recv %s %d " , - card->name, count); -print_hex_dump_bytes (card->log,DUMP_PREFIX_OFFSET , ptr, count); +pr_debug ("D-recv %s %d\n" , card->name, count); +print_hex_dump_bytes ("recv" ,DUMP_PREFIX_OFFSET , ptr, count); } }
@@ -315,9 +313,8 @@ W6692_fill_Dfifo(struct w6692_hw *card) dch->timer.expires = jiffies + ((DBUSY_TIMER_VALUE *HZ ) /1000 );add_timer (&dch->timer);if (debug &DEBUG_HW_DFIFO ) { -snprintf (card->log,63 ,"D-send %s %d " , - card->name, count); -print_hex_dump_bytes (card->log,DUMP_PREFIX_OFFSET , ptr, count); +pr_debug ("D-send %s %d\n" , card->name, count); +print_hex_dump_bytes ("send" ,DUMP_PREFIX_OFFSET , ptr, count); } }
@@ -493,9 +490,9 @@ W6692_empty_Bfifo(struct w6692_ch *wch, int count)insb (wch->addr +W_B_RFIFO , ptr, count);WriteW6692B (wch,W_B_CMDR ,W_B_CMDR_RACK |W_B_CMDR_RACT );if (debug &DEBUG_HW_DFIFO ) { -snprintf (card->log,63 ,"B%1d-recv %s %d " , +pr_debug ("B%1d-recv %s %d\n" , wch->bch.nr, card->name, count); -print_hex_dump_bytes (card->log,DUMP_PREFIX_OFFSET , ptr, count); +print_hex_dump_bytes ("recv" ,DUMP_PREFIX_OFFSET , ptr, count); } }
@@ -537,9 +534,9 @@ W6692_fill_Bfifo(struct w6692_ch *wch) }WriteW6692B (wch,W_B_CMDR , cmd);if ((debug &DEBUG_HW_BFIFO ) && !fillempty) { -snprintf (card->log,63 ,"B%1d-send %s %d " , +pr_debug ("B%1d-send %s %d\n" , wch->bch.nr, card->name, count); -print_hex_dump_bytes (card->log,DUMP_PREFIX_OFFSET , ptr, count); +print_hex_dump_bytes ("send" ,DUMP_PREFIX_OFFSET , ptr, count); } }
drivers/net/wireless/ath/ath6kl/debug.c +2 -1
@@ -85,7 +85,8 @@ void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,if (msg)ath6kl_dbg (mask,"%s\n" , msg); -print_hex_dump_bytes (prefix,DUMP_PREFIX_OFFSET , buf, len); +pr_debug ("%s dump\n" , prefix); +print_hex_dump_bytes ("" ,DUMP_PREFIX_OFFSET , buf, len); } }EXPORT_SYMBOL (ath6kl_dbg_dump);
drivers/net/wireless/libertas_tf/deb_defs.h +2 -4
@@ -88,13 +88,11 @@ do { if ((lbtf_debug & (grp)) == (grp)) \#ifdef DEBUG static inline void lbtf_deb_hex (unsigned int grp,const char *prompt,u8 *buf,int len) { -char newprompt[32 ]; -if (len && (lbtf_debug &LBTF_DEB_HEX ) && (lbtf_debug & grp)) { -snprintf (newprompt,sizeof (newprompt),DRV_NAME " %s: " , prompt); -print_hex_dump_bytes (prompt,DUMP_PREFIX_NONE , buf, len); +pr_debug (DRV_NAME " %s\n" , prompt); +print_hex_dump_bytes (DRV_NAME ,DUMP_PREFIX_NONE , buf, len); } }#else
drivers/tty/ipwireless/hardware.c +4 -5
@@ -362,12 +362,11 @@ static char *data_type(const unsigned char *buf, unsigned length)static void dump_data_bytes (const char *type,const unsigned char *data,unsigned length) { -char prefix[56 ]; - -sprintf (prefix,IPWIRELESS_PCCARD_NAME ": %s %s " , +pr_debug (IPWIRELESS_PCCARD_NAME ": %s %s\n" , type,data_type (data, length)); -print_hex_dump_bytes (prefix,0 , (void *)data, - length <DUMP_MAX_BYTES ? length :DUMP_MAX_BYTES ); +print_hex_dump_bytes (IPWIRELESS_PCCARD_NAME ,DUMP_PREFIX_NONE , + (void *)data, +min_t (unsigned, length,DUMP_MAX_BYTES )); }static void swap_packet_bitfield_to_le (unsigned char *data)
Signature · 1 line
1.7.10.4
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
In reply to a message not in the archiveQuoted 19 lines · Vladimir Kondratiev
I see 2 drivers that use dynamic prefix:
- mentioned above
drivers/tty/ipwireless/hardware.c
-drivers/isdn/hardware/mISDN/I see several options:
1) require
prefix_strto be constant. Patch code mentioned. For example, code above may reads:static void dump_data_bytes(const char *type, const unsigned char *data,
unsigned length){ pr_debug(IPWIRELESS_PCCARD_NAME ": %s %s\n", type, data_type(data, length)); print_hex_dump_bytes(IPWIRELESS_PCCARD_NAME, 0, (void *)data, length < DUMP_MAX_BYTES ? length : DUMP_MAX_BYTES); }
Quoted 7 lines
2) introduce fixed format string in
DEFINE_DYNAMIC_DEBUG_METADATA, likeDEFINE_DYNAMIC_DEBUG_METADATA((descriptor, "hexdump");
3) remove
print_hex_dump_bytesfrom this patchI think 1) is the best, opinions?
Another option could be testing __builtin_constant_p(prefix)
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 1 line · Joe Perches
Another option could be testing
__builtin_constant_p(prefix)
You mean something like below? Yes, it will work as well.
Pro: don't need to change existing code
(drop [PATCH 2/2] dynamic_debug: use constant format in print_hex_dump_bytes())
Cons: format in dynamic metadata will be useless
What looks better?
---
#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \
__builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
print_hex_dump(KERN_DEBUG, prefix_str, \
prefix_type, rowsize, groupsize, \
buf, len, ascii); \
} while (0)Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 14 lines · Vladimir Kondratiev
Quoted 1 line · Joe Perches
Another option could be testing
__builtin_constant_p(prefix)You mean something like below? Yes, it will work as well.
Pro: don't need to change existing code
(drop [PATCH 2/2]dynamic_debug: use constant format inprint_hex_dump_bytes())Cons: format in dynamic metadata will be useless
What looks better?
---
Quoted 10 lines
#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \
__builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
print_hex_dump(KERN_DEBUG, prefix_str, \
prefix_type, rowsize, groupsize, \
buf, len, ascii); \
} while (0)In case this option wins, patch follows. There is no need for 2-nd one to fix existing drivers.
Quoted 1 line
From
42bea6be2b3899eac1ed3f48eb955a4d83960cf5Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Sun, 18 Nov 2012 18:56:29 +0200
Subject: [PATCH] dynamic_debug: dynamic hex dump
Introduce print_hex_dump_debug() that can be dynamically controlled, similar to pr_debug.
Also, make print_hex_dump_bytes() dynamically controlled
Implement only 'p' flag (_DPRINTK_FLAGS_PRINT) to keep it simple since hex dump prints multiple lines and long prefix would impact readability.
To provide line/file etc. information, use pr_debug or similar before/after print_hex_dump_debug()
--- Documentation/dynamic-debug-howto.txt | 15 +++++++++++++-- include/linux/dynamic_debug.h | 11 +++++++++++ include/linux/printk.h | 17 +++++++++++++++++ lib/hexdump.c | 4 +++- 4 files changed, 44 insertions(+), 3 deletions(-)
Documentation/dynamic-debug-howto.txt +13 -2
@@ -6,8 +6,16 @@ This document describes how to use the dynamic debug (dyndbg) feature. Dynamic debug is designed to allow you to dynamically enable/disable kernel code to obtain additional kernel information. Currently, if -CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() calls can -be dynamically enabled per-callsite. +CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_dbg() and +print_hex_dump_debug()/print_hex_dump_bytes() calls can be dynamically +enabled per-callsite. + +If CONFIG_DYNAMIC_DEBUG is not set, print_hex_dump_debug() is just +shortcut for print_hex_dump(KERN_DEBUG). + +For print_hex_dump_debug()/print_hex_dump_bytes(), format string is +its 'prefix_str' argument, if it is constant string; or "hexdump" +in case 'prefix_str' is build dynamically. Dynamic debug has even more useful features:
@@ -202,6 +210,9 @@ The flags are: t Include thread ID in messages not generated from interrupt context _ No flags are set. (Or'd with others on input) +For print_hex_dump_debug() and print_hex_dump_bytes(), only 'p' flag +have meaning, other flags ignored. + For display, the flags are preceded by '=' (mnemonic: what the flags are currently equal to).
include/linux/dynamic_debug.h +11 -0
@@ -95,6 +95,17 @@ do { \ ##__VA_ARGS__); \ } while (0) +#define dynamic_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \ + __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) +#else #include <linux/string.h>
include/linux/printk.h +17 -0
@@ -321,8 +321,13 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,extern void print_hex_dump (const char *level,const char *prefix_str,int prefix_type,int rowsize,int groupsize,const void *buf,size_t len,bool ascii); +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \ + dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) +#else extern void print_hex_dump_bytes (const char *prefix_str,int prefix_type,const void *buf,size_t len); +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ #else static inline void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize,
@@ -336,4 +341,16 @@ static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,#endif +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#else +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ +#endif
lib/hexdump.c +3 -1
@@ -227,6 +227,7 @@ void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, }EXPORT_SYMBOL (print_hex_dump); +#if !defined(CONFIG_DYNAMIC_DEBUG )/** * print_hex_dump_bytes - shorthand form of print_hex_dump() with default params * @prefix_str: string to prefix each line with;
@@ -246,4 +247,5 @@ void print_hex_dump_bytes(const char *prefix_str, int prefix_type, buf, len, true); }EXPORT_SYMBOL (print_hex_dump_bytes); -#endif +#endif /* !defined(CONFIG_DYNAMIC_DEBUG) */ +#endif /* defined(CONFIG_PRINTK) */
Signature · 1 line
1.7.10.4
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 2 lines · Vladimir Kondratiev
In case this option wins, patch follows. There is no need for 2-nd one to fix existing drivers.
Thanks Vladimir.
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 7 lines · Joe Perches
Quoted 2 lines · Vladimir Kondratiev
In case this option wins, patch follows. There is no need for 2-nd one to fix existing drivers.
Thanks Vladimir.
Yes, thanks. I've pulled in this patch, and posted a dynamic debug tree
at: git clone git://github.com/jibaron/ddebug.git
I will push the collected set of patches to Greg.
I also added a couple of patches there to convert dynamic debug to use 'jump labels', which shows good results.
Thanks,
-Jason
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Hi Jason,
Do you have any update on the status for patches below? Where is it now? When do you expect it to merge? 3.8? I am waiting for this to merge before I can go on with my driver.
Thanks, Vladimir
Quoted 20 lines · Jason Baron
Quoted 7 lines · Joe Perches
Quoted 2 lines · Vladimir Kondratiev
In case this option wins, patch follows. There is no need for 2-nd one to fix existing drivers.
Thanks Vladimir.
Yes, thanks. I've pulled in this patch, and posted a dynamic debug tree
at: git clonegit://github.com/jibaron/ddebug.gitI will push the collected set of patches to Greg.
I also added a couple of patches there to convert dynamic debug to use 'jump labels', which shows good results.
Thanks,
-Jason
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 6 lines · Vladimir Kondratiev
Hi Jason,
Do you have any update on the status for patches below? Where is it now? When do you expect it to merge? 3.8? I am waiting for this to merge before I can go on with my driver.
*poke*
Luis
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 11 lines · Luis R. Rodriguez
Quoted 6 lines · Vladimir Kondratiev
Hi Jason,
Do you have any update on the status for patches below? Where is it now? When do you expect it to merge? 3.8? I am waiting for this to merge before I can go on with my driver.
*poke*
Luis
Hi Luis,
Yes, I posted this patch, along with 2 others last week for Greg to pull. I believe these are too late for the 3.8 merge window. Perhaps, Greg can comment. Here's a link to the post:
http://marc.info/?l=linux-kernel&m=135474417810281&w=2
Thanks,
-Jason
Greg KH
maintainerRe: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 13 lines · Jason Baron
Quoted 11 lines · Luis R. Rodriguez
Quoted 6 lines · Vladimir Kondratiev
Hi Jason,
Do you have any update on the status for patches below? Where is it now? When do you expect it to merge? 3.8? I am waiting for this to merge before I can go on with my driver.
*poke*
Luis
Quoted 7 lines
Hi Luis,
Yes, I posted this patch, along with 2 others last week for Greg to pull. I believe these are too late for the 3.8 merge window. Perhaps, Greg can comment. Here's a link to the post:
Yes it's too late, these will go into linux-next after 3.8-rc1 is out.
thanks,
greg k-h
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 20 lines · Greg KH
Quoted 19 lines · Jason Baron
Quoted 11 lines · Luis R. Rodriguez
Quoted 6 lines · Vladimir Kondratiev
Hi Jason,
Do you have any update on the status for patches below? Where is it now? When do you expect it to merge? 3.8? I am waiting for this to merge before I can go on with my driver.
*poke*
Luis
Hi Luis,
Yes, I posted this patch, along with 2 others last week for Greg to pull. I believe these are too late for the 3.8 merge window. Perhaps, Greg can comment. Here's a link to the post:
Quoted 8 lines
Yes it's too late, these will go into linux-next after 3.8-rc1 is out.
thanks,
greg k-h
Vladimir, sorry about this.
I suggest you prefix/rename and include these functions directly into your driver and later after 3.9 is out you could again rename the local calls to the now generic kernel functions and delete the local ones.
Your driver is for new hardware, so even now it should be able to go into 3.8.
cheers, Joe
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 30 lines · Joe Perches
Quoted 20 lines · Greg KH
Quoted 19 lines · Jason Baron
Quoted 11 lines · Luis R. Rodriguez
Quoted 6 lines · Vladimir Kondratiev
Hi Jason,
Do you have any update on the status for patches below? Where is it now? When do you expect it to merge? 3.8? I am waiting for this to merge before I can go on with my driver.
*poke*
Luis
Hi Luis,
Yes, I posted this patch, along with 2 others last week for Greg to pull. I believe these are too late for the 3.8 merge window. Perhaps, Greg can comment. Here's a link to the post:
Quoted 8 lines
Yes it's too late, these will go into linux-next after 3.8-rc1 is out.
thanks,
greg k-h
Quoted 6 lines
Vladimir, sorry about this.
I suggest you prefix/rename and include these functions directly into your driver and later after 3.9 is out you could again rename the local calls to the now generic kernel functions and delete the local ones.
Vladimir, to be clear, you can continue with waiting for the patches to get into 3.9 but that will take a while but given that you want your driver in 3.8 you can fold those routines into your driver as you had before but with a rename by adding a prefix and sumbit that driver and specify it is for 3.8.
Quoted 2 lines
Your driver is for new hardware, so even now it should be able to go into 3.8.
Agreed.
Luis
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 6 lines · Luis R. Rodriguez
Vladimir, to be clear, you can continue with waiting for the patches to get into 3.9 but that will take a while but given that you want your driver in 3.8 you can fold those routines into your driver as you had before but with a rename by adding a prefix and sumbit that driver and specify it is for 3.8.
I have internally patch that will compensate not merged yet functionality, without any rename, see below. I can massage commit message and include it with my driver as separate patch to be easier to undo later.
Comments?
Quoted 1 line
From
c4e7254d0cba51c8b43d36a317a1b847fffb18d8Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Wed, 21 Nov 2012 13:57:21 +0200
Subject: [PATCH] [DEBUG] Allow to compile with mainstream kernel
Unless patch for dynamic hexdump merged into mainstream kernel, need to provide replacement for the dynamic hexdump functionality
Do not hurt compilation with kernel that have patch above merged.
REMOVE when dynamic hexdump merged into mainstream kernel!!
Change-Id: I6abb8f91ed529ffc84bd9cc21444a59ee15fe456
--- dbg_hexdump.h | 32 ++++++++++++++++++++++++++++++++ wil6210.h | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 dbg_hexdump.h
dbg_hexdump.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef DBG_HEXDUMP_H_ +#define DBG_HEXDUMP_H_ + +#if !defined(print_hex_dump_debug) +#if defined(CONFIG_DYNAMIC_DEBUG ) +#define dynamic_hex_dump (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \ + __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) + +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) + +#define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \ + dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) +#else /* defined(CONFIG_DYNAMIC_DEBUG) */ +#define print_hex_dump_debug (prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ + print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) +#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ +#endif /* !defined(print_hex_dump_debug) */ + +#endif /* DBG_HEXDUMP_H_ */
wil6210.h +2 -0
@@ -21,6 +21,8 @@#include <linux/wireless.h> #include <net/cfg80211.h> +#include "dbg_hexdump.h" +#define WIL_NAME "wil6210"/**
Signature · 1 line
1.7.10.4
Re: [RFC] dynamic_debug: introduce debug_hex_dump()
Quoted 1 line · Vladimir Kondratiev
+#define dynamic_hex_dump(prefix_str,
prefix_type, rowsize, \
wil_dynamic_hex_dump()
Luis