]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 20:07:55 +0000 (13:07 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 20:07:55 +0000 (13:07 -0700)
* 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (225 commits)
  [PATCH] Don't set calgary iommu as default y
  [PATCH] i386/x86-64: New Intel feature flags
  [PATCH] x86: Add a cumulative thermal throttle event counter.
  [PATCH] i386: Make the jiffies compares use the 64bit safe macros.
  [PATCH] x86: Refactor thermal throttle processing
  [PATCH] Add 64bit jiffies compares (for use with get_jiffies_64)
  [PATCH] Fix unwinder warning in traps.c
  [PATCH] x86: Allow disabling early pci scans with pci=noearly or disallowing conf1
  [PATCH] x86: Move direct PCI scanning functions out of line
  [PATCH] i386/x86-64: Make all early PCI scans dependent on CONFIG_PCI
  [PATCH] Don't leak NT bit into next task
  [PATCH] i386/x86-64: Work around gcc bug with noreturn functions in unwinder
  [PATCH] Fix some broken white space in ia32_signal.c
  [PATCH] Initialize argument registers for 32bit signal handlers.
  [PATCH] Remove all traces of signal number conversion
  [PATCH] Don't synchronize time reading on single core AMD systems
  [PATCH] Remove outdated comment in x86-64 mmconfig code
  [PATCH] Use string instructions for Core2 copy/clear
  [PATCH] x86: - restore i8259A eoi status on resume
  [PATCH] i386: Split multi-line printk in oops output.
  ...

27 files changed:
1  2 
Documentation/kernel-parameters.txt
arch/i386/Kconfig
arch/i386/kernel/setup.c
arch/i386/kernel/time.c
arch/i386/kernel/traps.c
arch/i386/mm/discontig.c
arch/i386/mm/init.c
arch/um/sys-i386/Makefile
arch/x86_64/Kconfig
arch/x86_64/kernel/e820.c
arch/x86_64/kernel/setup.c
arch/x86_64/kernel/smpboot.c
arch/x86_64/kernel/time.c
arch/x86_64/mm/fault.c
arch/x86_64/mm/init.c
drivers/pci/pci.c
fs/binfmt_elf.c
include/asm-i386/pgtable.h
include/asm-i386/ptrace.h
include/asm-x86_64/e820.h
include/asm-x86_64/percpu.h
include/asm-x86_64/pgtable.h
include/asm-x86_64/smp.h
include/linux/kernel.h
include/linux/sysctl.h
kernel/sysctl.c
lib/Kconfig.debug

index 766abdab94e70b939233f2fdc62be70275a9f3de,4ae99f6e9938852c4a2b45a4a2966c68f6a594fc..c918cc3f65fbbc3bff4470a0131d4c63bc40a5f7
@@@ -1240,7 -1240,11 +1240,11 @@@ running once the system is up
                                bootloader. This is currently used on
                                IXP2000 systems where the bus has to be
                                configured a certain way for adjunct CPUs.
+               noearly         [X86] Don't do any early type 1 scanning.
+                               This might help on some broken boards which
+                               machine check when some devices' config space
+                               is read. But various workarounds are disabled
+                               and some IOMMU drivers will not work.
        pcmv=           [HW,PCMCIA] BadgePAD 4
  
        pd.             [PARIDE]
  
        reserve=        [KNL,BUGS] Force the kernel to ignore some iomem area
  
 +      reservetop=     [IA-32]
 +                      Format: nn[KMG]
 +                      Reserves a hole at the top of the kernel virtual
 +                      address space.
 +
        resume=         [SWSUSP]
                        Specify the partition device for software suspend
  
diff --combined arch/i386/Kconfig
index 6189b0c28d6f5d24330bdfb396ae3ad9caf47ede,9b6cddc8c51bea5a331ae2f505a0734a4dcb32d1..758044f5e718deba9da1db551c111219f3af5c1c
@@@ -166,7 -166,6 +166,6 @@@ config X86_VISW
  
  config X86_GENERICARCH
         bool "Generic architecture (Summit, bigsmp, ES7000, default)"
-        depends on SMP
         help
            This option compiles in the Summit, bigsmp, ES7000, default subarchitectures.
          It is intended for a generic binary kernel.
@@@ -263,7 -262,7 +262,7 @@@ source "kernel/Kconfig.preempt
  
  config X86_UP_APIC
        bool "Local APIC support on uniprocessors"
-       depends on !SMP && !(X86_VISWS || X86_VOYAGER)
+       depends on !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH)
        help
          A local APIC (Advanced Programmable Interrupt Controller) is an
          integrated interrupt controller in the CPU. If you have a single-CPU
@@@ -288,12 -287,12 +287,12 @@@ config X86_UP_IOAPI
  
  config X86_LOCAL_APIC
        bool
-       depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER)
+       depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH
        default y
  
  config X86_IO_APIC
        bool
-       depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER))
+       depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH
        default y
  
  config X86_VISWS_APIC
@@@ -494,7 -493,7 +493,7 @@@ config HIGHMEM64
  endchoice
  
  choice
 -      depends on EXPERIMENTAL && !X86_PAE
 +      depends on EXPERIMENTAL
        prompt "Memory split" if EMBEDDED
        default VMSPLIT_3G
        help
        config VMSPLIT_3G
                bool "3G/1G user/kernel split"
        config VMSPLIT_3G_OPT
 +              depends on !HIGHMEM
                bool "3G/1G user/kernel split (for full 1G low memory)"
        config VMSPLIT_2G
                bool "2G/2G user/kernel split"
@@@ -741,8 -739,7 +740,7 @@@ config SECCOM
  source kernel/Kconfig.hz
  
  config KEXEC
-       bool "kexec system call (EXPERIMENTAL)"
-       depends on EXPERIMENTAL
+       bool "kexec system call"
        help
          kexec is a system call that implements the ability to shutdown your
          current kernel, and to start another kernel.  It is like a reboot
@@@ -763,6 -760,13 +761,13 @@@ config CRASH_DUM
        depends on HIGHMEM
        help
          Generate crash dump after being started by kexec.
+           This should be normally only set in special crash dump kernels
+         which are loaded in the main kernel with kexec-tools into
+         a specially reserved region and then later executed after
+         a crash by kdump/kexec. The crash dump kernel must be compiled
+           to a memory address not used by the main kernel or BIOS using
+           PHYSICAL_START.
+         For more details see Documentation/kdump/kdump.txt
  
  config PHYSICAL_START
        hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
@@@ -795,7 -799,6 +800,7 @@@ config HOTPLUG_CP
  config COMPAT_VDSO
        bool "Compat VDSO support"
        default y
 +      depends on !PARAVIRT
        help
          Map the VDSO to the predictable old-style address too.
        ---help---
diff --combined arch/i386/kernel/setup.c
index 16d99444cf66653c446e59534cc9f8e9f704643a,7a99b1369fa24ac8b472e8565e3a31c0944554d8..76a524b4c90f9b9401eb27a9664ffae3db52bd15
@@@ -53,7 -53,6 +53,7 @@@
  #include <asm/apic.h>
  #include <asm/e820.h>
  #include <asm/mpspec.h>
 +#include <asm/mmzone.h>
  #include <asm/setup.h>
  #include <asm/arch_hooks.h>
  #include <asm/sections.h>
@@@ -90,18 -89,6 +90,6 @@@ EXPORT_SYMBOL(boot_cpu_data)
  
  unsigned long mmu_cr4_features;
  
- #ifdef        CONFIG_ACPI
-       int acpi_disabled = 0;
- #else
-       int acpi_disabled = 1;
- #endif
- EXPORT_SYMBOL(acpi_disabled);
- #ifdef        CONFIG_ACPI
- int __initdata acpi_force = 0;
- extern acpi_interrupt_flags   acpi_sci_flags;
- #endif
  /* for MCA, but anyone else can use it if they want */
  unsigned int machine_id;
  #ifdef CONFIG_MCA
@@@ -149,7 -136,6 +137,6 @@@ EXPORT_SYMBOL(ist_info)
  struct e820map e820;
  
  extern void early_cpu_init(void);
- extern void generic_apic_probe(char *);
  extern int root_mountflags;
  
  unsigned long saved_videomode;
@@@ -701,257 -687,133 +688,151 @@@ static inline void copy_edd(void
  }
  #endif
  
- static void __init parse_cmdline_early (char ** cmdline_p)
- {
-       char c = ' ', *to = command_line, *from = saved_command_line;
-       int len = 0;
-       int userdef = 0;
+ static int __initdata user_defined_memmap = 0;
  
-       /* Save unparsed command line copy for /proc/cmdline */
-       saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
+ /*
+  * "mem=nopentium" disables the 4MB page tables.
+  * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
+  * to <mem>, overriding the bios size.
+  * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
+  * <start> to <start>+<mem>, overriding the bios size.
+  *
+  * HPA tells me bootloaders need to parse mem=, so no new
+  * option should be mem=  [also see Documentation/i386/boot.txt]
+  */
+ static int __init parse_mem(char *arg)
+ {
+       if (!arg)
+               return -EINVAL;
  
-       for (;;) {
-               if (c != ' ')
-                       goto next_char;
-               /*
-                * "mem=nopentium" disables the 4MB page tables.
-                * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
-                * to <mem>, overriding the bios size.
-                * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from
-                * <start> to <start>+<mem>, overriding the bios size.
-                *
-                * HPA tells me bootloaders need to parse mem=, so no new
-                * option should be mem=  [also see Documentation/i386/boot.txt]
+       if (strcmp(arg, "nopentium") == 0) {
+               clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
+               disable_pse = 1;
+       } else {
+               /* If the user specifies memory size, we
+                * limit the BIOS-provided memory map to
+                * that size. exactmap can be used to specify
+                * the exact map. mem=number can be used to
+                * trim the existing memory map.
                 */
-               if (!memcmp(from, "mem=", 4)) {
-                       if (to != command_line)
-                               to--;
-                       if (!memcmp(from+4, "nopentium", 9)) {
-                               from += 9+4;
-                               clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
-                               disable_pse = 1;
-                       } else {
-                               /* If the user specifies memory size, we
-                                * limit the BIOS-provided memory map to
-                                * that size. exactmap can be used to specify
-                                * the exact map. mem=number can be used to
-                                * trim the existing memory map.
-                                */
-                               unsigned long long mem_size;
+               unsigned long long mem_size;
   
-                               mem_size = memparse(from+4, &from);
-                               limit_regions(mem_size);
-                               userdef=1;
-                       }
-               }
-               else if (!memcmp(from, "memmap=", 7)) {
-                       if (to != command_line)
-                               to--;
-                       if (!memcmp(from+7, "exactmap", 8)) {
- #ifdef CONFIG_CRASH_DUMP
-                               /* If we are doing a crash dump, we
-                                * still need to know the real mem
-                                * size before original memory map is
-                                * reset.
-                                */
-                               find_max_pfn();
-                               saved_max_pfn = max_pfn;
- #endif
-                               from += 8+7;
-                               e820.nr_map = 0;
-                               userdef = 1;
-                       } else {
-                               /* If the user specifies memory size, we
-                                * limit the BIOS-provided memory map to
-                                * that size. exactmap can be used to specify
-                                * the exact map. mem=number can be used to
-                                * trim the existing memory map.
-                                */
-                               unsigned long long start_at, mem_size;
-  
-                               mem_size = memparse(from+7, &from);
-                               if (*from == '@') {
-                                       start_at = memparse(from+1, &from);
-                                       add_memory_region(start_at, mem_size, E820_RAM);
-                               } else if (*from == '#') {
-                                       start_at = memparse(from+1, &from);
-                                       add_memory_region(start_at, mem_size, E820_ACPI);
-                               } else if (*from == '$') {
-                                       start_at = memparse(from+1, &from);
-                                       add_memory_region(start_at, mem_size, E820_RESERVED);
-                               } else {
-                                       limit_regions(mem_size);
-                                       userdef=1;
-                               }
-                       }
-               }
-               else if (!memcmp(from, "noexec=", 7))
-                       noexec_setup(from + 7);
+               mem_size = memparse(arg, &arg);
+               limit_regions(mem_size);
+               user_defined_memmap = 1;
+       }
+       return 0;
+ }
+ early_param("mem", parse_mem);
  
+ static int __init parse_memmap(char *arg)
+ {
+       if (!arg)
+               return -EINVAL;
  
- #ifdef  CONFIG_X86_SMP
-               /*
-                * If the BIOS enumerates physical processors before logical,
-                * maxcpus=N at enumeration-time can be used to disable HT.
+       if (strcmp(arg, "exactmap") == 0) {
+ #ifdef CONFIG_CRASH_DUMP
+               /* If we are doing a crash dump, we
+                * still need to know the real mem
+                * size before original memory map is
+                * reset.
                 */
-               else if (!memcmp(from, "maxcpus=", 8)) {
-                       extern unsigned int maxcpus;
-                       maxcpus = simple_strtoul(from + 8, NULL, 0);
-               }
+               find_max_pfn();
+               saved_max_pfn = max_pfn;
  #endif
- #ifdef CONFIG_ACPI
-               /* "acpi=off" disables both ACPI table parsing and interpreter */
-               else if (!memcmp(from, "acpi=off", 8)) {
-                       disable_acpi();
-               }
-               /* acpi=force to over-ride black-list */
-               else if (!memcmp(from, "acpi=force", 10)) {
-                       acpi_force = 1;
-                       acpi_ht = 1;
-                       acpi_disabled = 0;
-               }
-               /* acpi=strict disables out-of-spec workarounds */
-               else if (!memcmp(from, "acpi=strict", 11)) {
-                       acpi_strict = 1;
-               }
-               /* Limit ACPI just to boot-time to enable HT */
-               else if (!memcmp(from, "acpi=ht", 7)) {
-                       if (!acpi_force)
-                               disable_acpi();
-                       acpi_ht = 1;
-               }
-               
-               /* "pci=noacpi" disable ACPI IRQ routing and PCI scan */
-               else if (!memcmp(from, "pci=noacpi", 10)) {
-                       acpi_disable_pci();
-               }
-               /* "acpi=noirq" disables ACPI interrupt routing */
-               else if (!memcmp(from, "acpi=noirq", 10)) {
-                       acpi_noirq_set();
+               e820.nr_map = 0;
+               user_defined_memmap = 1;
+       } else {
+               /* If the user specifies memory size, we
+                * limit the BIOS-provided memory map to
+                * that size. exactmap can be used to specify
+                * the exact map. mem=number can be used to
+                * trim the existing memory map.
+                */
+               unsigned long long start_at, mem_size;
+               mem_size = memparse(arg, &arg);
+               if (*arg == '@') {
+                       start_at = memparse(arg+1, &arg);
+                       add_memory_region(start_at, mem_size, E820_RAM);
+               } else if (*arg == '#') {
+                       start_at = memparse(arg+1, &arg);
+                       add_memory_region(start_at, mem_size, E820_ACPI);
+               } else if (*arg == '$') {
+                       start_at = memparse(arg+1, &arg);
+                       add_memory_region(start_at, mem_size, E820_RESERVED);
+               } else {
+                       limit_regions(mem_size);
+                       user_defined_memmap = 1;
                }
+       }
+       return 0;
+ }
+ early_param("memmap", parse_memmap);
  
-               else if (!memcmp(from, "acpi_sci=edge", 13))
-                       acpi_sci_flags.trigger =  1;
-               else if (!memcmp(from, "acpi_sci=level", 14))
-                       acpi_sci_flags.trigger = 3;
-               else if (!memcmp(from, "acpi_sci=high", 13))
-                       acpi_sci_flags.polarity = 1;
-               else if (!memcmp(from, "acpi_sci=low", 12))
-                       acpi_sci_flags.polarity = 3;
- #ifdef CONFIG_X86_IO_APIC
-               else if (!memcmp(from, "acpi_skip_timer_override", 24))
-                       acpi_skip_timer_override = 1;
-               if (!memcmp(from, "disable_timer_pin_1", 19))
-                       disable_timer_pin_1 = 1;
-               if (!memcmp(from, "enable_timer_pin_1", 18))
-                       disable_timer_pin_1 = -1;
+ #ifdef CONFIG_PROC_VMCORE
+ /* elfcorehdr= specifies the location of elf core header
+  * stored by the crashed kernel.
+  */
+ static int __init parse_elfcorehdr(char *arg)
+ {
+       if (!arg)
+               return -EINVAL;
  
-               /* disable IO-APIC */
-               else if (!memcmp(from, "noapic", 6))
-                       disable_ioapic_setup();
- #endif /* CONFIG_X86_IO_APIC */
- #endif /* CONFIG_ACPI */
+       elfcorehdr_addr = memparse(arg, &arg);
+       return 0;
+ }
+ early_param("elfcorehdr", parse_elfcorehdr);
+ #endif /* CONFIG_PROC_VMCORE */
  
- #ifdef CONFIG_X86_LOCAL_APIC
-               /* enable local APIC */
-               else if (!memcmp(from, "lapic", 5))
-                       lapic_enable();
+ /*
+  * highmem=size forces highmem to be exactly 'size' bytes.
+  * This works even on boxes that have no highmem otherwise.
+  * This also works to reduce highmem size on bigger boxes.
+  */
+ static int __init parse_highmem(char *arg)
+ {
+       if (!arg)
+               return -EINVAL;
  
-               /* disable local APIC */
-               else if (!memcmp(from, "nolapic", 6))
-                       lapic_disable();
- #endif /* CONFIG_X86_LOCAL_APIC */
+       highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT;
+       return 0;
+ }
+ early_param("highmem", parse_highmem);
  
- #ifdef CONFIG_KEXEC
-               /* crashkernel=size@addr specifies the location to reserve for
-                * a crash kernel.  By reserving this memory we guarantee
-                * that linux never set's it up as a DMA target.
-                * Useful for holding code to do something appropriate
-                * after a kernel panic.
-                */
-               else if (!memcmp(from, "crashkernel=", 12)) {
-                       unsigned long size, base;
-                       size = memparse(from+12, &from);
-                       if (*from == '@') {
-                               base = memparse(from+1, &from);
-                               /* FIXME: Do I want a sanity check
-                                * to validate the memory range?
-                                */
-                               crashk_res.start = base;
-                               crashk_res.end   = base + size - 1;
-                       }
-               }
- #endif
- #ifdef CONFIG_PROC_VMCORE
-               /* elfcorehdr= specifies the location of elf core header
-                * stored by the crashed kernel.
-                */
-               else if (!memcmp(from, "elfcorehdr=", 11))
-                       elfcorehdr_addr = memparse(from+11, &from);
- #endif
+ /*
+  * vmalloc=size forces the vmalloc area to be exactly 'size'
+  * bytes. This can be used to increase (or decrease) the
+  * vmalloc area - the default is 128m.
+  */
+ static int __init parse_vmalloc(char *arg)
+ {
+       if (!arg)
+               return -EINVAL;
  
-               /*
-                * highmem=size forces highmem to be exactly 'size' bytes.
-                * This works even on boxes that have no highmem otherwise.
-                * This also works to reduce highmem size on bigger boxes.
-                */
-               else if (!memcmp(from, "highmem=", 8))
-                       highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT;
-       
-               /*
-                * vmalloc=size forces the vmalloc area to be exactly 'size'
-                * bytes. This can be used to increase (or decrease) the
-                * vmalloc area - the default is 128m.
-                */
-               else if (!memcmp(from, "vmalloc=", 8))
-                       __VMALLOC_RESERVE = memparse(from+8, &from);
-       next_char:
-               c = *(from++);
-               if (!c)
-                       break;
-               if (COMMAND_LINE_SIZE <= ++len)
-                       break;
-               *(to++) = c;
-       }
-       *to = '\0';
-       *cmdline_p = command_line;
-       if (userdef) {
-               printk(KERN_INFO "user-defined physical RAM map:\n");
-               print_memory_map("user");
-       }
+       __VMALLOC_RESERVE = memparse(arg, &arg);
+       return 0;
  }
