Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 5 Dec 2009 23:33:27 +0000 (15:33 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 5 Dec 2009 23:33:27 +0000 (15:33 -0800)
* 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Limit number of per cpu TSC sync messages
  x86: dumpstack, 64-bit: Disable preemption when walking the IRQ/exception stacks
  x86: dumpstack: Clean up the x86_stack_ids[][] initalization and other details
  x86, cpu: mv display_cacheinfo -> cpu_detect_cache_sizes
  x86: Suppress stack overrun message for init_task
  x86: Fix cpu_devs[] initialization in early_cpu_init()
  x86: Remove CPU cache size output for non-Intel too
  x86: Minimise printk spew from per-vendor init code
  x86: Remove the CPU cache size printk's
  cpumask: Avoid cpumask_t in arch/x86/kernel/apic/nmi.c
  x86: Make sure we also print a Code: line for show_regs()

1  2 
arch/x86/kernel/cpu/common.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/mm/fault.c

@@@ -61,7 -61,7 +61,7 @@@ void __init setup_cpu_local_masks(void
  static void __cpuinit default_init(struct cpuinfo_x86 *c)
  {
  #ifdef CONFIG_X86_64
-       display_cacheinfo(c);
+       cpu_detect_cache_sizes(c);
  #else
        /* Not much we can do here... */
        /* Check if at least it has cpuid */
@@@ -383,7 -383,7 +383,7 @@@ static void __cpuinit get_model_name(st
        }
  }
  
- void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
+ void __cpuinit cpu_detect_cache_sizes(struct cpuinfo_x86 *c)
  {
        unsigned int n, dummy, ebx, ecx, edx, l2size;
  
  
        if (n >= 0x80000005) {
                cpuid(0x80000005, &dummy, &ebx, &ecx, &edx);
-               printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), D cache %dK (%d bytes/line)\n",
-                               edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
                c->x86_cache_size = (ecx>>24) + (edx>>24);
  #ifdef CONFIG_X86_64
                /* On K8 L1 TLB is inclusive, so don't count it */
  #endif
  
        c->x86_cache_size = l2size;
-       printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n",
-                       l2size, ecx & 0xFF);
  }
  
  void __cpuinit detect_ht(struct cpuinfo_x86 *c)
@@@ -659,24 -654,31 +654,31 @@@ void __init early_cpu_init(void
        const struct cpu_dev *const *cdev;
        int count = 0;
  
+ #ifdef PROCESSOR_SELECT
        printk(KERN_INFO "KERNEL supported cpus:\n");
+ #endif
        for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) {
                const struct cpu_dev *cpudev = *cdev;
-               unsigned int j;
  
                if (count >= X86_VENDOR_NUM)
                        break;
                cpu_devs[count] = cpudev;
                count++;
  
-               for (j = 0; j < 2; j++) {
-                       if (!cpudev->c_ident[j])
-                               continue;
-                       printk(KERN_INFO "  %s %s\n", cpudev->c_vendor,
-                               cpudev->c_ident[j]);
+ #ifdef PROCESSOR_SELECT
+               {
+                       unsigned int j;
+                       for (j = 0; j < 2; j++) {
+                               if (!cpudev->c_ident[j])
+                                       continue;
+                               printk(KERN_INFO "  %s %s\n", cpudev->c_vendor,
+                                       cpudev->c_ident[j]);
+                       }
                }
+ #endif
        }
        early_identify_cpu(&boot_cpu_data);
  }
  
@@@ -837,8 -839,10 +839,8 @@@ static void __cpuinit identify_cpu(stru
                        boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
        }
  
 -#ifdef CONFIG_X86_MCE
        /* Init Machine Check Exception if available. */
 -      mcheck_init(c);
 -#endif
 +      mcheck_cpu_init(c);
  
        select_idle_routine(c);
  
@@@ -58,7 -58,6 +58,7 @@@
  #include <asm/idle.h>
  #include <asm/syscalls.h>
  #include <asm/ds.h>
 +#include <asm/debugreg.h>
  
  asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
  
@@@ -135,7 -134,7 +135,7 @@@ void __show_regs(struct pt_regs *regs, 
                ss = regs->ss & 0xffff;
                gs = get_user_gs(regs);
        } else {
 -              sp = (unsigned long) (&regs->sp);
 +              sp = kernel_stack_pointer(regs);
                savesegment(ss, ss);
                savesegment(gs, gs);
        }
  
  void show_regs(struct pt_regs *regs)
  {
-       __show_regs(regs, 1);
+       show_registers(regs);
        show_trace(NULL, regs, &regs->sp, regs->bp);
  }
  
@@@ -260,12 -259,7 +260,12 @@@ int copy_thread(unsigned long clone_fla
  
        task_user_gs(p) = get_user_gs(regs);
  
 +      p->thread.io_bitmap_ptr = NULL;
        tsk = current;
 +      err = -ENOMEM;
 +
 +      memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
 +
        if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
                p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr,
                                                IO_BITMAP_BYTES, GFP_KERNEL);
@@@ -52,7 -52,6 +52,7 @@@
  #include <asm/idle.h>
  #include <asm/syscalls.h>
  #include <asm/ds.h>
 +#include <asm/debugreg.h>
  
  asmlinkage extern void ret_from_fork(void);
  
@@@ -227,8 -226,7 +227,7 @@@ void __show_regs(struct pt_regs *regs, 
  
  void show_regs(struct pt_regs *regs)
  {
-       printk(KERN_INFO "CPU %d:", smp_processor_id());
-       __show_regs(regs, 1);
+       show_registers(regs);
        show_trace(NULL, regs, (void *)(regs + 1), regs->bp);
  }
  
@@@ -298,16 -296,12 +297,16 @@@ int copy_thread(unsigned long clone_fla
  
        p->thread.fs = me->thread.fs;
        p->thread.gs = me->thread.gs;
 +      p->thread.io_bitmap_ptr = NULL;
  
        savesegment(gs, p->thread.gsindex);
        savesegment(fs, p->thread.fsindex);
        savesegment(es, p->thread.es);
        savesegment(ds, p->thread.ds);
  
 +      err = -ENOMEM;
 +      memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
 +
        if (unlikely(test_tsk_thread_flag(me, TIF_IO_BITMAP))) {
                p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
                if (!p->thread.io_bitmap_ptr) {
@@@ -346,7 -340,6 +345,7 @@@ out
                kfree(p->thread.io_bitmap_ptr);
                p->thread.io_bitmap_max = 0;
        }
 +
        return err;
  }
  
@@@ -501,7 -494,6 +500,7 @@@ __switch_to(struct task_struct *prev_p
         */
        if (preload_fpu)
                __math_state_restore();
 +
        return prev_p;
  }
  
@@@ -671,8 -663,3 +670,8 @@@ long sys_arch_prctl(int code, unsigned 
        return do_arch_prctl(current, code, addr);
  }
  
 +unsigned long KSTK_ESP(struct task_struct *task)
 +{
 +      return (test_tsk_thread_flag(task, TIF_IA32)) ?
 +                      (task_pt_regs(task)->sp) : ((task)->thread.usersp);
 +}
diff --combined arch/x86/mm/fault.c
@@@ -38,8 -38,7 +38,8 @@@ enum x86_pf_error_code 
   * Returns 0 if mmiotrace is disabled, or if the fault is not
   * handled by mmiotrace:
   */
 -static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr)
 +static inline int __kprobes
 +kmmio_fault(struct pt_regs *regs, unsigned long addr)
  {
        if (unlikely(is_kmmio_active()))
                if (kmmio_handler(regs, addr) == 1)
@@@ -47,7 -46,7 +47,7 @@@
        return 0;
  }
  
 -static inline int notify_page_fault(struct pt_regs *regs)
 +static inline int __kprobes notify_page_fault(struct pt_regs *regs)
  {
        int ret = 0;
  
@@@ -241,7 -240,7 +241,7 @@@ void vmalloc_sync_all(void
   *
   *   Handle a fault on the vmalloc or module mapping area
   */
 -static noinline int vmalloc_fault(unsigned long address)
 +static noinline __kprobes int vmalloc_fault(unsigned long address)
  {
        unsigned long pgd_paddr;
        pmd_t *pmd_k;
@@@ -358,7 -357,7 +358,7 @@@ void vmalloc_sync_all(void
   *
   * This assumes no large pages in there.
   */
 -static noinline int vmalloc_fault(unsigned long address)
 +static noinline __kprobes int vmalloc_fault(unsigned long address)
  {
        pgd_t *pgd, *pgd_ref;
        pud_t *pud, *pud_ref;
@@@ -659,7 -658,7 +659,7 @@@ no_context(struct pt_regs *regs, unsign
        show_fault_oops(regs, error_code, address);
  
        stackend = end_of_stack(tsk);
-       if (*stackend != STACK_END_MAGIC)
+       if (tsk != &init_task && *stackend != STACK_END_MAGIC)
                printk(KERN_ALERT "Thread overran stack, or stack corrupted\n");
  
        tsk->thread.cr2         = address;
@@@ -861,7 -860,7 +861,7 @@@ static int spurious_fault_check(unsigne
   * There are no security implications to leaving a stale TLB when
   * increasing the permissions on a page.
   */
 -static noinline int
 +static noinline __kprobes int
  spurious_fault(unsigned long error_code, unsigned long address)
  {
        pgd_t *pgd;