]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'core/printk' into tracing/ftrace
authorIngo Molnar <mingo@elte.hu>
Fri, 6 Mar 2009 16:45:42 +0000 (17:45 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 6 Mar 2009 16:45:42 +0000 (17:45 +0100)
1  2 
include/linux/kernel.h

diff --combined include/linux/kernel.h
index d4614a8a034baa2173d582f29b3e542037bd9193,3c183d9864ae5a99faf202a80b31bc7cd257c5ff..7aef15c4645e02516d629e8246d9cb23d9ddece0
@@@ -242,6 -242,19 +242,19 @@@ extern struct ratelimit_state printk_ra
  extern int printk_ratelimit(void);
  extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
                                   unsigned int interval_msec);
+ /*
+  * Print a one-time message (analogous to WARN_ONCE() et al):
+  */
+ #define printk_once(x...) ({                  \
+       static int __print_once = 1;            \
+                                               \
+       if (__print_once) {                     \
+               __print_once = 0;               \
+               printk(x);                      \
+       }                                       \
+ })
  #else
  static inline int vprintk(const char *s, va_list args)
        __attribute__ ((format (printf, 1, 0)));
@@@ -253,6 -266,10 +266,10 @@@ static inline int printk_ratelimit(void
  static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
                                          unsigned int interval_msec)   \
                { return false; }
+ /* No effect, but we still get type checking even in the !PRINTK case: */
+ #define printk_once(x...) printk(x)
  #endif
  
  extern int printk_needs_cpu(int cpu);
@@@ -367,91 -384,6 +384,91 @@@ static inline char *pack_hex_byte(char 
        ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
  #endif
  
 +/*
 + * General tracing related utility functions - trace_printk(),
 + * tracing_on/tracing_off and tracing_start()/tracing_stop
 + *
 + * Use tracing_on/tracing_off when you want to quickly turn on or off
 + * tracing. It simply enables or disables the recording of the trace events.
 + * This also corresponds to the user space debugfs/tracing/tracing_on
 + * file, which gives a means for the kernel and userspace to interact.
 + * Place a tracing_off() in the kernel where you want tracing to end.
 + * From user space, examine the trace, and then echo 1 > tracing_on
 + * to continue tracing.
 + *
 + * tracing_stop/tracing_start has slightly more overhead. It is used
 + * by things like suspend to ram where disabling the recording of the
 + * trace is not enough, but tracing must actually stop because things
 + * like calling smp_processor_id() may crash the system.
 + *
 + * Most likely, you want to use tracing_on/tracing_off.
 + */
 +#ifdef CONFIG_RING_BUFFER
 +void tracing_on(void);
 +void tracing_off(void);
 +/* trace_off_permanent stops recording with no way to bring it back */
 +void tracing_off_permanent(void);
 +int tracing_is_on(void);
 +#else
 +static inline void tracing_on(void) { }
 +static inline void tracing_off(void) { }
 +static inline void tracing_off_permanent(void) { }
 +static inline int tracing_is_on(void) { return 0; }
 +#endif
 +#ifdef CONFIG_TRACING
 +extern void tracing_start(void);
 +extern void tracing_stop(void);
 +extern void ftrace_off_permanent(void);
 +
 +extern void
 +ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
 +
 +/**
 + * trace_printk - printf formatting in the ftrace buffer
 + * @fmt: the printf format for printing
 + *
 + * Note: __trace_printk is an internal function for trace_printk and
 + *       the @ip is passed in via the trace_printk macro.
 + *
 + * This function allows a kernel developer to debug fast path sections
 + * that printk is not appropriate for. By scattering in various
 + * printk like tracing in the code, a developer can quickly see
 + * where problems are occurring.
 + *
 + * This is intended as a debugging tool for the developer only.
 + * Please refrain from leaving trace_printks scattered around in
 + * your code.
 + */
 +# define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt)
 +extern int
 +__trace_printk(unsigned long ip, const char *fmt, ...)
 +      __attribute__ ((format (printf, 2, 3)));
 +# define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap)
 +extern int
 +__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
 +extern void ftrace_dump(void);
 +#else
 +static inline void
 +ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
 +static inline int
 +trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 +
 +static inline void tracing_start(void) { }
 +static inline void tracing_stop(void) { }
 +static inline void ftrace_off_permanent(void) { }
 +static inline int
 +trace_printk(const char *fmt, ...)
 +{
 +      return 0;
 +}
 +static inline int
 +ftrace_vprintk(const char *fmt, va_list ap)
 +{
 +      return 0;
 +}
 +static inline void ftrace_dump(void) { }
 +#endif
 +
  /*
   *      Display an IP address in readable format.
   */
  /*
   * swap - swap value of @a and @b
   */
 -#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
 +#define swap(a, b) \
 +      do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
  
  /**
   * container_of - cast a member of a structure out to the containing structure