+ early_param("vmalloc", parse_vmalloc);
  
 +/*
 + * reservetop=size reserves a hole at the top of the kernel address space which
 + * a hypervisor can load into later.  Needed for dynamically loaded hypervisors,
 + * so relocating the fixmap can be done before paging initialization.
 + */
 +static int __init parse_reservetop(char *arg)
 +{
 +      unsigned long address;
 +
 +      if (!arg)
 +              return -EINVAL;
 +
 +      address = memparse(arg, &arg);
 +      reserve_top_address(address);
 +      return 0;
 +}
 +early_param("reservetop", parse_reservetop);
 +
  /*
   * Callback for efi_memory_walk.
   */
@@@ -1189,6 -1051,14 +1070,14 @@@ static unsigned long __init setup_memor
        }
        printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
                pages_to_mb(highend_pfn - highstart_pfn));
+       num_physpages = highend_pfn;
+       high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
+ #else
+       num_physpages = max_low_pfn;
+       high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
+ #endif
+ #ifdef CONFIG_FLATMEM
+       max_mapnr = num_physpages;
  #endif
        printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
                        pages_to_mb(max_low_pfn));
  
  void __init zone_sizes_init(void)
  {
 -      unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
 +      unsigned long zones_size[MAX_NR_ZONES] = { 0, };
        unsigned int max_dma, low;
  
        max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
@@@ -1277,7 -1147,7 +1166,7 @@@ void __init setup_bootmem_allocator(voi
         */
        find_smp_config();
  #endif
 -
 +      numa_kva_reserve();
  #ifdef CONFIG_BLK_DEV_INITRD
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
@@@ -1518,17 -1388,15 +1407,15 @@@ void __init setup_arch(char **cmdline_p
        data_resource.start = virt_to_phys(_etext);
        data_resource.end = virt_to_phys(_edata)-1;
  
-       parse_cmdline_early(cmdline_p);
+       parse_early_param();
  
- #ifdef CONFIG_EARLY_PRINTK
-       {
-               char *s = strstr(*cmdline_p, "earlyprintk=");
-               if (s) {
-                       setup_early_printk(strchr(s, '=') + 1);
-                       printk("early console enabled\n");
-               }
+       if (user_defined_memmap) {
+               printk(KERN_INFO "user-defined physical RAM map:\n");
+               print_memory_map("user");
        }
- #endif
+       strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
+       *cmdline_p = command_line;
  
        max_low_pfn = setup_memory();
  
        dmi_scan_machine();
  
  #ifdef CONFIG_X86_GENERICARCH
-       generic_apic_probe(*cmdline_p);
+       generic_apic_probe();
  #endif        
        if (efi_enabled)
                efi_map_memmap();
        acpi_boot_table_init();
  #endif
  
+ #ifdef CONFIG_PCI
  #ifdef CONFIG_X86_IO_APIC
        check_acpi_pci();       /* Checks more than just ACPI actually */
  #endif
+ #endif
  
  #ifdef CONFIG_ACPI
        acpi_boot_init();
diff --combined arch/i386/kernel/time.c
index 1302e4ab3c4f6789a74de1fb142df914f3164baa,5af802ef00b21a6a926828bbc2330238b9dff2b8..86944acfb647228186544f2c8ce3375b9c5d6efe
@@@ -130,18 -130,33 +130,33 @@@ static int set_rtc_mmss(unsigned long n
  
  int timer_ack;
  
- #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
  unsigned long profile_pc(struct pt_regs *regs)
  {
        unsigned long pc = instruction_pointer(regs);
  
-       if (!user_mode_vm(regs) && in_lock_functions(pc))
+ #ifdef CONFIG_SMP
+       if (!user_mode_vm(regs) && in_lock_functions(pc)) {
+ #ifdef CONFIG_FRAME_POINTER
                return *(unsigned long *)(regs->ebp + 4);
+ #else
+               unsigned long *sp;
+               if ((regs->xcs & 3) == 0)
+                       sp = (unsigned long *)&regs->esp;
+               else
+                       sp = (unsigned long *)regs->esp;
+               /* Return address is either directly at stack pointer
+                  or above a saved eflags. Eflags has bits 22-31 zero,
+                  kernel addresses don't. */
+               if (sp[0] >> 22)
+                       return sp[0];
+               if (sp[1] >> 22)
+                       return sp[1];
+ #endif
+       }
+ #endif
        return pc;
  }
  EXPORT_SYMBOL(profile_pc);
- #endif
  
  /*
   * This is the same as the above, except we _also_ save the current
@@@ -270,19 -285,16 +285,19 @@@ void notify_arch_cmos_timer(void
        mod_timer(&sync_cmos_timer, jiffies + 1);
  }
  
 -static long clock_cmos_diff, sleep_start;
 +static long clock_cmos_diff;
 +static unsigned long sleep_start;
  
  static int timer_suspend(struct sys_device *dev, pm_message_t state)
  {
        /*
         * Estimate time zone so that set_time can update the clock
         */
 -      clock_cmos_diff = -get_cmos_time();
 +      unsigned long ctime =  get_cmos_time();
 +
 +      clock_cmos_diff = -ctime;
        clock_cmos_diff += get_seconds();
 -      sleep_start = get_cmos_time();
 +      sleep_start = ctime;
        return 0;
  }
  
@@@ -290,29 -302,18 +305,29 @@@ static int timer_resume(struct sys_devi
  {
        unsigned long flags;
        unsigned long sec;
 -      unsigned long sleep_length;
 -
 +      unsigned long ctime = get_cmos_time();
 +      long sleep_length = (ctime - sleep_start) * HZ;
 +      struct timespec ts;
 +
 +      if (sleep_length < 0) {
 +              printk(KERN_WARNING "CMOS clock skew detected in timer resume!\n");
 +              /* The time after the resume must not be earlier than the time
 +               * before the suspend or some nasty things will happen
 +               */
 +              sleep_length = 0;
 +              ctime = sleep_start;
 +      }
  #ifdef CONFIG_HPET_TIMER
        if (is_hpet_enabled())
                hpet_reenable();
  #endif
        setup_pit_timer();
 -      sec = get_cmos_time() + clock_cmos_diff;
 -      sleep_length = (get_cmos_time() - sleep_start) * HZ;
 +
 +      sec = ctime + clock_cmos_diff;
 +      ts.tv_sec = sec;
 +      ts.tv_nsec = 0;
 +      do_settimeofday(&ts);
        write_seqlock_irqsave(&xtime_lock, flags);
 -      xtime.tv_sec = sec;
 -      xtime.tv_nsec = 0;
        jiffies_64 += sleep_length;
        wall_jiffies += sleep_length;
        write_sequnlock_irqrestore(&xtime_lock, flags);
@@@ -348,11 -349,10 +363,11 @@@ extern void (*late_time_init)(void)
  /* Duplicate of time_init() below, with hpet_enable part added */
  static void __init hpet_time_init(void)
  {
 -      xtime.tv_sec = get_cmos_time();
 -      xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
 -      set_normalized_timespec(&wall_to_monotonic,
 -              -xtime.tv_sec, -xtime.tv_nsec);
 +      struct timespec ts;
 +      ts.tv_sec = get_cmos_time();
 +      ts.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
 +
 +      do_settimeofday(&ts);
  
        if ((hpet_enable() >= 0) && hpet_use_timer) {
                printk("Using HPET for base-timer\n");
  
  void __init time_init(void)
  {
 +      struct timespec ts;
  #ifdef CONFIG_HPET_TIMER
        if (is_hpet_capable()) {
                /*
                return;
        }
  #endif
 -      xtime.tv_sec = get_cmos_time();
 -      xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
 -      set_normalized_timespec(&wall_to_monotonic,
 -              -xtime.tv_sec, -xtime.tv_nsec);
 +      ts.tv_sec = get_cmos_time();
 +      ts.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
 +
 +      do_settimeofday(&ts);
  
        time_init_hook();
  }
diff --combined arch/i386/kernel/traps.c
index 4fcc6690be9923821369198c1d815995633677c9,c7adb076e811598d0a00a9c496e773be64bb8e01..21aa1cd5777317d3b079db3e781fbadae2c7e2a6
@@@ -51,6 -51,7 +51,7 @@@
  #include <asm/smp.h>
  #include <asm/arch_hooks.h>
  #include <asm/kdebug.h>
+ #include <asm/stacktrace.h>
  
  #include <linux/module.h>
  
@@@ -118,26 -119,16 +119,16 @@@ static inline int valid_stack_ptr(struc
                p < (void *)tinfo + THREAD_SIZE - 3;
  }
  
- /*
-  * Print one address/symbol entries per line.
-  */
- static inline void print_addr_and_symbol(unsigned long addr, char *log_lvl)
- {
-       printk(" [<%08lx>] ", addr);
-       print_symbol("%s\n", addr);
- }
  static inline unsigned long print_context_stack(struct thread_info *tinfo,
                                unsigned long *stack, unsigned long ebp,
-                               char *log_lvl)
+                               struct stacktrace_ops *ops, void *data)
  {
        unsigned long addr;
  
  #ifdef        CONFIG_FRAME_POINTER
        while (valid_stack_ptr(tinfo, (void *)ebp)) {
                addr = *(unsigned long *)(ebp + 4);
-               print_addr_and_symbol(addr, log_lvl);
+               ops->address(data, addr);
                /*
                 * break out of recursive entries (such as
                 * end_of_stack_stop_unwind_function):
        while (valid_stack_ptr(tinfo, stack)) {
                addr = *stack++;
                if (__kernel_text_address(addr))
-                       print_addr_and_symbol(addr, log_lvl);
+                       ops->address(data, addr);
        }
  #endif
        return ebp;
  }
  
+ struct ops_and_data {
+       struct stacktrace_ops *ops;
+       void *data;
+ };
  static asmlinkage int
show_trace_unwind(struct unwind_frame_info *info, void *log_lvl)
dump_trace_unwind(struct unwind_frame_info *info, void *data)
  {
+       struct ops_and_data *oad = (struct ops_and_data *)data;
        int n = 0;
  
        while (unwind(info) == 0 && UNW_PC(info)) {
                n++;
-               print_addr_and_symbol(UNW_PC(info), log_lvl);
+               oad->ops->address(oad->data, UNW_PC(info));
                if (arch_unw_user_mode(info))
                        break;
        }
        return n;
  }
  
- static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
-                              unsigned long *stack, char *log_lvl)
+ void dump_trace(struct task_struct *task, struct pt_regs *regs,
+               unsigned long *stack,
+               struct stacktrace_ops *ops, void *data)
  {
-       unsigned long ebp;
+       unsigned long ebp = 0;
  
        if (!task)
                task = current;
        if (call_trace >= 0) {
                int unw_ret = 0;
                struct unwind_frame_info info;
+               struct ops_and_data oad = { .ops = ops, .data = data };
  
                if (regs) {
                        if (unwind_init_frame_info(&info, task, regs) == 0)
-                               unw_ret = show_trace_unwind(&info, log_lvl);
+                               unw_ret = dump_trace_unwind(&info, &oad);
                } else if (task == current)
-                       unw_ret = unwind_init_running(&info, show_trace_unwind, log_lvl);
+                       unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad);
                else {
                        if (unwind_init_blocked(&info, task) == 0)
-                               unw_ret = show_trace_unwind(&info, log_lvl);
+                               unw_ret = dump_trace_unwind(&info, &oad);
                }
                if (unw_ret > 0) {
                        if (call_trace == 1 && !arch_unw_user_mode(&info)) {
-                               print_symbol("DWARF2 unwinder stuck at %s\n",
+                               ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n",
                                             UNW_PC(&info));
                                if (UNW_SP(&info) >= PAGE_OFFSET) {
-                                       printk("Leftover inexact backtrace:\n");
+                                       ops->warning(data, "Leftover inexact backtrace:\n");
                                        stack = (void *)UNW_SP(&info);
+                                       if (!stack)
+                                               return;
+                                       ebp = UNW_FP(&info);
                                } else
-                                       printk("Full inexact backtrace again:\n");
+                                       ops->warning(data, "Full inexact backtrace again:\n");
                        } else if (call_trace >= 1)
                                return;
                        else
-                               printk("Full inexact backtrace again:\n");
+                               ops->warning(data, "Full inexact backtrace again:\n");
                } else
-                       printk("Inexact backtrace:\n");
+                       ops->warning(data, "Inexact backtrace:\n");
+       }
+       if (!stack) {
+               unsigned long dummy;
+               stack = &dummy;
+               if (task && task != current)
+                       stack = (unsigned long *)task->thread.esp;
        }
  
-       if (task == current) {
-               /* Grab ebp right from our regs */
-               asm ("movl %%ebp, %0" : "=r" (ebp) : );
-       } else {
-               /* ebp is the last reg pushed by switch_to */
-               ebp = *(unsigned long *) task->thread.esp;
+ #ifdef CONFIG_FRAME_POINTER
+       if (!ebp) {
+               if (task == current) {
+                       /* Grab ebp right from our regs */
+                       asm ("movl %%ebp, %0" : "=r" (ebp) : );
+               } else {
+                       /* ebp is the last reg pushed by switch_to */
+                       ebp = *(unsigned long *) task->thread.esp;
+               }
        }
+ #endif
  
        while (1) {
                struct thread_info *context;
                context = (struct thread_info *)
                        ((unsigned long)stack & (~(THREAD_SIZE - 1)));
-               ebp = print_context_stack(context, stack, ebp, log_lvl);
+               ebp = print_context_stack(context, stack, ebp, ops, data);
+               /* Should be after the line below, but somewhere
+                  in early boot context comes out corrupted and we
+                  can't reference it -AK */
+               if (ops->stack(data, "IRQ") < 0)
+                       break;
                stack = (unsigned long*)context->previous_esp;
                if (!stack)
                        break;
-               printk("%s =======================\n", log_lvl);
        }
  }
+ EXPORT_SYMBOL(dump_trace);
+ static void
+ print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
+ {
+       printk(data);
+       print_symbol(msg, symbol);
+       printk("\n");
+ }
+ static void print_trace_warning(void *data, char *msg)
+ {
+       printk("%s%s\n", (char *)data, msg);
+ }
+ static int print_trace_stack(void *data, char *name)
+ {
+       return 0;
+ }
+ /*
+  * Print one address/symbol entries per line.
+  */
+ static void print_trace_address(void *data, unsigned long addr)
+ {
+       printk("%s [<%08lx>] ", (char *)data, addr);
+       print_symbol("%s\n", addr);
+ }
+ static struct stacktrace_ops print_trace_ops = {
+       .warning = print_trace_warning,
+       .warning_symbol = print_trace_warning_symbol,
+       .stack = print_trace_stack,
+       .address = print_trace_address,
+ };
+ static void
+ show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
+                  unsigned long * stack, char *log_lvl)
+ {
+       dump_trace(task, regs, stack, &print_trace_ops, log_lvl);
+       printk("%s =======================\n", log_lvl);
+ }
  
- void show_trace(struct task_struct *task, struct pt_regs *regs, unsigned long * stack)
+ void show_trace(struct task_struct *task, struct pt_regs *regs,
+               unsigned long * stack)
  {
        show_trace_log_lvl(task, regs, stack, "");
  }
@@@ -291,8 -351,9 +351,9 @@@ void show_registers(struct pt_regs *reg
                ss = regs->xss & 0xffff;
        }
        print_modules();
-       printk(KERN_EMERG "CPU:    %d\nEIP:    %04x:[<%08lx>]    %s VLI\n"
-                       "EFLAGS: %08lx   (%s %.*s) \n",
+       printk(KERN_EMERG "CPU:    %d\n"
+               KERN_EMERG "EIP:    %04x:[<%08lx>]    %s VLI\n"
+               KERN_EMERG "EFLAGS: %08lx   (%s %.*s)\n",
                smp_processor_id(), 0xffff & regs->xcs, regs->eip,
                print_tainted(), regs->eflags, system_utsname.release,
                (int)strcspn(system_utsname.version, " "),
         */
        if (in_kernel) {
                u8 __user *eip;
 +              int code_bytes = 64;
 +              unsigned char c;
  
                printk("\n" KERN_EMERG "Stack: ");
                show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG);
                printk(KERN_EMERG "Code: ");
  
                eip = (u8 __user *)regs->eip - 43;
 -              for (i = 0; i < 64; i++, eip++) {
 -                      unsigned char c;
 -
 +              if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) {
 +                      /* try starting at EIP */
 +                      eip = (u8 __user *)regs->eip;
 +                      code_bytes = 32;
 +              }
 +              for (i = 0; i < code_bytes; i++, eip++) {
                        if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) {
                                printk(" Bad EIP value.");
                                break;
@@@ -634,18 -690,24 +695,24 @@@ gp_in_kernel
        }
  }
  
- static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
+ static __kprobes void
+ mem_parity_error(unsigned char reason, struct pt_regs * regs)
  {
-       printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying "
-                       "to continue\n");
+       printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on "
+               "CPU %d.\n", reason, smp_processor_id());
        printk(KERN_EMERG "You probably have a hardware problem with your RAM "
                        "chips\n");
+       if (panic_on_unrecovered_nmi)
+                 panic("NMI: Not continuing");
+       printk(KERN_EMERG "Dazed and confused, but trying to continue\n");
  
        /* Clear and disable the memory parity error line. */
        clear_mem_error(reason);
  }
  
- static void io_check_error(unsigned char reason, struct pt_regs * regs)
+ static __kprobes void
+ io_check_error(unsigned char reason, struct pt_regs * regs)
  {
        unsigned long i;
  
        outb(reason, 0x61);
  }
  
- static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
+ static __kprobes void
+ unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
  {
  #ifdef CONFIG_MCA
        /* Might actually be able to figure out what the guilty party
                return;
        }
  #endif
-       printk("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
-               reason, smp_processor_id());
-       printk("Dazed and confused, but trying to continue\n");
-       printk("Do you have a strange power saving mode enabled?\n");
+       printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on "
+               "CPU %d.\n", reason, smp_processor_id());
+       printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n");
+       if (panic_on_unrecovered_nmi)
+                 panic("NMI: Not continuing");
+       printk(KERN_EMERG "Dazed and confused, but trying to continue\n");
  }
  
  static DEFINE_SPINLOCK(nmi_print_lock);
  
- void die_nmi (struct pt_regs *regs, const char *msg)
+ void __kprobes die_nmi(struct pt_regs *regs, const char *msg)
  {
        if (notify_die(DIE_NMIWATCHDOG, msg, regs, 0, 2, SIGINT) ==
            NOTIFY_STOP)
        do_exit(SIGSEGV);
  }
  
- static void default_do_nmi(struct pt_regs * regs)
+ static __kprobes void default_do_nmi(struct pt_regs * regs)
  {
        unsigned char reason = 0;
  
                 * Ok, so this is none of the documented NMI sources,
                 * so it must be the NMI watchdog.
                 */
-               if (nmi_watchdog) {
-                       nmi_watchdog_tick(regs);
+               if (nmi_watchdog_tick(regs, reason))
                        return;
-               }
+               if (!do_nmi_callback(regs, smp_processor_id()))
  #endif
-               unknown_nmi_error(reason, regs);
+                       unknown_nmi_error(reason, regs);
                return;
        }
        if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
        reassert_nmi();
  }
  
- static int dummy_nmi_callback(struct pt_regs * regs, int cpu)
- {
-       return 0;
- }
-  
- static nmi_callback_t nmi_callback = dummy_nmi_callback;
-  
- fastcall void do_nmi(struct pt_regs * regs, long error_code)
+ fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code)
  {
        int cpu;
  
  
        ++nmi_count(cpu);
  
-       if (!rcu_dereference(nmi_callback)(regs, cpu))
-               default_do_nmi(regs);
+       default_do_nmi(regs);
  
        nmi_exit();
  }
  
- void set_nmi_callback(nmi_callback_t callback)
- {
-       vmalloc_sync_all();
-       rcu_assign_pointer(nmi_callback, callback);
- }
- EXPORT_SYMBOL_GPL(set_nmi_callback);
- void unset_nmi_callback(void)
- {
-       nmi_callback = dummy_nmi_callback;
- }
- EXPORT_SYMBOL_GPL(unset_nmi_callback);
  #ifdef CONFIG_KPROBES
  fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code)
  {
@@@ -1124,20 -1169,6 +1174,6 @@@ void __init trap_init_f00f_bug(void
  }
  #endif
  
- #define _set_gate(gate_addr,type,dpl,addr,seg) \
- do { \
-   int __d0, __d1; \
-   __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \
-       "movw %4,%%dx\n\t" \
-       "movl %%eax,%0\n\t" \
-       "movl %%edx,%1" \
-       :"=m" (*((long *) (gate_addr))), \
-        "=m" (*(1+(long *) (gate_addr))), "=&a" (__d0), "=&d" (__d1) \
-       :"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
-        "3" ((char *) (addr)),"2" ((seg) << 16)); \
- } while (0)
  /*
   * This needs to use 'idt_table' rather than 'idt', and
   * thus use the _nonmapped_ version of the IDT, as the
   */
  void set_intr_gate(unsigned int n, void *addr)
  {
-       _set_gate(idt_table+n,14,0,addr,__KERNEL_CS);
+       _set_gate(n, DESCTYPE_INT, addr, __KERNEL_CS);
  }
  
  /*
   */
  static inline void set_system_intr_gate(unsigned int n, void *addr)
  {
-       _set_gate(idt_table+n, 14, 3, addr, __KERNEL_CS);
+       _set_gate(n, DESCTYPE_INT | DESCTYPE_DPL3, addr, __KERNEL_CS);
  }
  
  static void __init set_trap_gate(unsigned int n, void *addr)
  {
-       _set_gate(idt_table+n,15,0,addr,__KERNEL_CS);
+       _set_gate(n, DESCTYPE_TRAP, addr, __KERNEL_CS);
  }
  
  static void __init set_system_gate(unsigned int n, void *addr)
  {
-       _set_gate(idt_table+n,15,3,addr,__KERNEL_CS);
+       _set_gate(n, DESCTYPE_TRAP | DESCTYPE_DPL3, addr, __KERNEL_CS);
  }
  
  static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
  {
-       _set_gate(idt_table+n,5,0,0,(gdt_entry<<3));
+       _set_gate(n, DESCTYPE_TASK, (void *)0, (gdt_entry<<3));
  }
  
  
diff --combined arch/i386/mm/discontig.c
index fb5d8b747de441ef3dbe5e94eaecab6da6071e50,f0c10b3cd158459e237fa241618a62772acef5f2..941d1a5ebabbf798b82ff4b7b35d9bdd56cd7df8
@@@ -117,8 -117,7 +117,8 @@@ void set_pmd_pfn(unsigned long vaddr, u
  
  void *node_remap_end_vaddr[MAX_NUMNODES];
  void *node_remap_alloc_vaddr[MAX_NUMNODES];
 -
 +static unsigned long kva_start_pfn;
 +static unsigned long kva_pages;
  /*
   * FLAT - support for basic PC memory model with discontig enabled, essentially
   *        a single node with all available processors in it with a flat
@@@ -287,6 -286,7 +287,6 @@@ unsigned long __init setup_memory(void
  {
        int nid;
        unsigned long system_start_pfn, system_max_low_pfn;
 -      unsigned long reserve_pages;
  
        /*
         * When mapping a NUMA machine we allocate the node_mem_map arrays
        find_max_pfn();
        get_memcfg_numa();
  
 -      reserve_pages = calculate_numa_remap_pages();
 +      kva_pages = calculate_numa_remap_pages();
  
        /* partially used pages are not usable - thus round upwards */
        system_start_pfn = min_low_pfn = PFN_UP(init_pg_tables_end);
  
 -      system_max_low_pfn = max_low_pfn = find_max_low_pfn() - reserve_pages;
 -      printk("reserve_pages = %ld find_max_low_pfn() ~ %ld\n",
 -                      reserve_pages, max_low_pfn + reserve_pages);
 +      kva_start_pfn = find_max_low_pfn() - kva_pages;
 +
 +#ifdef CONFIG_BLK_DEV_INITRD
 +      /* Numa kva area is below the initrd */
 +      if (LOADER_TYPE && INITRD_START)
 +              kva_start_pfn = PFN_DOWN(INITRD_START)  - kva_pages;
 +#endif
 +      kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1);
 +
 +      system_max_low_pfn = max_low_pfn = find_max_low_pfn();
 +      printk("kva_start_pfn ~ %ld find_max_low_pfn() ~ %ld\n",
 +              kva_start_pfn, max_low_pfn);
        printk("max_pfn = %ld\n", max_pfn);
  #ifdef CONFIG_HIGHMEM
        highstart_pfn = highend_pfn = max_pfn;
                highstart_pfn = system_max_low_pfn;
        printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
               pages_to_mb(highend_pfn - highstart_pfn));
+       num_physpages = highend_pfn;
+       high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
+ #else
+       num_physpages = system_max_low_pfn;
+       high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1;
  #endif
        printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
                        pages_to_mb(system_max_low_pfn));
                        (ulong) pfn_to_kaddr(max_low_pfn));
        for_each_online_node(nid) {
                node_remap_start_vaddr[nid] = pfn_to_kaddr(
 -                              highstart_pfn + node_remap_offset[nid]);
 +                              kva_start_pfn + node_remap_offset[nid]);
                /* Init the node remap allocator */
                node_remap_end_vaddr[nid] = node_remap_start_vaddr[nid] +
                        (node_remap_size[nid] * PAGE_SIZE);
        }
        printk("High memory starts at vaddr %08lx\n",
                        (ulong) pfn_to_kaddr(highstart_pfn));
 -      vmalloc_earlyreserve = reserve_pages * PAGE_SIZE;
        for_each_online_node(nid)
                find_max_pfn_node(nid);
  
        return max_low_pfn;
  }
  
 +void __init numa_kva_reserve(void)
 +{
 +      reserve_bootmem(PFN_PHYS(kva_start_pfn),PFN_PHYS(kva_pages));
 +}
 +
  void __init zone_sizes_init(void)
  {
        int nid;
  
  
        for_each_online_node(nid) {
 -              unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
 +              unsigned long zones_size[MAX_NR_ZONES] = {0, };
                unsigned long *zholes_size;
                unsigned int max_dma;
  
@@@ -422,7 -414,7 +427,7 @@@ void __init set_highmem_pages_init(int 
                zone_end_pfn = zone_start_pfn + zone->spanned_pages;
  
                printk("Initializing %s for node %d (%08lx:%08lx)\n",
 -                              zone->name, zone->zone_pgdat->node_id,
 +                              zone->name, zone_to_nid(zone),
                                zone_start_pfn, zone_end_pfn);
  
                for (node_pfn = zone_start_pfn; node_pfn < zone_end_pfn; node_pfn++) {
diff --combined arch/i386/mm/init.c
index efd0bcdac65da65264c19e6949c24dc4ab832350,951386606d09af4783bb9ac8898c69ec113e0cb5..4a5a914b34321bcc69b714ca17223b08bc898edb
@@@ -435,16 -435,22 +435,22 @@@ u64 __supported_pte_mask __read_mostly 
   * on      Enable
   * off     Disable
   */
void __init noexec_setup(const char *str)
static int __init noexec_setup(char *str)
  {
-       if (!strncmp(str, "on",2) && cpu_has_nx) {
-               __supported_pte_mask |= _PAGE_NX;
-               disable_nx = 0;
-       } else if (!strncmp(str,"off",3)) {
+       if (!str || !strcmp(str, "on")) {
+               if (cpu_has_nx) {
+                       __supported_pte_mask |= _PAGE_NX;
+                       disable_nx = 0;
+               }
+       } else if (!strcmp(str,"off")) {
                disable_nx = 1;
                __supported_pte_mask &= ~_PAGE_NX;
-       }
+       } else
+               return -EINVAL;
+       return 0;
  }
+ early_param("noexec", noexec_setup);
  
  int nx_enabled = 0;
  #ifdef CONFIG_X86_PAE
@@@ -552,18 -558,6 +558,6 @@@ static void __init test_wp_bit(void
        }
  }
  
- static void __init set_max_mapnr_init(void)
- {
- #ifdef CONFIG_HIGHMEM
-       num_physpages = highend_pfn;
- #else
-       num_physpages = max_low_pfn;
- #endif
- #ifdef CONFIG_FLATMEM
-       max_mapnr = num_physpages;
- #endif
- }
  static struct kcore_list kcore_mem, kcore_vmalloc; 
  
  void __init mem_init(void)
        }
  #endif
   
-       set_max_mapnr_init();
- #ifdef CONFIG_HIGHMEM
-       high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
- #else
-       high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
- #endif
        /* this will put all low memory onto the freelists */
        totalram_pages += free_all_bootmem();
  
                (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))
               );
  
 +#if 1 /* double-sanity-check paranoia */
 +      printk("virtual kernel memory layout:\n"
 +             "    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 +#ifdef CONFIG_HIGHMEM
 +             "    pkmap   : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 +#endif
 +             "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
 +             "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
 +             "      .init : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 +             "      .data : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 +             "      .text : 0x%08lx - 0x%08lx   (%4ld kB)\n",
 +             FIXADDR_START, FIXADDR_TOP,
 +             (FIXADDR_TOP - FIXADDR_START) >> 10,
 +
 +#ifdef CONFIG_HIGHMEM
 +             PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
 +             (LAST_PKMAP*PAGE_SIZE) >> 10,
 +#endif
 +
 +             VMALLOC_START, VMALLOC_END,
 +             (VMALLOC_END - VMALLOC_START) >> 20,
 +
 +             (unsigned long)__va(0), (unsigned long)high_memory,
 +             ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
 +
 +             (unsigned long)&__init_begin, (unsigned long)&__init_end,
 +             ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10,
 +
 +             (unsigned long)&_etext, (unsigned long)&_edata,
 +             ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
 +
 +             (unsigned long)&_text, (unsigned long)&_etext,
 +             ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
 +
 +#ifdef CONFIG_HIGHMEM
 +      BUG_ON(PKMAP_BASE+LAST_PKMAP*PAGE_SIZE > FIXADDR_START);
 +      BUG_ON(VMALLOC_END                     > PKMAP_BASE);
 +#endif
 +      BUG_ON(VMALLOC_START                   > VMALLOC_END);
 +      BUG_ON((unsigned long)high_memory      > VMALLOC_START);
 +#endif /* double-sanity-check paranoia */
 +
  #ifdef CONFIG_X86_PAE
        if (!cpu_has_pae)
                panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!");
  int arch_add_memory(int nid, u64 start, u64 size)
  {
        struct pglist_data *pgdata = &contig_page_data;
 -      struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1;
 +      struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM;
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
  
index 59cc70275754afebfb030fc73b48ebc4a5ccde8a,6289779ca67c937df4c7dfe1819441d363aff2c6..0e32adf03be1940a0cace32c2e4842d3eef7a78a
@@@ -1,10 -1,10 +1,10 @@@
  obj-y = bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
 -      ptrace_user.o signal.o sigcontext.o syscalls.o sysrq.o \
 +      ptrace_user.o setjmp.o signal.o sigcontext.o syscalls.o sysrq.o \
        sys_call_table.o tls.o
  
  obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o
  
- subarch-obj-y = lib/bitops.o kernel/semaphore.o
+ subarch-obj-y = lib/bitops.o lib/semaphore.o
  subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem.o
  subarch-obj-$(CONFIG_MODULES) += kernel/module.o
  
diff --combined arch/x86_64/Kconfig
index 581ce9af0ec8f5ed4572e5cf0050b0f7cf90d3a7,294bf77f7222e4415c48cda41181f16d61c237d7..efe249e7d6b37c8cc8ffbcdf946cdfc1765a66ef
@@@ -24,10 -24,6 +24,10 @@@ config X8
        bool
        default y
  
 +config ZONE_DMA32
 +      bool
 +      default y
 +
  config LOCKDEP_SUPPORT
        bool
        default y
@@@ -109,6 -105,7 +109,7 @@@ config X86_P
  
  config X86_VSMP
        bool "Support for ScaleMP vSMP"
+       depends on PCI
         help
          Support for ScaleMP vSMP systems.  Say 'Y' here if this kernel is
          supposed to run on these EM64T-based machines.  Only choose this option
@@@ -295,7 -292,7 +296,7 @@@ config NUM
  
  config K8_NUMA
         bool "Old style AMD Opteron NUMA detection"
-        depends on NUMA
+        depends on NUMA && PCI
         default y
         help
         Enable K8 NUMA node topology detection.  You should say Y here if
@@@ -425,7 -422,6 +426,6 @@@ config IOMM
  
  config CALGARY_IOMMU
        bool "IBM Calgary IOMMU support"
-       default y
        select SWIOTLB
        depends on PCI && EXPERIMENTAL
        help
@@@ -472,8 -468,7 +472,7 @@@ config X86_MCE_AM
           the DRAM Error Threshold.
  
  config KEXEC
-       bool "kexec system call (EXPERIMENTAL)"
-       depends on EXPERIMENTAL
+       bool "kexec system call"
        help
          kexec is a system call that implements the ability to shutdown your
          current kernel, and to start another kernel.  It is like a reboot
@@@ -492,7 -487,14 +491,14 @@@ config CRASH_DUM
        bool "kernel crash dumps (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        help
-               Generate crash dump after being started by kexec.
+           Generate crash dump after being started by kexec.
+           This should be normally only set in special crash dump kernels
+           which are loaded in the main kernel with kexec-tools into
+           a specially reserved region and then later executed after
+           a crash by kdump/kexec. The crash dump kernel must be compiled
+         to a memory address not used by the main kernel or BIOS using
+         PHYSICAL_START.
+           For more details see Documentation/kdump/kdump.txt
  
  config PHYSICAL_START
        hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
@@@ -530,6 -532,30 +536,30 @@@ config SECCOM
  
          If unsure, say Y. Only embedded should say N here.
  
+ config CC_STACKPROTECTOR
+       bool "Enable -fstack-protector buffer overflow detection (EXPRIMENTAL)"
+       depends on EXPERIMENTAL
+       help
+          This option turns on the -fstack-protector GCC feature. This
+         feature puts, at the beginning of critical functions, a canary
+         value on the stack just before the return address, and validates
+         the value just before actually returning.  Stack based buffer
+         overflows (that need to overwrite this return address) now also
+         overwrite the canary, which gets detected and the attack is then
+         neutralized via a kernel panic.
+         This feature requires gcc version 4.2 or above, or a distribution
+         gcc with the feature backported. Older versions are automatically
+         detected and for those versions, this configuration option is ignored.
+ config CC_STACKPROTECTOR_ALL
+       bool "Use stack-protector for all functions"
+       depends on CC_STACKPROTECTOR
+       help
+         Normally, GCC only inserts the canary value protection for
+         functions that use large-ish on-stack buffers. By enabling
+         this option, GCC will be asked to do this for ALL functions.
  source kernel/Kconfig.hz
  
  config REORDER
index 708a3cd9a27ec01129eeb3df6f7e32b1936fb38a,5d1275a936583ecef5fd734919a37e855bc826eb..c0af3828df4579da916aef68445ea5a8d255580a
@@@ -16,7 -16,6 +16,7 @@@
  #include <linux/string.h>
  #include <linux/kexec.h>
  #include <linux/module.h>
 +#include <linux/mm.h>
  
  #include <asm/pgtable.h>
  #include <asm/page.h>
@@@ -25,6 -24,8 +25,8 @@@
  #include <asm/bootsetup.h>
  #include <asm/sections.h>
  
+ struct e820map e820 __initdata;
  /* 
   * PFN of last memory page.
   */
@@@ -41,7 -42,7 +43,7 @@@ unsigned long end_pfn_map
  /* 
   * Last pfn which the user wants to use.
   */
- unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;  
+ static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT;
  
  extern struct resource code_resource, data_resource;
  
@@@ -70,12 -71,7 +72,7 @@@ static inline int bad_addr(unsigned lon
                return 1;
        } 
  #endif
-       /* kernel code + 640k memory hole (later should not be needed, but 
-          be paranoid for now) */
-       if (last >= 640*1024 && addr < 1024*1024) {
-               *addrp = 1024*1024;
-               return 1;
-       }
+       /* kernel code */
        if (last >= __pa_symbol(&_text) && last < __pa_symbol(&_end)) {
                *addrp = __pa_symbol(&_end);
                return 1;
@@@ -298,53 -294,6 +295,53 @@@ void __init e820_reserve_resources(void
        }
  }
  
 +/* Mark pages corresponding to given address range as nosave */
 +static void __init
 +e820_mark_nosave_range(unsigned long start, unsigned long end)
 +{
 +      unsigned long pfn, max_pfn;
 +
 +      if (start >= end)
 +              return;
 +
 +      printk("Nosave address range: %016lx - %016lx\n", start, end);
 +      max_pfn = end >> PAGE_SHIFT;
 +      for (pfn = start >> PAGE_SHIFT; pfn < max_pfn; pfn++)
 +              if (pfn_valid(pfn))
 +                      SetPageNosave(pfn_to_page(pfn));
 +}
 +
 +/*
 + * Find the ranges of physical addresses that do not correspond to
 + * e820 RAM areas and mark the corresponding pages as nosave for software
 + * suspend and suspend to RAM.
 + *
 + * This function requires the e820 map to be sorted and without any
 + * overlapping entries and assumes the first e820 area to be RAM.
 + */
 +void __init e820_mark_nosave_regions(void)
 +{
 +      int i;
 +      unsigned long paddr;
 +
 +      paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
 +      for (i = 1; i < e820.nr_map; i++) {
 +              struct e820entry *ei = &e820.map[i];
 +
 +              if (paddr < ei->addr)
 +                      e820_mark_nosave_range(paddr,
 +                                      round_up(ei->addr, PAGE_SIZE));
 +
 +              paddr = round_down(ei->addr + ei->size, PAGE_SIZE);
 +              if (ei->type != E820_RAM)
 +                      e820_mark_nosave_range(round_up(ei->addr, PAGE_SIZE),
 +                                      paddr);
 +
 +              if (paddr >= (end_pfn << PAGE_SHIFT))
 +                      break;
 +      }
 +}
 +
  /* 
   * Add a memory region to the kernel e820 map.
   */ 
@@@ -565,13 -514,6 +562,6 @@@ static int __init sanitize_e820_map(str
   * If we're lucky and live on a modern system, the setup code
   * will have given us a memory map that we can use to properly
   * set up memory.  If we aren't, we'll fake a memory map.
-  *
-  * We check to see that the memory map contains at least 2 elements
-  * before we'll use it, because the detection code in setup.S may
-  * not be perfect and most every PC known to man has two memory
-  * regions: one from 0 to 640k, and one from 1mb up.  (The IBM
-  * thinkpad 560x, for example, does not cooperate with the memory
-  * detection code.)
   */
  static int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
  {
                if (start > end)
                        return -1;
  
-               /*
-                * Some BIOSes claim RAM in the 640k - 1M region.
-                * Not right. Fix it up.
-                * 
-                * This should be removed on Hammer which is supposed to not
-                * have non e820 covered ISA mappings there, but I had some strange
-                * problems so it stays for now.  -AK
-                */
-               if (type == E820_RAM) {
-                       if (start < 0x100000ULL && end > 0xA0000ULL) {
-                               if (start < 0xA0000ULL)
-                                       add_memory_region(start, 0xA0000ULL-start, type);
-                               if (end <= 0x100000ULL)
-                                       continue;
-                               start = 0x100000ULL;
-                               size = end - start;
-                       }
-               }
                add_memory_region(start, size, type);
        } while (biosmap++,--nr_map);
        return 0;
  }
  
- void __init setup_memory_region(void)
+ void early_panic(char *msg)
  {
-       char *who = "BIOS-e820";
+       early_printk(msg);
+       panic(msg);
+ }
  
+ void __init setup_memory_region(void)
+ {
        /*
         * Try to copy the BIOS-supplied E820-map.
         *
         * the next section from 1mb->appropriate_mem_k
         */
        sanitize_e820_map(E820_MAP, &E820_MAP_NR);
-       if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
-               unsigned long mem_size;
-               /* compare results from other methods and take the greater */
-               if (ALT_MEM_K < EXT_MEM_K) {
-                       mem_size = EXT_MEM_K;
-                       who = "BIOS-88";
-               } else {
-                       mem_size = ALT_MEM_K;
-                       who = "BIOS-e801";
-               }
-               e820.nr_map = 0;
-               add_memory_region(0, LOWMEMSIZE(), E820_RAM);
-               add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
-       }
+       if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0)
+               early_panic("Cannot find a valid memory map");
        printk(KERN_INFO "BIOS-provided physical RAM map:\n");
-       e820_print_map(who);
+       e820_print_map("BIOS-e820");
  }
  
