trace: add CONFIG_DISABLE_TRACE_PRINTK option
Poorly made kernel trees often use trace_printk() without properly guarding them in a #ifdef macro. Such usage of trace_printk() causes a warning at boot and additional memory allocation. This option serves to disable those all at once with ease. Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com> Signed-off-by: Alex Naidis <alex.naidis@linux.com> (cherry picked from commit 9ec68f89188e461721de418545e31f37800dfa02) (cherry picked from commit 8fb7e59ccd6cda94e29af9e6e38a96eda458c9da) (cherry picked from commit 515ff4ab9e2428b642fcd158af94c83e3059b33b) (cherry picked from commit ac9a6d9d6a744a11c49e9d756bd0229c912b773d) (cherry picked from commit e4f4c2c3e696ab4135e5e63b2acae6400476ac35) Signed-off-by: SirRGB <sirrgb@proton.me>
This commit is contained in:
parent
613ee071be
commit
51cd5d4626
2 changed files with 18 additions and 0 deletions
|
@ -593,6 +593,9 @@ do { \
|
||||||
* let gcc optimize the rest.
|
* let gcc optimize the rest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_DISABLE_TRACE_PRINTK
|
||||||
|
#define trace_printk pr_debug
|
||||||
|
#else
|
||||||
#define trace_printk(fmt, ...) \
|
#define trace_printk(fmt, ...) \
|
||||||
do { \
|
do { \
|
||||||
char _______STR[] = __stringify((__VA_ARGS__)); \
|
char _______STR[] = __stringify((__VA_ARGS__)); \
|
||||||
|
@ -615,6 +618,7 @@ do { \
|
||||||
else \
|
else \
|
||||||
__trace_printk(_THIS_IP_, fmt, ##args); \
|
__trace_printk(_THIS_IP_, fmt, ##args); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern __printf(2, 3)
|
extern __printf(2, 3)
|
||||||
int __trace_bprintk(unsigned long ip, const char *fmt, ...);
|
int __trace_bprintk(unsigned long ip, const char *fmt, ...);
|
||||||
|
|
|
@ -149,6 +149,20 @@ config GENERIC_TRACER
|
||||||
bool
|
bool
|
||||||
select TRACING
|
select TRACING
|
||||||
|
|
||||||
|
if TRACING
|
||||||
|
|
||||||
|
config DISABLE_TRACE_PRINTK
|
||||||
|
bool "Force disable trace_printk() usage"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
When trace_printk() is used in any of the kernel source, it enables
|
||||||
|
debugging functions which are not desired for production kernel.
|
||||||
|
Enabling this option will replace trace_printk() with pr_debug().
|
||||||
|
|
||||||
|
If in doubt, say Y.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# Minimum requirements an architecture has to meet for us to
|
# Minimum requirements an architecture has to meet for us to
|
||||||
# be able to offer generic tracing facilities:
|
# be able to offer generic tracing facilities:
|
||||||
|
|
Loading…
Add table
Reference in a new issue