aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-05-15 10:26:50 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-05-15 10:26:50 -0400
commit12e04ffcd93b25dfd726d46338c2ee7d23de556e (patch)
treef91479a62805619168994fd3ee55e3ffa23fc24e /include/linux/kernel.h
parent9eff37a8713939f218ab8bf0dc93f1d67af7b8b4 (diff)
parentf722406faae2d073cc1d01063d1123c35425939e (diff)
Merge tag 'v3.10-rc1' into stable/for-linus-3.10
Linux 3.10-rc1 * tag 'v3.10-rc1': (12273 commits) Linux 3.10-rc1 [SCSI] qla2xxx: Update firmware link in Kconfig file. [SCSI] iscsi class, qla4xxx: fix sess/conn refcounting when find fns are used [SCSI] sas: unify the pointlessly separated enums sas_dev_type and sas_device_type [SCSI] pm80xx: thermal, sas controller config and error handling update [SCSI] pm80xx: NCQ error handling changes [SCSI] pm80xx: WWN Modification for PM8081/88/89 controllers [SCSI] pm80xx: Changed module name and debug messages update [SCSI] pm80xx: Firmware flash memory free fix, with addition of new memory region for it [SCSI] pm80xx: SPC new firmware changes for device id 0x8081 alone [SCSI] pm80xx: Added SPCv/ve specific hardware functionalities and relevant changes in common files [SCSI] pm80xx: MSI-X implementation for using 64 interrupts [SCSI] pm80xx: Updated common functions common for SPC and SPCv/ve [SCSI] pm80xx: Multiple inbound/outbound queue configuration [SCSI] pm80xx: Added SPCv/ve specific ids, variables and modify for SPC [SCSI] lpfc: fix up Kconfig dependencies [SCSI] Handle MLQUEUE busy response in scsi_send_eh_cmnd dm cache: set config value dm cache: move config fns dm thin: generate event when metadata threshold passed ...
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h79
1 files changed, 67 insertions, 12 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 79fdd80a42d4..e96329ceb28c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -486,6 +486,8 @@ enum ftrace_dump_mode {
486void tracing_on(void); 486void tracing_on(void);
487void tracing_off(void); 487void tracing_off(void);
488int tracing_is_on(void); 488int tracing_is_on(void);
489void tracing_snapshot(void);
490void tracing_snapshot_alloc(void);
489 491
490extern void tracing_start(void); 492extern void tracing_start(void);
491extern void tracing_stop(void); 493extern void tracing_stop(void);
@@ -515,10 +517,32 @@ do { \
515 * 517 *
516 * This is intended as a debugging tool for the developer only. 518 * This is intended as a debugging tool for the developer only.
517 * Please refrain from leaving trace_printks scattered around in 519 * Please refrain from leaving trace_printks scattered around in
518 * your code. 520 * your code. (Extra memory is used for special buffers that are
521 * allocated when trace_printk() is used)
522 *
523 * A little optization trick is done here. If there's only one
524 * argument, there's no need to scan the string for printf formats.
525 * The trace_puts() will suffice. But how can we take advantage of
526 * using trace_puts() when trace_printk() has only one argument?
527 * By stringifying the args and checking the size we can tell
528 * whether or not there are args. __stringify((__VA_ARGS__)) will
529 * turn into "()\0" with a size of 3 when there are no args, anything
530 * else will be bigger. All we need to do is define a string to this,
531 * and then take its size and compare to 3. If it's bigger, use
532 * do_trace_printk() otherwise, optimize it to trace_puts(). Then just
533 * let gcc optimize the rest.
519 */ 534 */
520 535
521#define trace_printk(fmt, args...) \ 536#define trace_printk(fmt, ...) \
537do { \
538 char _______STR[] = __stringify((__VA_ARGS__)); \
539 if (sizeof(_______STR) > 3) \
540 do_trace_printk(fmt, ##__VA_ARGS__); \
541 else \
542 trace_puts(fmt); \
543} while (0)
544
545#define do_trace_printk(fmt, args...) \
522do { \ 546do { \
523 static const char *trace_printk_fmt \ 547 static const char *trace_printk_fmt \
524 __attribute__((section("__trace_printk_fmt"))) = \ 548 __attribute__((section("__trace_printk_fmt"))) = \
@@ -538,7 +562,45 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);
538extern __printf(2, 3) 562extern __printf(2, 3)
539int __trace_printk(unsigned long ip, const char *fmt, ...); 563int __trace_printk(unsigned long ip, const char *fmt, ...);
540 564
541extern void trace_dump_stack(void); 565/**
566 * trace_puts - write a string into the ftrace buffer
567 * @str: the string to record
568 *
569 * Note: __trace_bputs is an internal function for trace_puts and
570 * the @ip is passed in via the trace_puts macro.
571 *
572 * This is similar to trace_printk() but is made for those really fast
573 * paths that a developer wants the least amount of "Heisenbug" affects,
574 * where the processing of the print format is still too much.
575 *
576 * This function allows a kernel developer to debug fast path sections
577 * that printk is not appropriate for. By scattering in various
578 * printk like tracing in the code, a developer can quickly see
579 * where problems are occurring.
580 *
581 * This is intended as a debugging tool for the developer only.
582 * Please refrain from leaving trace_puts scattered around in
583 * your code. (Extra memory is used for special buffers that are
584 * allocated when trace_puts() is used)
585 *
586 * Returns: 0 if nothing was written, positive # if string was.
587 * (1 when __trace_bputs is used, strlen(str) when __trace_puts is used)
588 */
589
590extern int __trace_bputs(unsigned long ip, const char *str);
591extern int __trace_puts(unsigned long ip, const char *str, int size);
592#define trace_puts(str) ({ \
593 static const char *trace_printk_fmt \
594 __attribute__((section("__trace_printk_fmt"))) = \
595 __builtin_constant_p(str) ? str : NULL; \
596 \
597 if (__builtin_constant_p(str)) \
598 __trace_bputs(_THIS_IP_, trace_printk_fmt); \
599 else \
600 __trace_puts(_THIS_IP_, str, strlen(str)); \
601})
602
603extern void trace_dump_stack(int skip);
542 604
543/* 605/*
544 * The double __builtin_constant_p is because gcc will give us an error 606 * The double __builtin_constant_p is because gcc will give us an error
@@ -573,6 +635,8 @@ static inline void trace_dump_stack(void) { }
573static inline void tracing_on(void) { } 635static inline void tracing_on(void) { }
574static inline void tracing_off(void) { } 636static inline void tracing_off(void) { }
575static inline int tracing_is_on(void) { return 0; } 637static inline int tracing_is_on(void) { return 0; }
638static inline void tracing_snapshot(void) { }
639static inline void tracing_snapshot_alloc(void) { }
576 640
577static inline __printf(1, 2) 641static inline __printf(1, 2)
578int trace_printk(const char *fmt, ...) 642int trace_printk(const char *fmt, ...)
@@ -722,18 +786,9 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
722/* Trap pasters of __FUNCTION__ at compile-time */ 786/* Trap pasters of __FUNCTION__ at compile-time */
723#define __FUNCTION__ (__func__) 787#define __FUNCTION__ (__func__)
724 788
725/* This helps us to avoid #ifdef CONFIG_SYMBOL_PREFIX */
726#ifdef CONFIG_SYMBOL_PREFIX
727#define SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
728#else
729#define SYMBOL_PREFIX ""
730#endif
731
732/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ 789/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
733#ifdef CONFIG_FTRACE_MCOUNT_RECORD 790#ifdef CONFIG_FTRACE_MCOUNT_RECORD
734# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 791# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
735#endif 792#endif
736 793
737extern int do_sysinfo(struct sysinfo *info);
738
739#endif 794#endif