- void __init parse_memopt(char *p, char **from) 
- { 
-       end_user_pfn = memparse(p, from);
+ static int __init parse_memopt(char *p)
+ {
+       if (!p)
+               return -EINVAL;
+       end_user_pfn = memparse(p, &p);
        end_user_pfn >>= PAGE_SHIFT;    
+       return 0;
  } 
+ early_param("mem", parse_memopt);
  
- void __init parse_memmapopt(char *p, char **from)
+ static int userdef __initdata;
+ static int __init parse_memmap_opt(char *p)
  {
+       char *oldp;
        unsigned long long start_at, mem_size;
  
-       mem_size = memparse(p, from);
-       p = *from;
+       if (!strcmp(p, "exactmap")) {
+ #ifdef CONFIG_CRASH_DUMP
+               /* If we are doing a crash dump, we
+                * still need to know the real mem
+                * size before original memory map is
+                * reset.
+                */
+               saved_max_pfn = e820_end_of_ram();
+ #endif
+               end_pfn_map = 0;
+               e820.nr_map = 0;
+               userdef = 1;
+               return 0;
+       }
+       oldp = p;
+       mem_size = memparse(p, &p);
+       if (p == oldp)
+               return -EINVAL;
        if (*p == '@') {
-               start_at = memparse(p+1, from);
+               start_at = memparse(p+1, &p);
                add_memory_region(start_at, mem_size, E820_RAM);
        } else if (*p == '#') {
-               start_at = memparse(p+1, from);
+               start_at = memparse(p+1, &p);
                add_memory_region(start_at, mem_size, E820_ACPI);
        } else if (*p == '$') {
-               start_at = memparse(p+1, from);
+               start_at = memparse(p+1, &p);
                add_memory_region(start_at, mem_size, E820_RESERVED);
        } else {
                end_user_pfn = (mem_size >> PAGE_SHIFT);
        }
-       p = *from;
+       return *p == '\0' ? 0 : -EINVAL;
+ }
+ early_param("memmap", parse_memmap_opt);
+ void finish_e820_parsing(void)
+ {
+       if (userdef) {
+               printk(KERN_INFO "user-defined physical RAM map:\n");
+               e820_print_map("user");
+       }
  }
  
  unsigned long pci_mem_start = 0xaeedbabe;
index 4b39f0da17f3d3f56795233aa4745b42f652ca79,3c7ad267d8a71924110ec7c923910d0c740ba627..f98e48cae6da08f4386765f0094bbe9c98545a08
@@@ -74,16 -74,6 +74,6 @@@ EXPORT_SYMBOL(boot_cpu_data)
  
  unsigned long mmu_cr4_features;
  
- int acpi_disabled;
- EXPORT_SYMBOL(acpi_disabled);
- #ifdef        CONFIG_ACPI
- extern int __initdata acpi_ht;
- extern acpi_interrupt_flags   acpi_sci_flags;
- int __initdata acpi_force = 0;
- #endif
- int acpi_numa __initdata;
  /* Boot loader ID as an integer, for the benefit of proc_dointvec */
  int bootloader_type;
  
@@@ -107,7 -97,6 +97,6 @@@ struct sys_desc_table_struct 
  
  struct edid_info edid_info;
  EXPORT_SYMBOL_GPL(edid_info);
- struct e820map e820;
  
  extern int root_mountflags;
  
@@@ -276,185 -265,22 +265,22 @@@ static void __init probe_roms(void
        }
  }
  
