Merge commit 'v2.6.28-rc6' into core/debug
authorIngo Molnar <mingo@elte.hu>
Wed, 26 Nov 2008 07:22:50 +0000 (08:22 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 26 Nov 2008 07:22:50 +0000 (08:22 +0100)
1  2 
include/linux/kernel.h
kernel/notifier.c
kernel/softlockup.c
lib/Kconfig.debug

diff --combined include/linux/kernel.h
@@@ -16,6 -16,7 +16,7 @@@
  #include <linux/log2.h>
  #include <linux/typecheck.h>
  #include <linux/ratelimit.h>
+ #include <linux/dynamic_printk.h>
  #include <asm/byteorder.h>
  #include <asm/bug.h>
  
@@@ -115,6 -116,8 +116,8 @@@ extern int _cond_resched(void)
  # define might_resched() do { } while (0)
  #endif
  
+ #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
+   void __might_sleep(char *file, int line);
  /**
   * might_sleep - annotation for functions that can sleep
   *
   * be bitten later when the calling function happens to sleep when it is not
   * supposed to.
   */
- #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
-   void __might_sleep(char *file, int line);
  # define might_sleep() \
        do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
  #else
@@@ -182,16 -183,38 +183,40 @@@ extern int vsscanf(const char *, const 
  
  extern int get_option(char **str, int *pint);
  extern char *get_options(const char *str, int nints, int *ints);
- extern unsigned long long memparse(char *ptr, char **retptr);
+ extern unsigned long long memparse(const char *ptr, char **retptr);
  
  extern int core_kernel_text(unsigned long addr);
  extern int __kernel_text_address(unsigned long addr);
  extern int kernel_text_address(unsigned long addr);
 +extern int func_ptr_is_kernel_text(void *ptr);
 +
  struct pid;
  extern struct pid *session_of_pgrp(struct pid *pgrp);
  
+ /*
+  * FW_BUG
+  * Add this to a message where you are sure the firmware is buggy or behaves
+  * really stupid or out of spec. Be aware that the responsible BIOS developer
+  * should be able to fix this issue or at least get a concrete idea of the
+  * problem by reading your message without the need of looking at the kernel
+  * code.
+  * 
+  * Use it for definite and high priority BIOS bugs.
+  *
+  * FW_WARN
+  * Use it for not that clear (e.g. could the kernel messed up things already?)
+  * and medium priority BIOS bugs.
+  *
+  * FW_INFO
+  * Use this one if you want to tell the user or vendor about something
+  * suspicious, but generally harmless related to the firmware.
+  *
+  * Use it for information or very low priority BIOS bugs.
+  */
+ #define FW_BUG                "[Firmware Bug]: "
+ #define FW_WARN               "[Firmware Warn]: "
+ #define FW_INFO               "[Firmware Info]: "
  #ifdef CONFIG_PRINTK
  asmlinkage int vprintk(const char *fmt, va_list args)
        __attribute__ ((format (printf, 1, 0)));
@@@ -215,6 -238,9 +240,9 @@@ static inline bool printk_timed_ratelim
                { return false; }
  #endif
  
+ extern int printk_needs_cpu(int cpu);
+ extern void printk_tick(void);
  extern void asmlinkage __attribute__((format(printf, 1, 2)))
        early_printk(const char *fmt, ...);
  
@@@ -237,9 -263,10 +265,10 @@@ extern int oops_in_progress;             /* If set
  extern int panic_timeout;
  extern int panic_on_oops;
  extern int panic_on_unrecovered_nmi;
- extern int tainted;
  extern const char *print_tainted(void);
- extern void add_taint(unsigned);
+ extern void add_taint(unsigned flag);
+ extern int test_taint(unsigned flag);
+ extern unsigned long get_taint(void);
  extern int root_mountflags;
  
  /* Values used for system_state */
@@@ -252,16 -279,17 +281,17 @@@ extern enum system_states 
        SYSTEM_SUSPEND_DISK,
  } system_state;
  
- #define TAINT_PROPRIETARY_MODULE      (1<<0)
- #define TAINT_FORCED_MODULE           (1<<1)
- #define TAINT_UNSAFE_SMP              (1<<2)
- #define TAINT_FORCED_RMMOD            (1<<3)
- #define TAINT_MACHINE_CHECK           (1<<4)
- #define TAINT_BAD_PAGE                        (1<<5)
- #define TAINT_USER                    (1<<6)
- #define TAINT_DIE                     (1<<7)
- #define TAINT_OVERRIDDEN_ACPI_TABLE   (1<<8)
- #define TAINT_WARN                    (1<<9)
+ #define TAINT_PROPRIETARY_MODULE      0
+ #define TAINT_FORCED_MODULE           1
+ #define TAINT_UNSAFE_SMP              2
+ #define TAINT_FORCED_RMMOD            3
+ #define TAINT_MACHINE_CHECK           4
+ #define TAINT_BAD_PAGE                        5
+ #define TAINT_USER                    6
+ #define TAINT_DIE                     7
+ #define TAINT_OVERRIDDEN_ACPI_TABLE   8
+ #define TAINT_WARN                    9
+ #define TAINT_CRAP                    10
  
  extern void dump_stack(void) __cold;
  
@@@ -290,28 -318,36 +320,36 @@@ static inline char *pack_hex_byte(char 
        return buf;
  }
  
- #define pr_emerg(fmt, arg...) \
-       printk(KERN_EMERG fmt, ##arg)
- #define pr_alert(fmt, arg...) \
-       printk(KERN_ALERT fmt, ##arg)
- #define pr_crit(fmt, arg...) \
-       printk(KERN_CRIT fmt, ##arg)
- #define pr_err(fmt, arg...) \
-       printk(KERN_ERR fmt, ##arg)
- #define pr_warning(fmt, arg...) \
-       printk(KERN_WARNING fmt, ##arg)
- #define pr_notice(fmt, arg...) \
-       printk(KERN_NOTICE fmt, ##arg)
- #define pr_info(fmt, arg...) \
-       printk(KERN_INFO fmt, ##arg)
- #ifdef DEBUG
+ #ifndef pr_fmt
+ #define pr_fmt(fmt) fmt
+ #endif
+ #define pr_emerg(fmt, ...) \
+         printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+ #define pr_alert(fmt, ...) \
+         printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
+ #define pr_crit(fmt, ...) \
+         printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+ #define pr_err(fmt, ...) \
+         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+ #define pr_warning(fmt, ...) \
+         printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+ #define pr_notice(fmt, ...) \
+         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
+ #define pr_info(fmt, ...) \
+         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
  /* If you are writing a driver, please use dev_dbg instead */
- #define pr_debug(fmt, arg...) \
-       printk(KERN_DEBUG fmt, ##arg)
+ #if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
+ #define pr_debug(fmt, ...) do { \
+       dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
+       } while (0)
+ #elif defined(DEBUG)
+ #define pr_debug(fmt, ...) \
+       printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
  #else
- #define pr_debug(fmt, arg...) \
-       ({ if (0) printk(KERN_DEBUG fmt, ##arg); 0; })
+ #define pr_debug(fmt, ...) \
+       ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
  #endif
  
  /*
@@@ -488,4 -524,9 +526,9 @@@ struct sysinfo 
  #define NUMA_BUILD 0
  #endif
  
+ /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
+ #ifdef CONFIG_FTRACE_MCOUNT_RECORD
+ # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
+ #endif
  #endif
diff --combined kernel/notifier.c
@@@ -82,14 -82,6 +82,14 @@@ static int __kprobes notifier_call_chai
  
        while (nb && nr_to_call) {
                next_nb = rcu_dereference(nb->next);
 +
 +#ifdef CONFIG_DEBUG_NOTIFIERS
 +              if (unlikely(!func_ptr_is_kernel_text(nb->notifier_call))) {
 +                      WARN(1, "Invalid notifier called!");
 +                      nb = next_nb;
 +                      continue;
 +              }
 +#endif
                ret = nb->notifier_call(nb, val, v);
  
                if (nr_calls)
@@@ -558,7 -550,7 +558,7 @@@ EXPORT_SYMBOL(unregister_reboot_notifie
  
  static ATOMIC_NOTIFIER_HEAD(die_chain);
  
- int notify_die(enum die_val val, const char *str,
+ int notrace notify_die(enum die_val val, const char *str,
               struct pt_regs *regs, long err, int trap, int sig)
  {
        struct die_args args = {
diff --combined kernel/softlockup.c
@@@ -164,7 -164,7 +164,7 @@@ unsigned long __read_mostly sysctl_hung
  /*
   * Zero means infinite timeout - no checking done:
   */
 -unsigned long __read_mostly sysctl_hung_task_timeout_secs = 120;
 +unsigned long __read_mostly sysctl_hung_task_timeout_secs = 480;
  
  unsigned long __read_mostly sysctl_hung_task_warnings = 10;
  
@@@ -226,7 -226,7 +226,7 @@@ static void check_hung_uninterruptible_
         * If the system crashed already then all bets are off,
         * do not report extra hung tasks:
         */
-       if ((tainted & TAINT_DIE) || did_panic)
+       if (test_taint(TAINT_DIE) || did_panic)
                return;
  
        read_lock(&tasklist_lock);
diff --combined lib/Kconfig.debug
@@@ -495,6 -495,15 +495,15 @@@ config DEBUG_V
  
          If unsure, say N.
  
+ config DEBUG_VIRTUAL
+       bool "Debug VM translations"
+       depends on DEBUG_KERNEL && X86
+       help
+         Enable some costly sanity checks in virtual to page code. This can
+         catch mistakes with virt_to_page() and friends.
+         If unsure, say N.
  config DEBUG_WRITECOUNT
        bool "Debug filesystem writers count"
        depends on DEBUG_KERNEL
@@@ -536,16 -545,6 +545,16 @@@ config DEBUG_S
  
          If unsure, say N.
  
 +config DEBUG_NOTIFIERS
 +      bool "Debug notifier call chains"
 +      depends on DEBUG_KERNEL
 +      help
 +        Enable this to turn on sanity checking for notifier call chains.
 +        This is most useful for kernel developers to make sure that
 +        modules properly unregister themselves from notifier chains.
 +        This is a relatively cheap check but if you care about maximum
 +        performance, say N.
 +
  config FRAME_POINTER
        bool "Compile the kernel with frame pointers"
        depends on DEBUG_KERNEL && \
@@@ -607,6 -606,19 +616,19 @@@ config RCU_TORTURE_TEST_RUNNABL
          Say N here if you want the RCU torture tests to start only
          after being manually enabled via /proc.
  
+ config RCU_CPU_STALL_DETECTOR
+       bool "Check for stalled CPUs delaying RCU grace periods"
+       depends on CLASSIC_RCU
+       default n
+       help
+         This option causes RCU to printk information on which
+         CPUs are delaying the current grace period, but only when
+         the grace period extends for excessive time periods.
+         Say Y if you want RCU to perform such checks.
+         Say N if you are unsure.
  config KPROBES_SANITY_TEST
        bool "Kprobes sanity tests"
        depends on DEBUG_KERNEL
@@@ -634,6 -646,33 +656,33 @@@ config BACKTRACE_SELF_TES
  
          Say N if you are unsure.
  
+ config DEBUG_BLOCK_EXT_DEVT
+         bool "Force extended block device numbers and spread them"
+       depends on DEBUG_KERNEL
+       depends on BLOCK
+       default n
+       help
+         BIG FAT WARNING: ENABLING THIS OPTION MIGHT BREAK BOOTING ON
+         SOME DISTRIBUTIONS.  DO NOT ENABLE THIS UNLESS YOU KNOW WHAT
+         YOU ARE DOING.  Distros, please enable this and fix whatever
+         is broken.
+         Conventionally, block device numbers are allocated from
+         predetermined contiguous area.  However, extended block area
+         may introduce non-contiguous block device numbers.  This
+         option forces most block device numbers to be allocated from
+         the extended space and spreads them to discover kernel or
+         userland code paths which assume predetermined contiguous
+         device number allocation.
+         Note that turning on this debug option shuffles all the
+         device numbers for all IDE and SCSI devices including libata
+         ones, so root partition specified using device number
+         directly (via rdev or root=MAJ:MIN) won't work anymore.
+         Textual device names (root=/dev/sdXn) will continue to work.
+         Say N if you are unsure.
  config LKDTM
        tristate "Linux Kernel Dump Test Tool Module"
        depends on DEBUG_KERNEL
@@@ -671,10 -710,21 +720,21 @@@ config FAIL_PAGE_ALLO
  
  config FAIL_MAKE_REQUEST
        bool "Fault-injection capability for disk IO"
-       depends on FAULT_INJECTION
+       depends on FAULT_INJECTION && BLOCK
        help
          Provide fault-injection capability for disk IO.
  
+ config FAIL_IO_TIMEOUT
+       bool "Faul-injection capability for faking disk interrupts"
+       depends on FAULT_INJECTION && BLOCK
+       help
+         Provide fault-injection capability on end IO handling. This
+         will make the block layer "forget" an interrupt as configured,
+         thus exercising the error handling.
+         Only works with drivers that use the generic timeout handling,
+         for others it wont do anything.
  config FAULT_INJECTION_DEBUG_FS
        bool "Debugfs entries for fault-injection capabilities"
        depends on FAULT_INJECTION && SYSFS && DEBUG_FS
@@@ -762,6 -812,61 +822,61 @@@ menuconfig BUILD_DOCSR
  
          Say N if you are unsure.
  
+ config DYNAMIC_PRINTK_DEBUG
+       bool "Enable dynamic printk() call support"
+       default n
+       depends on PRINTK
+       select PRINTK_DEBUG
+       help
+         Compiles debug level messages into the kernel, which would not
+         otherwise be available at runtime. These messages can then be
+         enabled/disabled on a per module basis. This mechanism implicitly
+         enables all pr_debug() and dev_dbg() calls. The impact of this
+         compile option is a larger kernel text size of about 2%.
+         Usage:
+         Dynamic debugging is controlled by the debugfs file,
+         dynamic_printk/modules. This file contains a list of the modules that
+         can be enabled. The format of the file is the module name, followed
+         by a set of flags that can be enabled. The first flag is always the
+         'enabled' flag. For example:
+               <module_name> <enabled=0/1>
+                               .
+                               .
+                               .
+         <module_name> : Name of the module in which the debug call resides
+         <enabled=0/1> : whether the messages are enabled or not
+         From a live system:
+               snd_hda_intel enabled=0
+               fixup enabled=0
+               driver enabled=0
+         Enable a module:
+               $echo "set enabled=1 <module_name>" > dynamic_printk/modules
+         Disable a module:
+               $echo "set enabled=0 <module_name>" > dynamic_printk/modules
+         Enable all modules:
+               $echo "set enabled=1 all" > dynamic_printk/modules
+         Disable all modules:
+               $echo "set enabled=0 all" > dynamic_printk/modules
+         Finally, passing "dynamic_printk" at the command line enables
+         debugging for all modules. This mode can be turned off via the above
+         disable command.
  source "samples/Kconfig"
  
  source "lib/Kconfig.kgdb"