- /* Check for full argument with no trailing characters */
- static int fullarg(char *p, char *arg)
+ #ifdef CONFIG_PROC_VMCORE
+ /* elfcorehdr= specifies the location of elf core header
+  * stored by the crashed kernel. This option will be passed
+  * by kexec loader to the capture kernel.
+  */
+ static int __init setup_elfcorehdr(char *arg)
  {
-       int l = strlen(arg);
-       return !memcmp(p, arg, l) && (p[l] == 0 || isspace(p[l]));
+       char *end;
+       if (!arg)
+               return -EINVAL;
+       elfcorehdr_addr = memparse(arg, &end);
+       return end > arg ? 0 : -EINVAL;
  }
- static __init void parse_cmdline_early (char ** cmdline_p)
- {
-       char c = ' ', *to = command_line, *from = COMMAND_LINE;
-       int len = 0;
-       int userdef = 0;
-       for (;;) {
-               if (c != ' ') 
-                       goto next_char; 
- #ifdef  CONFIG_SMP
-               /*
-                * If the BIOS enumerates physical processors before logical,
-                * maxcpus=N at enumeration-time can be used to disable HT.
-                */
-               else if (!memcmp(from, "maxcpus=", 8)) {
-                       extern unsigned int maxcpus;
-                       maxcpus = simple_strtoul(from + 8, NULL, 0);
-               }
- #endif
- #ifdef CONFIG_ACPI
-               /* "acpi=off" disables both ACPI table parsing and interpreter init */
-               if (fullarg(from,"acpi=off"))
-                       disable_acpi();
-               if (fullarg(from, "acpi=force")) { 
-                       /* add later when we do DMI horrors: */
-                       acpi_force = 1;
-                       acpi_disabled = 0;
-               }
-               /* acpi=ht just means: do ACPI MADT parsing 
-                  at bootup, but don't enable the full ACPI interpreter */
-               if (fullarg(from, "acpi=ht")) { 
-                       if (!acpi_force)
-                               disable_acpi();
-                       acpi_ht = 1; 
-               }
-                 else if (fullarg(from, "pci=noacpi")) 
-                       acpi_disable_pci();
-               else if (fullarg(from, "acpi=noirq"))
-                       acpi_noirq_set();
-               else if (fullarg(from, "acpi_sci=edge"))
-                       acpi_sci_flags.trigger =  1;
-               else if (fullarg(from, "acpi_sci=level"))
-                       acpi_sci_flags.trigger = 3;
-               else if (fullarg(from, "acpi_sci=high"))
-                       acpi_sci_flags.polarity = 1;
-               else if (fullarg(from, "acpi_sci=low"))
-                       acpi_sci_flags.polarity = 3;
-               /* acpi=strict disables out-of-spec workarounds */
-               else if (fullarg(from, "acpi=strict")) {
-                       acpi_strict = 1;
-               }
- #ifdef CONFIG_X86_IO_APIC
-               else if (fullarg(from, "acpi_skip_timer_override"))
-                       acpi_skip_timer_override = 1;
- #endif
- #endif
-               if (fullarg(from, "disable_timer_pin_1"))
-                       disable_timer_pin_1 = 1;
-               if (fullarg(from, "enable_timer_pin_1"))
-                       disable_timer_pin_1 = -1;
-               if (fullarg(from, "nolapic") || fullarg(from, "disableapic")) {
-                       clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
-                       disable_apic = 1;
-               }
-               if (fullarg(from, "noapic"))
-                       skip_ioapic_setup = 1;
-               if (fullarg(from,"apic")) {
-                       skip_ioapic_setup = 0;
-                       ioapic_force = 1;
-               }
-                       
-               if (!memcmp(from, "mem=", 4))
-                       parse_memopt(from+4, &from); 
-               if (!memcmp(from, "memmap=", 7)) {
-                       /* exactmap option is for used defined memory */
-                       if (!memcmp(from+7, "exactmap", 8)) {
- #ifdef CONFIG_CRASH_DUMP
-                               /* If we are doing a crash dump, we
-                                * still need to know the real mem
-                                * size before original memory map is
-                                * reset.
-                                */
-                               saved_max_pfn = e820_end_of_ram();
- #endif
-                               from += 8+7;
-                               end_pfn_map = 0;
-                               e820.nr_map = 0;
-                               userdef = 1;
-                       }
-                       else {
-                               parse_memmapopt(from+7, &from);
-                               userdef = 1;
-                       }
-               }
- #ifdef CONFIG_NUMA
-               if (!memcmp(from, "numa=", 5))
-                       numa_setup(from+5); 
- #endif
-               if (!memcmp(from,"iommu=",6)) { 
-                       iommu_setup(from+6); 
-               }
-               if (fullarg(from,"oops=panic"))
-                       panic_on_oops = 1;
-               if (!memcmp(from, "noexec=", 7))
-                       nonx_setup(from + 7);
- #ifdef CONFIG_KEXEC
-               /* crashkernel=size@addr specifies the location to reserve for
-                * a crash kernel.  By reserving this memory we guarantee
-                * that linux never set's it up as a DMA target.
-                * Useful for holding code to do something appropriate
-                * after a kernel panic.
-                */
-               else if (!memcmp(from, "crashkernel=", 12)) {
-                       unsigned long size, base;
-                       size = memparse(from+12, &from);
-                       if (*from == '@') {
-                               base = memparse(from+1, &from);
-                               /* FIXME: Do I want a sanity check
-                                * to validate the memory range?
-                                */
-                               crashk_res.start = base;
-                               crashk_res.end   = base + size - 1;
-                       }
-               }
- #endif
- #ifdef CONFIG_PROC_VMCORE
-               /* elfcorehdr= specifies the location of elf core header
-                * stored by the crashed kernel. This option will be passed
-                * by kexec loader to the capture kernel.
-                */
-               else if(!memcmp(from, "elfcorehdr=", 11))
-                       elfcorehdr_addr = memparse(from+11, &from);
- #endif
- #ifdef CONFIG_HOTPLUG_CPU
-               else if (!memcmp(from, "additional_cpus=", 16))
-                       setup_additional_cpus(from+16);
+ early_param("elfcorehdr", setup_elfcorehdr);
  #endif
  
-       next_char:
-               c = *(from++);
-               if (!c)
-                       break;
-               if (COMMAND_LINE_SIZE <= ++len)
-                       break;
-               *(to++) = c;
-       }
-       if (userdef) {
-               printk(KERN_INFO "user-defined physical RAM map:\n");
-               e820_print_map("user");
-       }
-       *to = '\0';
-       *cmdline_p = command_line;
- }
  #ifndef CONFIG_NUMA
  static void __init
  contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
@@@ -521,6 -347,8 +347,8 @@@ static void discover_ebda(void
  
  void __init setup_arch(char **cmdline_p)
  {
+       printk(KERN_INFO "Command line: %s\n", saved_command_line);
        ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
        screen_info = SCREEN_INFO;
        edid_info = EDID_INFO;
        data_resource.start = virt_to_phys(&_etext);
        data_resource.end = virt_to_phys(&_edata)-1;
  
-       parse_cmdline_early(cmdline_p);
        early_identify_cpu(&boot_cpu_data);
  
+       strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
+       *cmdline_p = command_line;
+       parse_early_param();
+       finish_e820_parsing();
        /*
         * partially used pages are not usable - thus
         * we are rounding upwards:
         */
        end_pfn = e820_end_of_ram();
-       num_physpages = end_pfn;                /* for pfn_valid */
+       num_physpages = end_pfn;
  
        check_efer();
  
        acpi_boot_table_init();
  #endif
  
+       /* How many end-of-memory variables you have, grandma! */
+       max_low_pfn = end_pfn;
+       max_pfn = end_pfn;
+       high_memory = (void *)__va(end_pfn * PAGE_SIZE - 1) + 1;
  #ifdef CONFIG_ACPI_NUMA
        /*
         * Parse SRAT to discover nodes.
          */
         acpi_reserve_bootmem();
  #endif
- #ifdef CONFIG_X86_LOCAL_APIC
        /*
         * Find and reserve possible boot-time SMP configuration:
         */
        find_smp_config();
- #endif
  #ifdef CONFIG_BLK_DEV_INITRD
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) {
  
        paging_init();
  
-       check_ioapic();
+ #ifdef CONFIG_PCI
+       early_quirks();
+ #endif
  
        /*
         * set this early, so we dont allocate cpu0
  
        init_cpu_to_node();
  
- #ifdef CONFIG_X86_LOCAL_APIC
        /*
         * get boot-time SMP configuration:
         */
        if (smp_found_config)
                get_smp_config();
        init_apic_mappings();
- #endif
  
        /*
         * Request address space for all standard RAM and ROM resources
         */
        probe_roms();
        e820_reserve_resources(); 
 +      e820_mark_nosave_regions();
  
        request_resource(&iomem_resource, &video_ram_resource);
  
@@@ -839,7 -674,7 +675,7 @@@ static void __init amd_detect_cmp(struc
  #endif
  }
  
- static void __init init_amd(struct cpuinfo_x86 *c)
+ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
  {
        unsigned level;
  
  
        /* Fix cpuid4 emulation for more */
        num_cache_leaves = 3;
+       /* When there is only one core no need to synchronize RDTSC */
+       if (num_possible_cpus() == 1)
+               set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
+       else
+               clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
  }
  
  static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
@@@ -976,8 -817,7 +818,7 @@@ static void srat_detect_node(void
                node = first_node(node_online_map);
        numa_set_node(cpu, node);
  
-       if (acpi_numa > 0)
-               printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
+       printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
  #endif
  }
  
@@@ -1011,6 -851,8 +852,8 @@@ static void __cpuinit init_intel(struc
        if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
            (c->x86 == 0x6 && c->x86_model >= 0x0e))
                set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
+       if (c->x86 == 6)
+               set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
        set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
        c->x86_max_cores = intel_num_cpu_cores(c);
  
@@@ -1229,8 -1071,8 +1072,8 @@@ static int show_cpuinfo(struct seq_fil
  
                /* Intel-defined (#2) */
                "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
-               "tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL,
-               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+               "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
+               NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  
                /* VIA/Cyrix/Centaur-defined */
index 3ae9ffddddc0fa8de849aaf54c789bffba933dd6,0b9f28b05e7d9bbf5c04d4debfaa394c12ef46b4..7b7a6870288ac8dd2ae0188622d353949780c577
  #include <linux/bootmem.h>
  #include <linux/thread_info.h>
  #include <linux/module.h>
 -
  #include <linux/delay.h>
  #include <linux/mc146818rtc.h>
 +#include <linux/smp.h>
 +
  #include <asm/mtrr.h>
  #include <asm/pgalloc.h>
  #include <asm/desc.h>
@@@ -1091,7 -1090,6 +1091,6 @@@ void __init smp_prepare_cpus(unsigned i
        /*
         * Switch from PIC to APIC mode.
         */
-       connect_bsp_APIC();
        setup_local_APIC();
  
        if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) {
@@@ -1176,12 -1174,9 +1175,9 @@@ int __cpuinit __cpu_up(unsigned int cpu
  void __init smp_cpus_done(unsigned int max_cpus)
  {
        smp_cleanup_boot();
- #ifdef CONFIG_X86_IO_APIC
        setup_ioapic_dest();
- #endif
        check_nmi_watchdog();
+       time_init_gtod();
  }
  
  #ifdef CONFIG_HOTPLUG_CPU
@@@ -1234,6 -1229,8 +1230,8 @@@ int __cpu_disable(void
        if (cpu == 0)
                return -EBUSY;
  
+       if (nmi_watchdog == NMI_LOCAL_APIC)
+               stop_apic_nmi_watchdog(NULL);
        clear_local_APIC();
  
        /*
@@@ -1273,11 -1270,11 +1271,11 @@@ void __cpu_die(unsigned int cpu
        printk(KERN_ERR "CPU %u didn't die...\n", cpu);
  }
  
- __init int setup_additional_cpus(char *s)
static __init int setup_additional_cpus(char *s)
  {
-       return get_option(&s, &additional_cpus);
+       return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL;
  }
__setup("additional_cpus=", setup_additional_cpus);
early_param("additional_cpus", setup_additional_cpus);
  
  #else /* ... !CONFIG_HOTPLUG_CPU */
  
index 7700e6cd2bd9567e63f26a3447f2a5092a5cbc5c,9dd15d12b659f0ef5914b78337a095f7c3a38c32..1c255ee76e7c81870768f54adc9a5fe149dc0239
@@@ -24,6 -24,8 +24,8 @@@
  #include <linux/device.h>
  #include <linux/sysdev.h>
  #include <linux/bcd.h>
+ #include <linux/notifier.h>
+ #include <linux/cpu.h>
  #include <linux/kallsyms.h>
  #include <linux/acpi.h>
  #ifdef CONFIG_ACPI
@@@ -39,9 -41,7 +41,7 @@@
  #include <asm/sections.h>
  #include <linux/cpufreq.h>
  #include <linux/hpet.h>
- #ifdef CONFIG_X86_LOCAL_APIC
  #include <asm/apic.h>
- #endif
  
  #ifdef CONFIG_CPU_FREQ
  static void cpufreq_delayed_get(void);
@@@ -49,7 -49,7 +49,7 @@@
  extern void i8254_timer_resume(void);
  extern int using_apic_timer;
  
- static char *time_init_gtod(void);
+ static char *timename = NULL;
  
  DEFINE_SPINLOCK(rtc_lock);
  EXPORT_SYMBOL(rtc_lock);
@@@ -187,20 -187,15 +187,15 @@@ unsigned long profile_pc(struct pt_reg
  {
        unsigned long pc = instruction_pointer(regs);
  
-       /* Assume the lock function has either no stack frame or only a single 
-          word.  This checks if the address on the stack looks like a kernel 
-          text address.
-          There is a small window for false hits, but in that case the tick
-          is just accounted to the spinlock function.
-          Better would be to write these functions in assembler again
-          and check exactly. */
+       /* Assume the lock function has either no stack frame or a copy
+          of eflags from PUSHF
+          Eflags always has bits 22 and up cleared unlike kernel addresses. */
        if (!user_mode(regs) && in_lock_functions(pc)) {
-               char *v = *(char **)regs->rsp;
-               if ((v >= _stext && v <= _etext) ||
-                       (v >= _sinittext && v <= _einittext) ||
-                       (v >= (char *)MODULES_VADDR  && v <= (char *)MODULES_END))
-                       return (unsigned long)v;
-               return ((unsigned long *)regs->rsp)[1];
+               unsigned long *sp = (unsigned long *)regs->rsp;
+               if (sp[0] >> 22)
+                       return sp[0];
+               if (sp[1] >> 22)
+                       return sp[1];
        }
        return pc;
  }
@@@ -281,6 -276,7 +276,7 @@@ static void set_rtc_mmss(unsigned long 
   *            Note: This function is required to return accurate
   *            time even in the absence of multiple timer ticks.
   */
+ static inline unsigned long long cycles_2_ns(unsigned long long cyc);
  unsigned long long monotonic_clock(void)
  {
        unsigned long seq;
                        base = monotonic_base;
                } while (read_seqretry(&xtime_lock, seq));
                this_offset = get_cycles_sync();
-               /* FIXME: 1000 or 1000000? */
-               offset = (this_offset - last_offset)*1000 / cpu_khz;
+               offset = cycles_2_ns(this_offset - last_offset);
        }
        return base + offset;
  }
@@@ -410,8 -405,7 +405,7 @@@ void main_timer_handler(struct pt_regs 
                        offset %= USEC_PER_TICK;
                }
  
-               /* FIXME: 1000 or 1000000? */
-               monotonic_base += (tsc - vxtime.last_tsc) * 1000000 / cpu_khz;
+               monotonic_base += cycles_2_ns(tsc - vxtime.last_tsc);
  
                vxtime.last_tsc = tsc - vxtime.quot * delay / vxtime.tsc_quot;
  
   * have to call the local interrupt handler.
   */
  
- #ifndef CONFIG_X86_LOCAL_APIC
-       profile_tick(CPU_PROFILING, regs);
- #else
        if (!using_apic_timer)
                smp_local_timer_interrupt(regs);
- #endif
  
  /*
   * If we have an externally synchronized Linux clock, then update CMOS clock
@@@ -470,10 -460,8 +460,8 @@@ static irqreturn_t timer_interrupt(int 
        if (apic_runs_main_timer > 1)
                return IRQ_HANDLED;
        main_timer_handler(regs);
- #ifdef CONFIG_X86_LOCAL_APIC
        if (using_apic_timer)
                smp_send_timer_broadcast_ipi();
- #endif
        return IRQ_HANDLED;
  }
  
@@@ -893,11 -881,17 +881,17 @@@ static struct irqaction irq0 = 
        timer_interrupt, IRQF_DISABLED, CPU_MASK_NONE, "timer", NULL, NULL
  };
  
- void __init time_init(void)
+ static int __cpuinit
+ time_cpu_notifier(struct notifier_block *nb, unsigned long action, void *hcpu)
  {
-       char *timename;
-       char *gtod;
+       unsigned cpu = (unsigned long) hcpu;
+       if (action == CPU_ONLINE)
+               vsyscall_set_cpu(cpu);
+       return NOTIFY_DONE;
+ }
  
+ void __init time_init(void)
+ {
        if (nohpet)
                vxtime.hpet_address = 0;
  
        }
  
        vxtime.mode = VXTIME_TSC;
-       gtod = time_init_gtod();
-       printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n",
-              vxtime_hz / 1000000, vxtime_hz % 1000000, timename, gtod);
-       printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
-               cpu_khz / 1000, cpu_khz % 1000);
        vxtime.quot = (USEC_PER_SEC << US_SCALE) / vxtime_hz;
        vxtime.tsc_quot = (USEC_PER_MSEC << US_SCALE) / cpu_khz;
        vxtime.last_tsc = get_cycles_sync();
+       set_cyc2ns_scale(cpu_khz);
        setup_irq(0, &irq0);
+       hotcpu_notifier(time_cpu_notifier, 0);
+       time_cpu_notifier(NULL, CPU_ONLINE, (void *)(long)smp_processor_id());
  
-       set_cyc2ns_scale(cpu_khz);
+ #ifndef CONFIG_SMP
+       time_init_gtod();
+ #endif
  }
  
  /*
@@@ -973,12 -966,18 +966,18 @@@ __cpuinit int unsynchronized_tsc(void
  /*
   * Decide what mode gettimeofday should use.
   */
__init static char *time_init_gtod(void)
void time_init_gtod(void)
  {
        char *timetype;
  
        if (unsynchronized_tsc())
                notsc = 1;
+       if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP))
+               vgetcpu_mode = VGETCPU_RDTSCP;
+       else
+               vgetcpu_mode = VGETCPU_LSL;
        if (vxtime.hpet_address && notsc) {
                timetype = hpet_use_timer ? "HPET" : "PIT/HPET";
                if (hpet_use_timer)
                timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC";
                vxtime.mode = VXTIME_TSC;
        }
-       return timetype;
+       printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n",
+              vxtime_hz / 1000000, vxtime_hz % 1000000, timename, timetype);
+       printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
+               cpu_khz / 1000, cpu_khz % 1000);
+       vxtime.quot = (USEC_PER_SEC << US_SCALE) / vxtime_hz;
+       vxtime.tsc_quot = (USEC_PER_MSEC << US_SCALE) / cpu_khz;
+       vxtime.last_tsc = get_cycles_sync();
+       set_cyc2ns_scale(cpu_khz);
  }
  
  __setup("report_lost_ticks", time_setup);
@@@ -1031,8 -1039,16 +1039,16 @@@ static int timer_resume(struct sys_devi
        unsigned long flags;
        unsigned long sec;
        unsigned long ctime = get_cmos_time();
-       unsigned long sleep_length = (ctime - sleep_start) * HZ;
+       long sleep_length = (ctime - sleep_start) * HZ;
  
+       if (sleep_length < 0) {
+               printk(KERN_WARNING "Time skew detected in timer resume!\n");
+               /* The time after the resume must not be earlier than the time
+                * before the suspend or some nasty things will happen
+                */
+               sleep_length = 0;
+               ctime = sleep_start;
+       }
        if (vxtime.hpet_address)
                hpet_reenable();
        else
@@@ -1148,25 -1164,23 +1164,25 @@@ int hpet_rtc_timer_init(void
                hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
  
        local_irq_save(flags);
 +
        cnt = hpet_readl(HPET_COUNTER);
        cnt += ((hpet_tick*HZ)/hpet_rtc_int_freq);
        hpet_writel(cnt, HPET_T1_CMP);
        hpet_t1_cmp = cnt;
 -      local_irq_restore(flags);
  
        cfg = hpet_readl(HPET_T1_CFG);
        cfg &= ~HPET_TN_PERIODIC;
        cfg |= HPET_TN_ENABLE | HPET_TN_32BIT;
        hpet_writel(cfg, HPET_T1_CFG);
  
 +      local_irq_restore(flags);
 +
        return 1;
  }
  
  static void hpet_rtc_timer_reinit(void)
  {
 -      unsigned int cfg, cnt;
 +      unsigned int cfg, cnt, ticks_per_int, lost_ints;
  
        if (unlikely(!(PIE_on | AIE_on | UIE_on))) {
                cfg = hpet_readl(HPET_T1_CFG);
                hpet_rtc_int_freq = DEFAULT_RTC_INT_FREQ;
  
        /* It is more accurate to use the comparator value than current count.*/
 -      cnt = hpet_t1_cmp;
 -      cnt += hpet_tick*HZ/hpet_rtc_int_freq;
 -      hpet_writel(cnt, HPET_T1_CMP);
 -      hpet_t1_cmp = cnt;
 +      ticks_per_int = hpet_tick * HZ / hpet_rtc_int_freq;
 +      hpet_t1_cmp += ticks_per_int;
 +      hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
 +
 +      /*
 +       * If the interrupt handler was delayed too long, the write above tries
 +       * to schedule the next interrupt in the past and the hardware would
 +       * not interrupt until the counter had wrapped around.
 +       * So we have to check that the comparator wasn't set to a past time.
 +       */
 +      cnt = hpet_readl(HPET_COUNTER);
 +      if (unlikely((int)(cnt - hpet_t1_cmp) > 0)) {
 +              lost_ints = (cnt - hpet_t1_cmp) / ticks_per_int + 1;
 +              /* Make sure that, even with the time needed to execute
 +               * this code, the next scheduled interrupt has been moved
 +               * back to the future: */
 +              lost_ints++;
 +
 +              hpet_t1_cmp += lost_ints * ticks_per_int;
 +              hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
 +
 +              if (PIE_on)
 +                      PIE_count += lost_ints;
 +
 +              printk(KERN_WARNING "rtc: lost some interrupts at %ldHz.\n",
 +                     hpet_rtc_int_freq);
 +      }
  }
  
  /*
diff --combined arch/x86_64/mm/fault.c
index 4198798e1469cf92d9b58865e0e88daebe405433,3ae3e7bb2fce5bfe79a099b8698d9ecac46e82f1..1a17b0733ab5d38ad81ccdf4263e2d58571d9e24
@@@ -40,8 -40,7 +40,7 @@@
  #define PF_RSVD       (1<<3)
  #define PF_INSTR      (1<<4)
  
- #ifdef CONFIG_KPROBES
- ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
+ static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
  
  /* Hook to register for page fault notifications */
  int register_page_fault_notifier(struct notifier_block *nb)
        vmalloc_sync_all();
        return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
  }
+ EXPORT_SYMBOL_GPL(register_page_fault_notifier);
  
  int unregister_page_fault_notifier(struct notifier_block *nb)
  {
        return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
  }
+ EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
  
  static inline int notify_page_fault(enum die_val val, const char *str,
                        struct pt_regs *regs, long err, int trap, int sig)
        };
        return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
  }
- #else
- static inline int notify_page_fault(enum die_val val, const char *str,
-                       struct pt_regs *regs, long err, int trap, int sig)
- {
-       return NOTIFY_DONE;
- }
- #endif
  
  void bust_spinlocks(int yes)
  {
  static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr,
                                unsigned long error_code)
  { 
-       unsigned char *instr;
+       unsigned char __user *instr;
        int scan_more = 1;
        int prefetch = 0; 
        unsigned char *max_instr;
        if (error_code & PF_INSTR)
                return 0;
        
-       instr = (unsigned char *)convert_rip_to_linear(current, regs);
+       instr = (unsigned char __user *)convert_rip_to_linear(current, regs);
        max_instr = instr + 15;
  
        if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE)
                unsigned char instr_hi;
                unsigned char instr_lo;
  
-               if (__get_user(opcode, instr))
+               if (__get_user(opcode, (char __user *)instr))
                        break; 
  
                instr_hi = opcode & 0xf0; 
                case 0x00:
                        /* Prefetch instruction is 0x0F0D or 0x0F18 */
                        scan_more = 0;
-                       if (__get_user(opcode, instr)) 
+                       if (__get_user(opcode, (char __user *)instr))
                                break;
                        prefetch = (instr_lo == 0xF) &&
                                (opcode == 0x0D || opcode == 0x18);
  static int bad_address(void *p) 
  { 
        unsigned long dummy;
-       return __get_user(dummy, (unsigned long *)p);
+       return __get_user(dummy, (unsigned long __user *)p);
  } 
  
  void dump_pagetable(unsigned long address)
@@@ -299,7 -293,7 +293,7 @@@ static int vmalloc_fault(unsigned long 
        if (pgd_none(*pgd))
                set_pgd(pgd, *pgd_ref);
        else
 -              BUG_ON(pgd_page(*pgd) != pgd_page(*pgd_ref));
 +              BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref));
  
        /* Below here mismatches are bugs because these lower tables
           are shared */
        pud_ref = pud_offset(pgd_ref, address);
        if (pud_none(*pud_ref))
                return -1;
 -      if (pud_none(*pud) || pud_page(*pud) != pud_page(*pud_ref))
 +      if (pud_none(*pud) || pud_page_vaddr(*pud) != pud_page_vaddr(*pud_ref))
                BUG();
        pmd = pmd_offset(pud, address);
        pmd_ref = pmd_offset(pud_ref, address);
@@@ -641,7 -635,7 +635,7 @@@ void vmalloc_sync_all(void
                                if (pgd_none(*pgd))
                                        set_pgd(pgd, *pgd_ref);
                                else
 -                                      BUG_ON(pgd_page(*pgd) != pgd_page(*pgd_ref));
 +                                      BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref));
                        }
                        spin_unlock(&pgd_lock);
                        set_bit(pgd_index(address), insync);
diff --combined arch/x86_64/mm/init.c
index 52fd42c40c8690167db9d8a8bd3b099f99473ac5,53b49c86d7e0f0c3298f867799c7282907fec392..1e4669fa5734fd8a36dfcc59070afb2cad2a4458
@@@ -229,7 -229,6 +229,6 @@@ __init void *early_ioremap(unsigned lon
  
        /* actually usually some more */
        if (size >= LARGE_PAGE_SIZE) { 
-               printk("SMBIOS area too long %lu\n", size);
                return NULL;
        }
        set_pmd(temp_mappings[0].pmd,  __pmd(map | _KERNPG_TABLE | _PAGE_PSE));
@@@ -250,12 -249,13 +249,13 @@@ __init void early_iounmap(void *addr, u
  }
  
  static void __meminit
- phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
+ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
  {
-       int i;
+       int i = pmd_index(address);
  
-       for (i = 0; i < PTRS_PER_PMD; pmd++, i++, address += PMD_SIZE) {
+       for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) {
                unsigned long entry;
+               pmd_t *pmd = pmd_page + pmd_index(address);
  
                if (address >= end) {
                        if (!after_bootmem)
                                        set_pmd(pmd, __pmd(0));
                        break;
                }
+               if (pmd_val(*pmd))
+                       continue;
                entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address;
                entry &= __supported_pte_mask;
                set_pmd(pmd, __pmd(entry));
  static void __meminit
  phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
  {
-       pmd_t *pmd = pmd_offset(pud, (unsigned long)__va(address));
-       if (pmd_none(*pmd)) {
-               spin_lock(&init_mm.page_table_lock);
-               phys_pmd_init(pmd, address, end);
-               spin_unlock(&init_mm.page_table_lock);
-               __flush_tlb_all();
-       }
+       pmd_t *pmd = pmd_offset(pud,0);
+       spin_lock(&init_mm.page_table_lock);
+       phys_pmd_init(pmd, address, end);
+       spin_unlock(&init_mm.page_table_lock);
+       __flush_tlb_all();
  }
  
- static void __meminit phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
+ static void __meminit phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
  { 
-       long i = pud_index(address);
-       pud = pud + i;
+       int i = pud_index(addr);
  
-       if (after_bootmem && pud_val(*pud)) {
-               phys_pmd_update(pud, address, end);
-               return;
-       }
  
-       for (; i < PTRS_PER_PUD; pud++, i++) {
+       for (; i < PTRS_PER_PUD; i++, addr = (addr & PUD_MASK) + PUD_SIZE ) {
                int map; 
-               unsigned long paddr, pmd_phys;
+               unsigned long pmd_phys;
+               pud_t *pud = pud_page + pud_index(addr);
                pmd_t *pmd;
  
-               paddr = (address & PGDIR_MASK) + i*PUD_SIZE;
-               if (paddr >= end)
+               if (addr >= end)
                        break;
  
-               if (!after_bootmem && !e820_any_mapped(paddr, paddr+PUD_SIZE, 0)) {
+               if (!after_bootmem && !e820_any_mapped(addr,addr+PUD_SIZE,0)) {
                        set_pud(pud, __pud(0)); 
                        continue;
                } 
  
+               if (pud_val(*pud)) {
+                       phys_pmd_update(pud, addr, end);
+                       continue;
+               }
                pmd = alloc_low_page(&map, &pmd_phys);
                spin_lock(&init_mm.page_table_lock);
                set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
-               phys_pmd_init(pmd, paddr, end);
+               phys_pmd_init(pmd, addr, end);
                spin_unlock(&init_mm.page_table_lock);
                unmap_low_page(map);
        }
@@@ -536,7 -536,7 +536,7 @@@ int memory_add_physaddr_to_nid(u64 star
  int arch_add_memory(int nid, u64 start, u64 size)
  {
        struct pglist_data *pgdat = NODE_DATA(nid);
 -      struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
 +      struct zone *zone = pgdat->node_zones + ZONE_NORMAL;
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
        int ret;
@@@ -597,12 -597,6 +597,6 @@@ void __init mem_init(void
  
        pci_iommu_alloc();
  
-       /* How many end-of-memory variables you have, grandma! */
-       max_low_pfn = end_pfn;
-       max_pfn = end_pfn;
-       num_physpages = end_pfn;
-       high_memory = (void *) __va(end_pfn * PAGE_SIZE);
        /* clear the zero-page */
        memset(empty_zero_page, 0, PAGE_SIZE);
  
diff --combined drivers/pci/pci.c
index 8ab0278860348cb404c7364e3292934b8608108f,684deb6b03aafa05150fdee22732ebd4fe91a834..590f4e6f505d35328f4b0f706a31c7e9319d3ed7
@@@ -432,12 -432,10 +432,12 @@@ pci_power_t pci_choose_state(struct pci
        case PM_EVENT_ON:
                return PCI_D0;
        case PM_EVENT_FREEZE:
 +      case PM_EVENT_PRETHAW:
 +              /* REVISIT both freeze and pre-thaw "should" use D0 */
        case PM_EVENT_SUSPEND:
                return PCI_D3hot;
        default:
 -              printk("They asked me for state %d\n", state.event);
 +              printk("Unrecognized suspend event %d\n", state.event);
                BUG();
        }
        return PCI_D0;
@@@ -955,12 -953,11 +955,11 @@@ static int __devinit pci_setup(char *st
                }
                str = k;
        }
-       return 1;
+       return 0;
  }
+ early_param("pci", pci_setup);
  
  device_initcall(pci_init);
- __setup("pci=", pci_setup);
  
  #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
  /* FIXME: Some boxes have multiple ISA bridges! */
diff --combined fs/binfmt_elf.c
index 64802aabd1aca5ff3a2a4f09679ad4cbca8e78d9,5109dbff93bfc76081da30d79d0d09a750c001c6..dfd8cfb7fb5dcd213ab74c41474c81e06a69f8e1
@@@ -515,7 -515,8 +515,8 @@@ static unsigned long randomize_stack_to
  {
        unsigned int random_variable = 0;
  
-       if (current->flags & PF_RANDOMIZE) {
+       if ((current->flags & PF_RANDOMIZE) &&
+               !(current->personality & ADDR_NO_RANDOMIZE)) {
                random_variable = get_random_int() & STACK_RND_MASK;
                random_variable <<= PAGE_SHIFT;
        }
@@@ -1262,7 -1263,7 +1263,7 @@@ static void fill_elf_header(struct elfh
        return;
  }
  
 -static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, off_t offset)
 +static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset)
  {
        phdr->p_type = PT_NOTE;
        phdr->p_offset = offset;
@@@ -1428,7 -1429,7 +1429,7 @@@ static int elf_core_dump(long signr, st
        int i;
        struct vm_area_struct *vma;
        struct elfhdr *elf = NULL;
 -      off_t offset = 0, dataoff;
 +      loff_t offset = 0, dataoff;
        unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
        int numnote;
        struct memelfnote *notes = NULL;
        ELF_CORE_WRITE_EXTRA_DATA;
  #endif
  
 -      if ((off_t)file->f_pos != offset) {
 +      if (file->f_pos != offset) {
                /* Sanity check */
                printk(KERN_WARNING
 -                     "elf_core_dump: file->f_pos (%ld) != offset (%ld)\n",
 -                     (off_t)file->f_pos, offset);
 +                     "elf_core_dump: file->f_pos (%Ld) != offset (%Ld)\n",
 +                     file->f_pos, offset);
        }
  
  end_coredump:
index 0dc051a8078b9b393a41236d4573f62f2bd9c15e,64140f2f1b958d24c340e8fc099ff24985863ae9..541b3e23433571d590f8e79291bb2c21fded9306
@@@ -246,23 -246,6 +246,23 @@@ static inline pte_t pte_mkhuge(pte_t pt
  # include <asm/pgtable-2level.h>
  #endif
  
 +/*
 + * We only update the dirty/accessed state if we set
 + * the dirty bit by hand in the kernel, since the hardware
 + * will do the accessed bit for us, and we don't want to
 + * race with other CPU's that might be updating the dirty
 + * bit at the same time.
 + */
 +#define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 +#define ptep_set_access_flags(vma, address, ptep, entry, dirty)               \
 +do {                                                                  \
 +      if (dirty) {                                                    \
 +              (ptep)->pte_low = (entry).pte_low;                      \
 +              flush_tlb_page(vma, address);                           \
 +      }                                                               \
 +} while (0)
 +
 +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
  static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
  {
        if (!pte_dirty(*ptep))
        return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low);
  }
  
 +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
  static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
  {
        if (!pte_young(*ptep))
        return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low);
  }
  
 +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
  static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
  {
        pte_t pte;
        return pte;
  }
  
 +#define __HAVE_ARCH_PTEP_SET_WRPROTECT
  static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
  {
        clear_bit(_PAGE_BIT_RW, &ptep->pte_low);
@@@ -384,11 -364,11 +384,11 @@@ static inline pte_t pte_modify(pte_t pt
  #define pte_index(address) \
                (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
  #define pte_offset_kernel(dir, address) \
 -      ((pte_t *) pmd_page_kernel(*(dir)) +  pte_index(address))
 +      ((pte_t *) pmd_page_vaddr(*(dir)) +  pte_index(address))
  
  #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
  
 -#define pmd_page_kernel(pmd) \
 +#define pmd_page_vaddr(pmd) \
                ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
  
  /*
@@@ -411,8 -391,6 +411,6 @@@ extern pte_t *lookup_address(unsigned l
   static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;}
  #endif
  
- extern void noexec_setup(const char *str);
  #if defined(CONFIG_HIGHPTE)
  #define pte_offset_map(dir, address) \
        ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
  /*
   * The i386 doesn't have any external MMU info: the kernel page
   * tables contain all the necessary information.
 - *
 - * Also, we only update the dirty/accessed state if we set
 - * the dirty bit by hand in the kernel, since the hardware
 - * will do the accessed bit for us, and we don't want to
 - * race with other CPU's that might be updating the dirty
 - * bit at the same time.
   */
  #define update_mmu_cache(vma,address,pte) do { } while (0)
 -#define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 -#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
 -      do {                                                              \
 -              if (__dirty) {                                            \
 -                      (__ptep)->pte_low = (__entry).pte_low;            \
 -                      flush_tlb_page(__vma, __address);                 \
 -              }                                                         \
 -      } while (0)
 -
  #endif /* !__ASSEMBLY__ */
  
  #ifdef CONFIG_FLATMEM
  #define GET_IOSPACE(pfn)              0
  #define GET_PFN(pfn)                  (pfn)
  
 -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
 -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 -#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 -#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
 -#define __HAVE_ARCH_PTEP_SET_WRPROTECT
 -#define __HAVE_ARCH_PTE_SAME
  #include <asm-generic/pgtable.h>
  
  #endif /* _I386_PGTABLE_H */
index 1910880fcd40d95aa67a4f3d242845acd90b59a9,21bb91679c82b1fb869e9befcd3cd2b6a9a9181c..a4a0e5207db58627c4ef02eb1a22eceb54c20a86
@@@ -1,7 -1,24 +1,7 @@@
  #ifndef _I386_PTRACE_H
  #define _I386_PTRACE_H
  
 -#define EBX 0
 -#define ECX 1
 -#define EDX 2
 -#define ESI 3
 -#define EDI 4
 -#define EBP 5
 -#define EAX 6
 -#define DS 7
 -#define ES 8
 -#define FS 9
 -#define GS 10
 -#define ORIG_EAX 11
 -#define EIP 12
 -#define CS  13
 -#define EFL 14
 -#define UESP 15
 -#define SS   16
 -#define FRAME_SIZE 17
 +#include <asm/ptrace-abi.h>
  
  /* this struct defines the way the registers are stored on the 
     stack during a system call. */
@@@ -24,9 -41,26 +24,10 @@@ struct pt_regs 
        int  xss;
  };
  
 -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
 -#define PTRACE_GETREGS            12
 -#define PTRACE_SETREGS            13
 -#define PTRACE_GETFPREGS          14
 -#define PTRACE_SETFPREGS          15
 -#define PTRACE_GETFPXREGS         18
 -#define PTRACE_SETFPXREGS         19
 -
 -#define PTRACE_OLDSETOPTIONS         21
 -
 -#define PTRACE_GET_THREAD_AREA    25
 -#define PTRACE_SET_THREAD_AREA    26
 -
 -#define PTRACE_SYSEMU           31
 -#define PTRACE_SYSEMU_SINGLESTEP  32
 -
  #ifdef __KERNEL__
  
  #include <asm/vm86.h>
+ #include <asm/segment.h>
  
  struct task_struct;
  extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
   */
  static inline int user_mode(struct pt_regs *regs)
  {
-       return (regs->xcs & 3) != 0;
+       return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL;
  }
  static inline int user_mode_vm(struct pt_regs *regs)
  {
-       return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0;
+       return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL;
  }
  #define instruction_pointer(regs) ((regs)->eip)
- #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
  extern unsigned long profile_pc(struct pt_regs *regs);
- #else
- #define profile_pc(regs) instruction_pointer(regs)
- #endif
  #endif /* __KERNEL__ */
  
  #endif
index f65674832318b8e7311ce995a32591f9711ca9d1,fd4198b496375e4c2487f21b127a93ff2d6f8e41..e15d3c8628f3effcb47aec000b0278ac29ff966f
  
  #define E820_RAM      1
  #define E820_RESERVED 2
- #define E820_ACPI     3 /* usable as RAM once ACPI tables have been read */
+ #define E820_ACPI     3
  #define E820_NVS      4
  
- #define HIGH_MEMORY   (1024*1024)
- #define LOWMEMSIZE()  (0x9f000)
  #ifndef __ASSEMBLY__
  struct e820entry {
        u64 addr;       /* start of memory segment */
@@@ -46,7 -42,6 +42,7 @@@ extern void setup_memory_region(void)
  extern void contig_e820_setup(void); 
  extern unsigned long e820_end_of_ram(void);
  extern void e820_reserve_resources(void);
 +extern void e820_mark_nosave_regions(void);
  extern void e820_print_map(char *who);
  extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
  extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
@@@ -56,8 -51,7 +52,7 @@@ extern void e820_setup_gap(void)
  extern unsigned long e820_hole_size(unsigned long start_pfn,
                                    unsigned long end_pfn);
  
- extern void __init parse_memopt(char *p, char **end);
- extern void __init parse_memmapopt(char *p, char **end);
+ extern void finish_e820_parsing(void);
  
  extern struct e820map e820;
  
index bffb2f886a510256974c679095186af021537c3c,39d2bab9b5205f4aa0d97e77c868b38f73109482..285756010c517ed2dbc3a9e89e4abb2ac676f561
  
  #include <asm/pda.h>
  
+ #ifdef CONFIG_MODULES
+ # define PERCPU_MODULE_RESERVE 8192
+ #else
+ # define PERCPU_MODULE_RESERVE 0
+ #endif
+ #define PERCPU_ENOUGH_ROOM \
+       (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
+        PERCPU_MODULE_RESERVE)
  #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
  #define __my_cpu_offset() read_pda(data_offset)
  
      __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
  
  /* var is in discarded region: offset to particular copy we want */
 -#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
 -#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
 -#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
 +#define per_cpu(var, cpu) (*({                                \
 +      extern int simple_indentifier_##var(void);      \
 +      RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)); }))
 +#define __get_cpu_var(var) (*({                               \
 +      extern int simple_indentifier_##var(void);      \
 +      RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); }))
 +#define __raw_get_cpu_var(var) (*({                   \
 +      extern int simple_indentifier_##var(void);      \
 +      RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()); }))
  
  /* A macro to avoid #include hell... */
  #define percpu_modcopy(pcpudst, src, size)                    \
index 51eba239517194df544570cca0869b16dad6a1c1,b34f43acdef10bce3bc99c69ddf8eb363f62b54e..6899e770b173e4a2cb75fdd5bc664359cdf0fa7b
@@@ -21,12 -21,9 +21,9 @@@ extern unsigned long __supported_pte_ma
  
  #define swapper_pg_dir init_level4_pgt
  
- extern int nonx_setup(char *str);
  extern void paging_init(void);
  extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
  
- extern unsigned long pgkern_mask;
  /*
   * ZERO_PAGE is a global shared page that is always zero: used
   * for zero-mapped memory areas etc..
@@@ -101,6 -98,9 +98,6 @@@ static inline void pgd_clear (pgd_t * p
        set_pgd(pgd, __pgd(0));
  }
  
 -#define pud_page(pud) \
 -((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK))
 -
  #define ptep_get_and_clear(mm,addr,xp)        __pte(xchg(&(xp)->pte, 0))
  
  struct mm_struct;
@@@ -265,7 -265,7 +262,7 @@@ static inline pte_t pfn_pte(unsigned lo
  #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
  static inline int pte_user(pte_t pte)         { return pte_val(pte) & _PAGE_USER; }
  static inline int pte_read(pte_t pte)         { return pte_val(pte) & _PAGE_USER; }
- static inline int pte_exec(pte_t pte)         { return pte_val(pte) & _PAGE_USER; }
+ static inline int pte_exec(pte_t pte)         { return !(pte_val(pte) & _PAGE_NX); }
  static inline int pte_dirty(pte_t pte)                { return pte_val(pte) & _PAGE_DIRTY; }
  static inline int pte_young(pte_t pte)                { return pte_val(pte) & _PAGE_ACCESSED; }
  static inline int pte_write(pte_t pte)                { return pte_val(pte) & _PAGE_RW; }
@@@ -278,11 -278,12 +275,12 @@@ static inline pte_t pte_mkclean(pte_t p
  static inline pte_t pte_mkold(pte_t pte)      { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
  static inline pte_t pte_wrprotect(pte_t pte)  { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
  static inline pte_t pte_mkread(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
- static inline pte_t pte_mkexec(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
+ static inline pte_t pte_mkexec(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; }
  static inline pte_t pte_mkdirty(pte_t pte)    { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
  static inline pte_t pte_mkyoung(pte_t pte)    { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
  static inline pte_t pte_mkwrite(pte_t pte)    { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
  static inline pte_t pte_mkhuge(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; }
+ static inline pte_t pte_clrhuge(pte_t pte)    { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_PSE)); return pte; }
  
  struct vm_area_struct;
  
@@@ -323,8 -324,7 +321,8 @@@ static inline int pmd_large(pmd_t pte) 
  /*
   * Level 4 access.
   */
 -#define pgd_page(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK))
 +#define pgd_page_vaddr(pgd) ((unsigned long) __va((unsigned long)pgd_val(pgd) & PTE_MASK))
 +#define pgd_page(pgd)         (pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT))
  #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
  #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
  #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address))
  
  /* PUD - Level3 access */
  /* to find an entry in a page-table-directory. */
 +#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK))
 +#define pud_page(pud)         (pfn_to_page(pud_val(pud) >> PAGE_SHIFT))
  #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
 -#define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address))
 +#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address))
  #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT)
  
  /* PMD  - Level 2 access */
 -#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))
 +#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))
  #define pmd_page(pmd)         (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
  
  #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
 -#define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \
 +#define pmd_offset(dir, address) ((pmd_t *) pud_page_vaddr(*(dir)) + \
                        pmd_index(address))
  #define pmd_none(x)   (!pmd_val(x))
  #define pmd_present(x)        (pmd_val(x) & _PAGE_PRESENT)
@@@ -382,7 -380,7 +380,7 @@@ static inline pte_t pte_modify(pte_t pt
  
  #define pte_index(address) \
                (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 -#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \
 +#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \
                        pte_index(address))
  
  /* x86-64 always has all page tables mapped. */
diff --combined include/asm-x86_64/smp.h
index ce97f65e1d10f5312b1d49df136c21417e1fc033,58b5d6149a421b7cb17fd5d58071d4d767c4a57b..d6b7c057edbaf281ddb97963e027e17931a01211
@@@ -4,27 -4,18 +4,18 @@@
  /*
   * We need the APIC definitions automatically as part of 'smp.h'
   */
- #ifndef __ASSEMBLY__
  #include <linux/threads.h>
  #include <linux/cpumask.h>
  #include <linux/bitops.h>
  extern int disable_apic;
- #endif
  
- #ifdef CONFIG_X86_LOCAL_APIC
- #ifndef __ASSEMBLY__
  #include <asm/fixmap.h>
  #include <asm/mpspec.h>
- #ifdef CONFIG_X86_IO_APIC
  #include <asm/io_apic.h>
- #endif
  #include <asm/apic.h>
  #include <asm/thread_info.h>
- #endif
- #endif
  
  #ifdef CONFIG_SMP
- #ifndef ASSEMBLY
  
  #include <asm/pda.h>
  
@@@ -42,12 -33,13 +33,11 @@@ extern cpumask_t cpu_initialized
   
  extern void smp_alloc_memory(void);
  extern volatile unsigned long smp_invalidate_needed;
- extern int pic_mode;
  extern void lock_ipi_call_lock(void);
  extern void unlock_ipi_call_lock(void);
  extern int smp_num_siblings;
  extern void smp_send_reschedule(int cpu);
  void smp_stop_cpu(void);
 -extern int smp_call_function_single(int cpuid, void (*func) (void *info),
 -                              void *info, int retry, int wait);
  
  extern cpumask_t cpu_sibling_map[NR_CPUS];
  extern cpumask_t cpu_core_map[NR_CPUS];
@@@ -74,20 -66,16 +64,16 @@@ static inline int hard_smp_processor_id
        return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
  }
  
- extern int safe_smp_processor_id(void);
  extern int __cpu_disable(void);
  extern void __cpu_die(unsigned int cpu);
  extern void prefill_possible_map(void);
  extern unsigned num_processors;
  extern unsigned disabled_cpus;
  
- #endif /* !ASSEMBLY */
  #define NO_PROC_ID            0xFF            /* No processor magic marker */
  
  #endif
  
- #ifndef ASSEMBLY
  /*
   * Some lowlevel functions might want to know about
   * the real APIC ID <-> CPU # mapping.
@@@ -109,11 -97,8 +95,8 @@@ static inline int cpu_present_to_apicid
                return BAD_APICID;
  }
  
- #endif /* !ASSEMBLY */
  #ifndef CONFIG_SMP
  #define stack_smp_processor_id() 0
- #define safe_smp_processor_id() 0
  #define cpu_logical_map(x) (x)
  #else
  #include <asm/thread_info.h>
  })
  #endif
  
- #ifndef __ASSEMBLY__
  static __inline int logical_smp_processor_id(void)
  {
        /* we don't want to mark this access volatile - bad code generation */
        return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
  }
- #endif
  
  #ifdef CONFIG_SMP
  #define cpu_physical_id(cpu)          x86_cpu_to_apicid[cpu]
  #else
  #define cpu_physical_id(cpu)          boot_cpu_id
- #endif
+ static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
+                               void *info, int retry, int wait)
+ {
+       /* Disable interrupts here? */
+       func(info);
+       return 0;
+ }
+ #endif /* !CONFIG_SMP */
  #endif
  
diff --combined include/linux/kernel.h
index e44a37e2c71c60d4c45f6bb16729961a974c2c21,1ff9609300b49aa621f5bd34d1358b98ba0dafe2..4fa373bb18acb7c48ba69fd0628377b58382778a
@@@ -33,7 -33,6 +33,7 @@@ extern const char linux_banner[]
  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
  #define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
  #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
  #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
  
  #define       KERN_EMERG      "<0>"   /* system is unusable                   */
@@@ -187,6 -186,7 +187,7 @@@ extern void bust_spinlocks(int yes)
  extern int oops_in_progress;          /* If set, an oops, panic(), BUG() or die() is in progress */
  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);
diff --combined include/linux/sysctl.h
index eca555781d05e1d67e62d070202ced6ac6bcfb84,432778446ad26b5a1ff0e5f04ee67e848758a391..1b24bd45e0804675646b5628cace0fbed1901ab0
@@@ -150,6 -150,8 +150,8 @@@ enu
        KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
        KERN_COMPAT_LOG=73,     /* int: print compat layer  messages */
        KERN_MAX_LOCK_DEPTH=74,
+       KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
+       KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
  };
  
  
@@@ -191,7 -193,6 +193,7 @@@ enu
        VM_MIN_UNMAPPED=32,     /* Set min percent of unmapped pages */
        VM_PANIC_ON_OOM=33,     /* panic at out-of-memory */
        VM_VDSO_ENABLED=34,     /* map VDSO into new processes? */
 +      VM_MIN_SLAB=35,          /* Percent pages ignored by zone reclaim */
  };
  
  
diff --combined kernel/sysctl.c
index fd43c3e6786b5b19c8ff173b45638c56392c7d86,220e2056412433912881ae45405ed6fb838eadb1..bcb3a181dbb2fb3984939dffd7f27e24d449da11
@@@ -76,8 -76,9 +76,9 @@@ extern int compat_log
  
  #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
  int unknown_nmi_panic;
- extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *,
-                                 void __user *, size_t *, loff_t *);
+ int nmi_watchdog_enabled;
+ extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
+                       void __user *, size_t *, loff_t *);
  #endif
  
  /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
@@@ -628,10 -629,26 +629,26 @@@ static ctl_table kern_table[] = 
                .data           = &unknown_nmi_panic,
                .maxlen         = sizeof (int),
                .mode           = 0644,
-               .proc_handler   = &proc_unknown_nmi_panic,
+               .proc_handler   = &proc_dointvec,
+       },
+       {
+               .ctl_name       = KERN_NMI_WATCHDOG,
+               .procname       = "nmi_watchdog",
+               .data           = &nmi_watchdog_enabled,
+               .maxlen         = sizeof (int),
+               .mode           = 0644,
+               .proc_handler   = &proc_nmi_enabled,
        },
  #endif
  #if defined(CONFIG_X86)
+       {
+               .ctl_name       = KERN_PANIC_ON_NMI,
+               .procname       = "panic_on_unrecovered_nmi",
+               .data           = &panic_on_unrecovered_nmi,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
        {
                .ctl_name       = KERN_BOOTLOADER_TYPE,
                .procname       = "bootloader_type",
@@@ -943,17 -960,6 +960,17 @@@ static ctl_table vm_table[] = 
                .extra1         = &zero,
                .extra2         = &one_hundred,
        },
 +      {
 +              .ctl_name       = VM_MIN_SLAB,
 +              .procname       = "min_slab_ratio",
 +              .data           = &sysctl_min_slab_ratio,
 +              .maxlen         = sizeof(sysctl_min_slab_ratio),
 +              .mode           = 0644,
 +              .proc_handler   = &sysctl_min_slab_ratio_sysctl_handler,
 +              .strategy       = &sysctl_intvec,
 +              .extra1         = &zero,
 +              .extra2         = &one_hundred,
 +      },
  #endif
  #ifdef CONFIG_X86_32
        {
diff --combined lib/Kconfig.debug
index 2869307ca3e427e89803421a0490bcb2b6ea8439,c795a17a70436283353d23d22960ae44ed245bb6..f1ac3184dc08c5566f7f1c812675cc57059a4e7e
@@@ -8,13 -8,6 +8,13 @@@ config PRINTK_TIM
          operations.  This is useful for identifying long delays
          in kernel startup.
  
 +config ENABLE_MUST_CHECK
 +      bool "Enable __must_check logic"
 +      default y
 +      help
 +        Enable the __must_check logic in the kernel build.  Disable this to
 +        suppress the "warning: ignoring return value of 'foo', declared with
 +        attribute warn_unused_result" messages.
  
  config MAGIC_SYSRQ
        bool "Magic SysRq key"
@@@ -225,7 -218,7 +225,7 @@@ config LOCKDE
        bool
        depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
        select STACKTRACE
-       select FRAME_POINTER
+       select FRAME_POINTER if !X86
        select KALLSYMS
        select KALLSYMS_ALL
  
@@@ -284,7 -277,7 +284,7 @@@ config DEBUG_HIGHME
  config DEBUG_BUGVERBOSE
        bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
        depends on BUG
 -      depends on ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64 || X86_32 || FRV
 +      depends on ARM || ARM26 || AVR32 || M32R || M68K || SPARC32 || SPARC64 || X86_32 || FRV
        default !EMBEDDED
        help
          Say Y here to make BUG() panics output the file name and line number
@@@ -322,7 -315,7 +322,7 @@@ config DEBUG_V
  
  config FRAME_POINTER
        bool "Compile the kernel with frame pointers"
 -      depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390)
 +      depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32)
        default y if DEBUG_INFO && UML
        help
          If you say Y here the resulting kernel image will be slightly larger