]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
authorLinus Torvalds <torvalds@woody.osdl.org>
Thu, 7 Dec 2006 16:59:11 +0000 (08:59 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Thu, 7 Dec 2006 16:59:11 +0000 (08:59 -0800)
* 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (156 commits)
  [PATCH] x86-64: Export smp_call_function_single
  [PATCH] i386: Clean up smp_tune_scheduling()
  [PATCH] unwinder: move .eh_frame to RODATA
  [PATCH] unwinder: fully support linker generated .eh_frame_hdr section
  [PATCH] x86-64: don't use set_irq_regs()
  [PATCH] x86-64: check vector in setup_ioapic_dest to verify if need setup_IO_APIC_irq
  [PATCH] x86-64: Make ix86 default to HIGHMEM4G instead of NOHIGHMEM
  [PATCH] i386: replace kmalloc+memset with kzalloc
  [PATCH] x86-64: remove remaining pc98 code
  [PATCH] x86-64: remove unused variable
  [PATCH] x86-64: Fix constraints in atomic_add_return()
  [PATCH] x86-64: fix asm constraints in i386 atomic_add_return
  [PATCH] x86-64: Correct documentation for bzImage protocol v2.05
  [PATCH] x86-64: replace kmalloc+memset with kzalloc in MTRR code
  [PATCH] x86-64: Fix numaq build error
  [PATCH] x86-64: include/asm-x86_64/cpufeature.h isn't a userspace header
  [PATCH] unwinder: Add debugging output to the Dwarf2 unwinder
  [PATCH] x86-64: Clarify error message in GART code
  [PATCH] x86-64: Fix interrupt race in idle callback (3rd try)
  [PATCH] x86-64: Remove unwind stack pointer alignment forcing again
  ...

Fixed conflict in include/linux/uaccess.h manually

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
32 files changed:
1  2 
Documentation/kernel-parameters.txt
arch/i386/kernel/cpuid.c
arch/i386/kernel/io_apic.c
arch/i386/kernel/msr.c
arch/i386/kernel/setup.c
arch/i386/kernel/smp.c
arch/i386/kernel/smpboot.c
arch/i386/kernel/sysenter.c
arch/i386/kernel/traps.c
arch/i386/kernel/tsc.c
arch/i386/mm/init.c
arch/i386/mm/pgtable.c
arch/x86_64/kernel/mce.c
arch/x86_64/kernel/setup.c
arch/x86_64/kernel/smp.c
arch/x86_64/kernel/smpboot.c
arch/x86_64/kernel/vsyscall.c
drivers/pnp/pnpbios/core.c
fs/compat_ioctl.c
include/asm-i386/atomic.h
include/asm-i386/pgtable.h
include/asm-i386/setup.h
include/asm-i386/suspend.h
include/asm-x86_64/Kbuild
include/asm-x86_64/atomic.h
include/asm-x86_64/smp.h
include/linux/cpu.h
include/linux/uaccess.h
init/main.c
kernel/fork.c
kernel/lockdep.c
kernel/sysctl.c

index 6b3c3e37a27759ae97753e5944a59630c1fe4ada,d34fd6a28faa9ab3f7ebbe34aa4dc706aaa4c27e..b79bcdf163199fe147311cb94e3711a0cb24512d
@@@ -599,8 -599,6 +599,6 @@@ and is between 256 and 4096 characters
  
        hugepages=      [HW,IA-32,IA-64] Maximal number of HugeTLB pages.
  
-       noirqbalance    [IA-32,SMP,KNL] Disable kernel irq balancing
        i8042.direct    [HW] Put keyboard port into non-translated mode
        i8042.dumbkbd   [HW] Pretend that controller can only read data from
                             keyboard and cannot control its state
        idle=           [HW]
                        Format: idle=poll or idle=halt
  
 +      ignore_loglevel [KNL]
 +                      Ignore loglevel setting - this will print /all/
 +                      kernel messages to the console. Useful for debugging.
 +
        ihash_entries=  [KNL]
                        Set number of hash buckets for inode cache.
  
                        Format: <RDP>,<reset>,<pci_scan>,<verbosity>
  
        isolcpus=       [KNL,SMP] Isolate CPUs from the general scheduler.
 -                      Format: <cpu number>,...,<cpu number>
 +                      Format:
 +                      <cpu number>,...,<cpu number>
 +                      or
 +                      <cpu number>-<cpu number>  (must be a positive range in ascending order)
 +                      or a mixture
 +                      <cpu number>,...,<cpu number>-<cpu number>
                        This option can be used to specify one or more CPUs
                        to isolate from the general SMP balancing and scheduling
                        algorithms. The only way to move a process onto or off
                        emulation library even if a 387 maths coprocessor
                        is present.
  
 +      noaliencache    [MM, NUMA] Disables the allcoation of alien caches in
 +                      the slab allocator.  Saves per-node memory, but will
 +                      impact performance on real NUMA hardware.
 +
        noalign         [KNL,ARM]
  
        noapic          [SMP,APIC] Tells the kernel to not make use of any
                        in certain environments such as networked servers or
                        real-time systems.
  
+       noirqbalance    [IA-32,SMP,KNL] Disable kernel irq balancing
        noirqdebug      [IA-32] Disables the code which attempts to detect and
                        disable unhandled interrupt sources.
  
+       no_timer_check  [IA-32,X86_64,APIC] Disables the code which tests for
+                       broken timer IRQ sources.
        noisapnp        [ISAPNP] Disables ISA PnP code.
  
        noinitrd        [RAM] Tells the kernel not to load any configured
                        Param: "schedule" - profile schedule points.
                        Param: <number> - step/bucket size as a power of 2 for
                                statistical time based profiling.
 +                      Param: "sleep" - profile D-state sleeping (millisecs)
  
        processor.max_cstate=   [HW,ACPI]
                        Limit processor to maximum C-state
        resume=         [SWSUSP]
                        Specify the partition device for software suspend
  
 +      resume_offset=  [SWSUSP]
 +                      Specify the offset from the beginning of the partition
 +                      given by "resume=" at which the swap header is located,
 +                      in <PAGE_SIZE> units (needed only for swap files).
 +                      See  Documentation/power/swsusp-and-swap-files.txt
 +
        rhash_entries=  [KNL,NET]
                        Set number of hash buckets for route cache
  
        norandmaps      Don't use address space randomization
                        Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space
  
+       unwind_debug=N  N > 0 will enable dwarf2 unwinder debugging
+                       This is useful to get more information why
+                       you got a "dwarf2 unwinder stuck"
  
  ______________________________________________________________________
  
diff --combined arch/i386/kernel/cpuid.c
index 23b2cc748d4e0258b5e40b5674468edde289050b,5c5d4507ee7dcbbcc6cb5897b5310055aed93e0d..db6dd20c3589ebf46e78176a123874f6b074f215
@@@ -34,7 -34,6 +34,6 @@@
  #include <linux/major.h>
  #include <linux/fs.h>
  #include <linux/smp_lock.h>
- #include <linux/fs.h>
  #include <linux/device.h>
  #include <linux/cpu.h>
  #include <linux/notifier.h>
@@@ -167,6 -166,7 +166,6 @@@ static int cpuid_device_create(int i
        return err;
  }
  
 -#ifdef CONFIG_HOTPLUG_CPU
  static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
  {
        unsigned int cpu = (unsigned long)hcpu;
@@@ -186,6 -186,7 +185,6 @@@ static struct notifier_block __cpuinitd
  {
        .notifier_call = cpuid_class_cpu_callback,
  };
 -#endif /* !CONFIG_HOTPLUG_CPU */
  
  static int __init cpuid_init(void)
  {
index 44c5a3206b2a0186d1c913c78361f93def903acf,7f015a71ab55b51cdbd344c361459edacdf985e6..e21dcde0790e62cd389b6062803e9bd014a51048
@@@ -34,7 -34,6 +34,7 @@@
  #include <linux/pci.h>
  #include <linux/msi.h>
  #include <linux/htirq.h>
 +#include <linux/freezer.h>
  
  #include <asm/io.h>
  #include <asm/smp.h>
@@@ -154,14 -153,20 +154,20 @@@ static struct IO_APIC_route_entry ioapi
   * the interrupt, and we need to make sure the entry is fully populated
   * before that happens.
   */
- static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
+ static void
+ __ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
  {
-       unsigned long flags;
        union entry_union eu;
        eu.entry = e;
-       spin_lock_irqsave(&ioapic_lock, flags);
        io_apic_write(apic, 0x11 + 2*pin, eu.w2);
        io_apic_write(apic, 0x10 + 2*pin, eu.w1);
+ }
+ static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
+ {
+       unsigned long flags;
+       spin_lock_irqsave(&ioapic_lock, flags);
+       __ioapic_write_entry(apic, pin, e);
        spin_unlock_irqrestore(&ioapic_lock, flags);
  }
  
@@@ -837,8 -842,7 +843,7 @@@ static int __init find_isa_irq_pin(int 
  
                if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA ||
                     mp_bus_id_to_type[lbus] == MP_BUS_EISA ||
-                    mp_bus_id_to_type[lbus] == MP_BUS_MCA ||
-                    mp_bus_id_to_type[lbus] == MP_BUS_NEC98
+                    mp_bus_id_to_type[lbus] == MP_BUS_MCA
                    ) &&
                    (mp_irqs[i].mpc_irqtype == type) &&
                    (mp_irqs[i].mpc_srcbusirq == irq))
@@@ -857,8 -861,7 +862,7 @@@ static int __init find_isa_irq_apic(in
  
                if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA ||
                     mp_bus_id_to_type[lbus] == MP_BUS_EISA ||
-                    mp_bus_id_to_type[lbus] == MP_BUS_MCA ||
-                    mp_bus_id_to_type[lbus] == MP_BUS_NEC98
+                    mp_bus_id_to_type[lbus] == MP_BUS_MCA
                    ) &&
                    (mp_irqs[i].mpc_irqtype == type) &&
                    (mp_irqs[i].mpc_srcbusirq == irq))
@@@ -988,12 -991,6 +992,6 @@@ static int EISA_ELCR(unsigned int irq
  #define default_MCA_trigger(idx)      (1)
  #define default_MCA_polarity(idx)     (0)
  
- /* NEC98 interrupts are always polarity zero edge triggered,
-  * when listed as conforming in the MP table. */
- #define default_NEC98_trigger(idx)     (0)
- #define default_NEC98_polarity(idx)    (0)
  static int __init MPBIOS_polarity(int idx)
  {
        int bus = mp_irqs[idx].mpc_srcbus;
                                        polarity = default_MCA_polarity(idx);
                                        break;
                                }
-                               case MP_BUS_NEC98: /* NEC 98 pin */
-                               {
-                                       polarity = default_NEC98_polarity(idx);
-                                       break;
-                               }
                                default:
                                {
                                        printk(KERN_WARNING "broken BIOS!!\n");
@@@ -1102,11 -1094,6 +1095,6 @@@ static int MPBIOS_trigger(int idx
                                        trigger = default_MCA_trigger(idx);
                                        break;
                                }
-                               case MP_BUS_NEC98: /* NEC 98 pin */
-                               {
-                                       trigger = default_NEC98_trigger(idx);
-                                       break;
-                               }
                                default:
                                {
                                        printk(KERN_WARNING "broken BIOS!!\n");
@@@ -1168,7 -1155,6 +1156,6 @@@ static int pin_2_irq(int idx, int apic
                case MP_BUS_ISA: /* ISA pin */
                case MP_BUS_EISA:
                case MP_BUS_MCA:
-               case MP_BUS_NEC98:
                {
                        irq = mp_irqs[idx].mpc_srcbusirq;
                        break;
@@@ -1236,7 -1222,7 +1223,7 @@@ static inline int IO_APIC_irq_trigger(i
  }
  
  /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
- u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
  
  static int __assign_irq_vector(int irq)
  {
@@@ -1361,8 -1347,8 +1348,8 @@@ static void __init setup_IO_APIC_irqs(v
                        if (!apic && (irq < 16))
                                disable_8259A_irq(irq);
                }
-               ioapic_write_entry(apic, pin, entry);
                spin_lock_irqsave(&ioapic_lock, flags);
+               __ioapic_write_entry(apic, pin, entry);
                set_native_irq_info(irq, TARGET_CPUS);
                spin_unlock_irqrestore(&ioapic_lock, flags);
        }
@@@ -1927,6 -1913,15 +1914,15 @@@ static void __init setup_ioapic_ids_fro
  static void __init setup_ioapic_ids_from_mpc(void) { }
  #endif
  
+ static int no_timer_check __initdata;
+ static int __init notimercheck(char *s)
+ {
+       no_timer_check = 1;
+       return 1;
+ }
+ __setup("no_timer_check", notimercheck);
  /*
   * There is a nasty bug in some older SMP boards, their mptable lies
   * about the timer IRQ. We do the following to work around the situation:
   *    - if this function detects that timer IRQs are defunct, then we fall
   *      back to ISA timer IRQs
   */
static int __init timer_irq_works(void)
+ int __init timer_irq_works(void)
  {
        unsigned long t1 = jiffies;
  
+       if (no_timer_check)
+               return 1;
        local_irq_enable();
        /* Let ten ticks pass... */
        mdelay((10 * 1000) / HZ);
@@@ -2162,9 -2160,15 +2161,15 @@@ static inline void unlock_ExtINT_logic(
        unsigned char save_control, save_freq_select;
  
        pin  = find_isa_irq_pin(8, mp_INT);
+       if (pin == -1) {
+               WARN_ON_ONCE(1);
+               return;
+       }
        apic = find_isa_irq_apic(8, mp_INT);
-       if (pin == -1)
+       if (apic == -1) {
+               WARN_ON_ONCE(1);
                return;
+       }
  
        entry0 = ioapic_read_entry(apic, pin);
        clear_IO_APIC_pin(apic, pin);
@@@ -2209,7 -2213,7 +2214,7 @@@ int timer_uses_ioapic_pin_0
   * is so screwy.  Thanks to Brian Perkins for testing/hacking this beast
   * fanatically on his truly buggy board.
   */
- static inline void check_timer(void)
+ static inline void __init check_timer(void)
  {
        int apic1, pin1, apic2, pin2;
        int vector;
@@@ -2857,8 -2861,8 +2862,8 @@@ int io_apic_set_pci_routing (int ioapic
        if (!ioapic && (irq < 16))
                disable_8259A_irq(irq);
  
-       ioapic_write_entry(ioapic, pin, entry);
        spin_lock_irqsave(&ioapic_lock, flags);
+       __ioapic_write_entry(ioapic, pin, entry);
        set_native_irq_info(irq, TARGET_CPUS);
        spin_unlock_irqrestore(&ioapic_lock, flags);
  
diff --combined arch/i386/kernel/msr.c
index 7763c67ca2820a5bba6d7e1b76549d12d9ff301d,fd45059c9084fc9e117280ba09415b38c6377374..1d1a56cae34064755c1e6b78148ba780dba307f2
@@@ -195,7 -195,6 +195,6 @@@ static ssize_t msr_write(struct file *f
  {
        const u32 __user *tmp = (const u32 __user *)buf;
        u32 data[2];
-       size_t rv;
        u32 reg = *ppos;
        int cpu = iminor(file->f_dentry->d_inode);
        int err;
        if (count % 8)
                return -EINVAL; /* Invalid chunk size */
  
-       for (rv = 0; count; count -= 8) {
+       for (; count; count -= 8) {
                if (copy_from_user(&data, tmp, 8))
                        return -EFAULT;
                err = do_wrmsr(cpu, reg, data[0], data[1]);
@@@ -250,6 -249,7 +249,6 @@@ static int msr_device_create(int i
        return err;
  }
  
 -#ifdef CONFIG_HOTPLUG_CPU
  static int msr_class_cpu_callback(struct notifier_block *nfb,
                                unsigned long action, void *hcpu)
  {
@@@ -270,6 -270,7 +269,6 @@@ static struct notifier_block __cpuinitd
  {
        .notifier_call = msr_class_cpu_callback,
  };
 -#endif
  
  static int __init msr_init(void)
  {
diff --combined arch/i386/kernel/setup.c
index 97bb869307bc9344a5bfe9ed30fed8595e06925b,695d53fd14de67e42e244d969bd84d24197b8cdd..79df6e612dbd03a20bfcc959dbb1ceba7158c1dd
@@@ -63,9 -63,6 +63,6 @@@
  #include <setup_arch.h>
  #include <bios_ebda.h>
  
- /* Forward Declaration. */
- void __init find_max_pfn(void);
  /* This value is set up by the early boot code to point to the value
     immediately after the boot time page tables.  It contains a *physical*
     address, and must not be in the .bss segment! */
@@@ -76,11 -73,8 +73,8 @@@ int disable_pse __devinitdata = 0
  /*
   * Machine setup..
   */
- #ifdef CONFIG_EFI
- int efi_enabled = 0;
- EXPORT_SYMBOL(efi_enabled);
- #endif
+ extern struct resource code_resource;
+ extern struct resource data_resource;
  
  /* cpu data as detected by the assembly code in head.S */
  struct cpuinfo_x86 new_cpu_data __initdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
@@@ -99,12 -93,6 +93,6 @@@ unsigned int machine_submodel_id
  unsigned int BIOS_revision;
  unsigned int mca_pentium_flag;
  
- /* For PCI or other memory-mapped resources */
- unsigned long pci_mem_start = 0x10000000;
- #ifdef CONFIG_PCI
- EXPORT_SYMBOL(pci_mem_start);
- #endif
  /* Boot loader ID as an integer, for the benefit of proc_dointvec */
  int bootloader_type;
  
@@@ -134,7 -122,6 +122,6 @@@ struct ist_info ist_info
        defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
  EXPORT_SYMBOL(ist_info);
  #endif
- struct e820map e820;
  
  extern void early_cpu_init(void);
  extern int root_mountflags;
@@@ -149,516 -136,6 +136,6 @@@ static char command_line[COMMAND_LINE_S
  
  unsigned char __initdata boot_params[PARAM_SIZE];
  
- static struct resource data_resource = {
-       .name   = "Kernel data",
-       .start  = 0,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
- };
- static struct resource code_resource = {
-       .name   = "Kernel code",
-       .start  = 0,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
- };
- static struct resource system_rom_resource = {
-       .name   = "System ROM",
-       .start  = 0xf0000,
-       .end    = 0xfffff,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- };
- static struct resource extension_rom_resource = {
-       .name   = "Extension ROM",
-       .start  = 0xe0000,
-       .end    = 0xeffff,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- };
- static struct resource adapter_rom_resources[] = { {
-       .name   = "Adapter ROM",
-       .start  = 0xc8000,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- }, {
-       .name   = "Adapter ROM",
-       .start  = 0,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- }, {
-       .name   = "Adapter ROM",
-       .start  = 0,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- }, {
-       .name   = "Adapter ROM",
-       .start  = 0,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- }, {
-       .name   = "Adapter ROM",
-       .start  = 0,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- }, {
-       .name   = "Adapter ROM",
-       .start  = 0,
-       .end    = 0,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- } };
- static struct resource video_rom_resource = {
-       .name   = "Video ROM",
-       .start  = 0xc0000,
-       .end    = 0xc7fff,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
- };
- static struct resource video_ram_resource = {
-       .name   = "Video RAM area",
-       .start  = 0xa0000,
-       .end    = 0xbffff,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
- };
- static struct resource standard_io_resources[] = { {
-       .name   = "dma1",
-       .start  = 0x0000,
-       .end    = 0x001f,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "pic1",
-       .start  = 0x0020,
-       .end    = 0x0021,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "timer0",
-       .start  = 0x0040,
-       .end    = 0x0043,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "timer1",
-       .start  = 0x0050,
-       .end    = 0x0053,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "keyboard",
-       .start  = 0x0060,
-       .end    = 0x006f,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "dma page reg",
-       .start  = 0x0080,
-       .end    = 0x008f,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "pic2",
-       .start  = 0x00a0,
-       .end    = 0x00a1,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "dma2",
-       .start  = 0x00c0,
-       .end    = 0x00df,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- }, {
-       .name   = "fpu",
-       .start  = 0x00f0,
-       .end    = 0x00ff,
-       .flags  = IORESOURCE_BUSY | IORESOURCE_IO
- } };
- #define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
- static int __init romchecksum(unsigned char *rom, unsigned long length)
- {
-       unsigned char *p, sum = 0;
-       for (p = rom; p < rom + length; p++)
-               sum += *p;
-       return sum == 0;
- }
- static void __init probe_roms(void)
- {
-       unsigned long start, length, upper;
-       unsigned char *rom;
-       int           i;
-       /* video rom */
-       upper = adapter_rom_resources[0].start;
-       for (start = video_rom_resource.start; start < upper; start += 2048) {
-               rom = isa_bus_to_virt(start);
-               if (!romsignature(rom))
-                       continue;
-               video_rom_resource.start = start;
-               /* 0 < length <= 0x7f * 512, historically */
-               length = rom[2] * 512;
-               /* if checksum okay, trust length byte */
-               if (length && romchecksum(rom, length))
-                       video_rom_resource.end = start + length - 1;
-               request_resource(&iomem_resource, &video_rom_resource);
-               break;
-       }
-       start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
-       if (start < upper)
-               start = upper;
-       /* system rom */
-       request_resource(&iomem_resource, &system_rom_resource);
-       upper = system_rom_resource.start;
-       /* check for extension rom (ignore length byte!) */
-       rom = isa_bus_to_virt(extension_rom_resource.start);
-       if (romsignature(rom)) {
-               length = extension_rom_resource.end - extension_rom_resource.start + 1;
-               if (romchecksum(rom, length)) {
-                       request_resource(&iomem_resource, &extension_rom_resource);
-                       upper = extension_rom_resource.start;
-               }
-       }
-       /* check for adapter roms on 2k boundaries */
-       for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
-               rom = isa_bus_to_virt(start);
-               if (!romsignature(rom))
-                       continue;
-               /* 0 < length <= 0x7f * 512, historically */
-               length = rom[2] * 512;
-               /* but accept any length that fits if checksum okay */
-               if (!length || start + length > upper || !romchecksum(rom, length))
-                       continue;
-               adapter_rom_resources[i].start = start;
-               adapter_rom_resources[i].end = start + length - 1;
-               request_resource(&iomem_resource, &adapter_rom_resources[i]);
-               start = adapter_rom_resources[i++].end & ~2047UL;
-       }
- }
- static void __init limit_regions(unsigned long long size)
- {
-       unsigned long long current_addr = 0;
-       int i;
-       if (efi_enabled) {
-               efi_memory_desc_t *md;
-               void *p;
-               for (p = memmap.map, i = 0; p < memmap.map_end;
-                       p += memmap.desc_size, i++) {
-                       md = p;
-                       current_addr = md->phys_addr + (md->num_pages << 12);
-                       if (md->type == EFI_CONVENTIONAL_MEMORY) {
-                               if (current_addr >= size) {
-                                       md->num_pages -=
-                                               (((current_addr-size) + PAGE_SIZE-1) >> PAGE_SHIFT);
-                                       memmap.nr_map = i + 1;
-                                       return;
-                               }
-                       }
-               }
-       }
-       for (i = 0; i < e820.nr_map; i++) {
-               current_addr = e820.map[i].addr + e820.map[i].size;
-               if (current_addr < size)
-                       continue;
-               if (e820.map[i].type != E820_RAM)
-                       continue;
-               if (e820.map[i].addr >= size) {
-                       /*
-                        * This region starts past the end of the
-                        * requested size, skip it completely.
-                        */
-                       e820.nr_map = i;
-               } else {
-                       e820.nr_map = i + 1;
-                       e820.map[i].size -= current_addr - size;
-               }
-               return;
-       }
- }
- void __init add_memory_region(unsigned long long start,
-                             unsigned long long size, int type)
- {
-       int x;
-       if (!efi_enabled) {
-                       x = e820.nr_map;
-               if (x == E820MAX) {
-                   printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
-                   return;
-               }
-               e820.map[x].addr = start;
-               e820.map[x].size = size;
-               e820.map[x].type = type;
-               e820.nr_map++;
-       }
- } /* add_memory_region */
- #define E820_DEBUG    1
- static void __init print_memory_map(char *who)
- {
-       int i;
-       for (i = 0; i < e820.nr_map; i++) {
-               printk(" %s: %016Lx - %016Lx ", who,
-                       e820.map[i].addr,
-                       e820.map[i].addr + e820.map[i].size);
-               switch (e820.map[i].type) {
-               case E820_RAM:  printk("(usable)\n");
-                               break;
-               case E820_RESERVED:
-                               printk("(reserved)\n");
-                               break;
-               case E820_ACPI:
-                               printk("(ACPI data)\n");
-                               break;
-               case E820_NVS:
-                               printk("(ACPI NVS)\n");
-                               break;
-               default:        printk("type %lu\n", e820.map[i].type);
-                               break;
-               }
-       }
- }
- /*
-  * Sanitize the BIOS e820 map.
-  *
-  * Some e820 responses include overlapping entries.  The following 
-  * replaces the original e820 map with a new one, removing overlaps.
-  *
-  */
- struct change_member {
-       struct e820entry *pbios; /* pointer to original bios entry */
-       unsigned long long addr; /* address for this change point */
- };
- static struct change_member change_point_list[2*E820MAX] __initdata;
- static struct change_member *change_point[2*E820MAX] __initdata;
- static struct e820entry *overlap_list[E820MAX] __initdata;
- static struct e820entry new_bios[E820MAX] __initdata;
- int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
- {
-       struct change_member *change_tmp;
-       unsigned long current_type, last_type;
-       unsigned long long last_addr;
-       int chgidx, still_changing;
-       int overlap_entries;
-       int new_bios_entry;
-       int old_nr, new_nr, chg_nr;
-       int i;
-       /*
-               Visually we're performing the following (1,2,3,4 = memory types)...
-               Sample memory map (w/overlaps):
-                  ____22__________________
-                  ______________________4_
-                  ____1111________________
-                  _44_____________________
-                  11111111________________
-                  ____________________33__
-                  ___________44___________
-                  __________33333_________
-                  ______________22________
-                  ___________________2222_
-                  _________111111111______
-                  _____________________11_
-                  _________________4______
-               Sanitized equivalent (no overlap):
-                  1_______________________
-                  _44_____________________
-                  ___1____________________
-                  ____22__________________
-                  ______11________________
-                  _________1______________
-                  __________3_____________
-                  ___________44___________
-                  _____________33_________
-                  _______________2________
-                  ________________1_______
-                  _________________4______
-                  ___________________2____
-                  ____________________33__
-                  ______________________4_
-       */
-       /* if there's only one memory region, don't bother */
-       if (*pnr_map < 2)
-               return -1;
-       old_nr = *pnr_map;
-       /* bail out if we find any unreasonable addresses in bios map */
-       for (i=0; i<old_nr; i++)
-               if (biosmap[i].addr + biosmap[i].size < biosmap[i].addr)
-                       return -1;
-       /* create pointers for initial change-point information (for sorting) */
-       for (i=0; i < 2*old_nr; i++)
-               change_point[i] = &change_point_list[i];
-       /* record all known change-points (starting and ending addresses),
-          omitting those that are for empty memory regions */
-       chgidx = 0;
-       for (i=0; i < old_nr; i++)      {
-               if (biosmap[i].size != 0) {
-                       change_point[chgidx]->addr = biosmap[i].addr;
-                       change_point[chgidx++]->pbios = &biosmap[i];
-                       change_point[chgidx]->addr = biosmap[i].addr + biosmap[i].size;
-                       change_point[chgidx++]->pbios = &biosmap[i];
-               }
-       }
-       chg_nr = chgidx;        /* true number of change-points */
-       /* sort change-point list by memory addresses (low -> high) */
-       still_changing = 1;
-       while (still_changing)  {
-               still_changing = 0;
-               for (i=1; i < chg_nr; i++)  {
-                       /* if <current_addr> > <last_addr>, swap */
-                       /* or, if current=<start_addr> & last=<end_addr>, swap */
-                       if ((change_point[i]->addr < change_point[i-1]->addr) ||
-                               ((change_point[i]->addr == change_point[i-1]->addr) &&
-                                (change_point[i]->addr == change_point[i]->pbios->addr) &&
-                                (change_point[i-1]->addr != change_point[i-1]->pbios->addr))
-                          )
-                       {
-                               change_tmp = change_point[i];
-                               change_point[i] = change_point[i-1];
-                               change_point[i-1] = change_tmp;
-                               still_changing=1;
-                       }
-               }
-       }
-       /* create a new bios memory map, removing overlaps */
-       overlap_entries=0;       /* number of entries in the overlap table */
-       new_bios_entry=0;        /* index for creating new bios map entries */
-       last_type = 0;           /* start with undefined memory type */
-       last_addr = 0;           /* start with 0 as last starting address */
-       /* loop through change-points, determining affect on the new bios map */
-       for (chgidx=0; chgidx < chg_nr; chgidx++)
-       {
-               /* keep track of all overlapping bios entries */
-               if (change_point[chgidx]->addr == change_point[chgidx]->pbios->addr)
-               {
-                       /* add map entry to overlap list (> 1 entry implies an overlap) */
-                       overlap_list[overlap_entries++]=change_point[chgidx]->pbios;
-               }
-               else
-               {
-                       /* remove entry from list (order independent, so swap with last) */
-                       for (i=0; i<overlap_entries; i++)
-                       {
-                               if (overlap_list[i] == change_point[chgidx]->pbios)
-                                       overlap_list[i] = overlap_list[overlap_entries-1];
-                       }
-                       overlap_entries--;
-               }
-               /* if there are overlapping entries, decide which "type" to use */
-               /* (larger value takes precedence -- 1=usable, 2,3,4,4+=unusable) */
-               current_type = 0;
-               for (i=0; i<overlap_entries; i++)
-                       if (overlap_list[i]->type > current_type)
-                               current_type = overlap_list[i]->type;
-               /* continue building up new bios map based on this information */
-               if (current_type != last_type)  {
-                       if (last_type != 0)      {
-                               new_bios[new_bios_entry].size =
-                                       change_point[chgidx]->addr - last_addr;
-                               /* move forward only if the new size was non-zero */
-                               if (new_bios[new_bios_entry].size != 0)
-                                       if (++new_bios_entry >= E820MAX)
-                                               break;  /* no more space left for new bios entries */
-                       }
-                       if (current_type != 0)  {
-                               new_bios[new_bios_entry].addr = change_point[chgidx]->addr;
-                               new_bios[new_bios_entry].type = current_type;
-                               last_addr=change_point[chgidx]->addr;
-                       }
-                       last_type = current_type;
-               }
-       }
-       new_nr = new_bios_entry;   /* retain count for new bios entries */
-       /* copy new bios mapping into original location */
-       memcpy(biosmap, new_bios, new_nr*sizeof(struct e820entry));
-       *pnr_map = new_nr;
-       return 0;
- }
- /*
-  * Copy the BIOS e820 map into a safe place.
-  *
-  * Sanity-check it while we're at it..
-  *
-  * 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.)
-  */
- int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
- {
-       /* Only one memory region (or negative)? Ignore it */
-       if (nr_map < 2)
-               return -1;
-       do {
-               unsigned long long start = biosmap->addr;
-               unsigned long long size = biosmap->size;
-               unsigned long long end = start + size;
-               unsigned long type = biosmap->type;
-               /* Overflow in 64 bits? Ignore the memory map. */
-               if (start > end)
-                       return -1;
-               /*
-                * Some BIOSes claim RAM in the 640k - 1M region.
-                * Not right. Fix it up.
-                */
-               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;
- }
  #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
  struct edd edd;
  #ifdef CONFIG_EDD_MODULE
@@@ -682,7 -159,7 +159,7 @@@ static inline void copy_edd(void
  }
  #endif
  
static int __initdata user_defined_memmap = 0;
+ int __initdata user_defined_memmap = 0;
  
  /*
   * "mem=nopentium" disables the 4MB page tables.
@@@ -719,51 -196,6 +196,6 @@@ static int __init parse_mem(char *arg
  }
  early_param("mem", parse_mem);
  
- static int __init parse_memmap(char *arg)
- {
-       if (!arg)
-               return -EINVAL;
-       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.
-                */
-               find_max_pfn();
-               saved_max_pfn = max_pfn;
- #endif
-               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);
  #ifdef CONFIG_PROC_VMCORE
  /* elfcorehdr= specifies the location of elf core header
   * stored by the crashed kernel.
@@@ -827,90 -259,6 +259,6 @@@ static int __init parse_reservetop(cha
  }
  early_param("reservetop", parse_reservetop);
  
- /*
-  * Callback for efi_memory_walk.
-  */
- static int __init
- efi_find_max_pfn(unsigned long start, unsigned long end, void *arg)
- {
-       unsigned long *max_pfn = arg, pfn;
-       if (start < end) {
-               pfn = PFN_UP(end -1);
-               if (pfn > *max_pfn)
-                       *max_pfn = pfn;
-       }
-       return 0;
- }
- static int __init
- efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg)
- {
-       memory_present(0, PFN_UP(start), PFN_DOWN(end));
-       return 0;
- }
-  /*
-   * This function checks if the entire range <start,end> is mapped with type.
-   *
-   * Note: this function only works correct if the e820 table is sorted and
-   * not-overlapping, which is the case
-   */
- int __init
- e820_all_mapped(unsigned long s, unsigned long e, unsigned type)
- {
-       u64 start = s;
-       u64 end = e;
-       int i;
-       for (i = 0; i < e820.nr_map; i++) {
-               struct e820entry *ei = &e820.map[i];
-               if (type && ei->type != type)
-                       continue;
-               /* is the region (part) in overlap with the current region ?*/
-               if (ei->addr >= end || ei->addr + ei->size <= start)
-                       continue;
-               /* if the region is at the beginning of <start,end> we move
-                * start to the end of the region since it's ok until there
-                */
-               if (ei->addr <= start)
-                       start = ei->addr + ei->size;
-               /* if start is now at or beyond end, we're done, full
-                * coverage */
-               if (start >= end)
-                       return 1; /* we're done */
-       }
-       return 0;
- }
- /*
-  * Find the highest page frame number we have available
-  */
- void __init find_max_pfn(void)
- {
-       int i;
-       max_pfn = 0;
-       if (efi_enabled) {
-               efi_memmap_walk(efi_find_max_pfn, &max_pfn);
-               efi_memmap_walk(efi_memory_present_wrapper, NULL);
-               return;
-       }
-       for (i = 0; i < e820.nr_map; i++) {
-               unsigned long start, end;
-               /* RAM? */
-               if (e820.map[i].type != E820_RAM)
-                       continue;
-               start = PFN_UP(e820.map[i].addr);
-               end = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
-               if (start >= end)
-                       continue;
-               if (end > max_pfn)
-                       max_pfn = end;
-               memory_present(0, start, end);
-       }
- }
  /*
   * Determine low and high memory ranges:
   */
@@@ -970,68 -318,6 +318,6 @@@ unsigned long __init find_max_low_pfn(v
        return max_low_pfn;
  }
  
- /*
-  * Free all available memory for boot time allocation.  Used
-  * as a callback function by efi_memory_walk()
-  */
- static int __init
- free_available_memory(unsigned long start, unsigned long end, void *arg)
- {
-       /* check max_low_pfn */
-       if (start >= (max_low_pfn << PAGE_SHIFT))
-               return 0;
-       if (end >= (max_low_pfn << PAGE_SHIFT))
-               end = max_low_pfn << PAGE_SHIFT;
-       if (start < end)
-               free_bootmem(start, end - start);
-       return 0;
- }
- /*
-  * Register fully available low RAM pages with the bootmem allocator.
-  */
- static void __init register_bootmem_low_pages(unsigned long max_low_pfn)
- {
-       int i;
-       if (efi_enabled) {
-               efi_memmap_walk(free_available_memory, NULL);
-               return;
-       }
-       for (i = 0; i < e820.nr_map; i++) {
-               unsigned long curr_pfn, last_pfn, size;
-               /*
-                * Reserve usable low memory
-                */
-               if (e820.map[i].type != E820_RAM)
-                       continue;
-               /*
-                * We are rounding up the start address of usable memory:
-                */
-               curr_pfn = PFN_UP(e820.map[i].addr);
-               if (curr_pfn >= max_low_pfn)
-                       continue;
-               /*
-                * ... and at the end of the usable range downwards:
-                */
-               last_pfn = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
-               if (last_pfn > max_low_pfn)
-                       last_pfn = max_low_pfn;
-               /*
-                * .. finally, did all the rounding and playing
-                * around just make the area go away?
-                */
-               if (last_pfn <= curr_pfn)
-                       continue;
-               size = last_pfn - curr_pfn;
-               free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
-       }
- }
  /*
   * workaround for Dell systems that neglect to reserve EBDA
   */
@@@ -1118,8 -404,8 +404,8 @@@ void __init setup_bootmem_allocator(voi
         * the (very unlikely) case of us accidentally initializing the
         * bootmem allocator with an invalid RAM area.
         */
-       reserve_bootmem(__PHYSICAL_START, (PFN_PHYS(min_low_pfn) +
-                        bootmap_size + PAGE_SIZE-1) - (__PHYSICAL_START));
+       reserve_bootmem(__pa_symbol(_text), (PFN_PHYS(min_low_pfn) +
+                        bootmap_size + PAGE_SIZE-1) - __pa_symbol(_text));
  
        /*
         * reserve physical page 0 - it's a special BIOS page on many boxes,
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
                        reserve_bootmem(INITRD_START, INITRD_SIZE);
 -                      initrd_start =
 -                              INITRD_START ? INITRD_START + PAGE_OFFSET : 0;
 +                      initrd_start = INITRD_START + PAGE_OFFSET;
                        initrd_end = initrd_start+INITRD_SIZE;
                }
                else {
@@@ -1199,126 -486,6 +485,6 @@@ void __init remapped_pgdat_init(void
        }
  }
  
- /*
-  * Request address space for all standard RAM and ROM resources
-  * and also for regions reported as reserved by the e820.
-  */
- static void __init
- legacy_init_iomem_resources(struct resource *code_resource, struct resource *data_resource)
- {
-       int i;
-       probe_roms();
-       for (i = 0; i < e820.nr_map; i++) {
-               struct resource *res;
- #ifndef CONFIG_RESOURCES_64BIT
-               if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
-                       continue;
- #endif
-               res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
-               switch (e820.map[i].type) {
-               case E820_RAM:  res->name = "System RAM"; break;
-               case E820_ACPI: res->name = "ACPI Tables"; break;
-               case E820_NVS:  res->name = "ACPI Non-volatile Storage"; break;
-               default:        res->name = "reserved";
-               }
-               res->start = e820.map[i].addr;
-               res->end = res->start + e820.map[i].size - 1;
-               res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-               if (request_resource(&iomem_resource, res)) {
-                       kfree(res);
-                       continue;
-               }
-               if (e820.map[i].type == E820_RAM) {
-                       /*
-                        *  We don't know which RAM region contains kernel data,
-                        *  so we try it repeatedly and let the resource manager
-                        *  test it.
-                        */
-                       request_resource(res, code_resource);
-                       request_resource(res, data_resource);
- #ifdef CONFIG_KEXEC
-                       request_resource(res, &crashk_res);
- #endif
-               }
-       }
- }
- /*
-  * Request address space for all standard resources
-  *
-  * This is called just before pcibios_init(), which is also a
-  * subsys_initcall, but is linked in later (in arch/i386/pci/common.c).
-  */
- static int __init request_standard_resources(void)
- {
-       int i;
-       printk("Setting up standard PCI resources\n");
-       if (efi_enabled)
-               efi_initialize_iomem_resources(&code_resource, &data_resource);
-       else
-               legacy_init_iomem_resources(&code_resource, &data_resource);
-       /* EFI systems may still have VGA */
-       request_resource(&iomem_resource, &video_ram_resource);
-       /* request I/O space for devices used on all i[345]86 PCs */
-       for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
-               request_resource(&ioport_resource, &standard_io_resources[i]);
-       return 0;
- }
- subsys_initcall(request_standard_resources);
- static void __init register_memory(void)
- {
-       unsigned long gapstart, gapsize, round;
-       unsigned long long last;
-       int i;
-       /*
-        * Search for the bigest gap in the low 32 bits of the e820
-        * memory space.
-        */
-       last = 0x100000000ull;
-       gapstart = 0x10000000;
-       gapsize = 0x400000;
-       i = e820.nr_map;
-       while (--i >= 0) {
-               unsigned long long start = e820.map[i].addr;
-               unsigned long long end = start + e820.map[i].size;
-               /*
-                * Since "last" is at most 4GB, we know we'll
-                * fit in 32 bits if this condition is true
-                */
-               if (last > end) {
-                       unsigned long gap = last - end;
-                       if (gap > gapsize) {
-                               gapsize = gap;
-                               gapstart = end;
-                       }
-               }
-               if (start < last)
-                       last = start;
-       }
-       /*
-        * See how much we want to round up: start off with
-        * rounding to the next 1MB area.
-        */
-       round = 0x100000;
-       while ((gapsize >> 4) > round)
-               round += round;
-       /* Fun with two's complement */
-       pci_mem_start = (gapstart + round) & -round;
-       printk("Allocating PCI resources starting at %08lx (gap: %08lx:%08lx)\n",
-               pci_mem_start, gapstart, gapsize);
- }
  #ifdef CONFIG_MCA
  static void set_mca_bus(int x)
  {
  static void set_mca_bus(int x) { }
  #endif
  
+ /* Overridden in paravirt.c if CONFIG_PARAVIRT */
+ char * __attribute__((weak)) memory_setup(void)
+ {
+       return machine_specific_memory_setup();
+ }
  /*
   * Determine if we were loaded by an EFI loader.  If so, then we have also been
   * passed the efi memmap, systab, etc., so we should use these data structures
@@@ -1380,7 -553,7 +552,7 @@@ void __init setup_arch(char **cmdline_p
                efi_init();
        else {
                printk(KERN_INFO "BIOS-provided physical RAM map:\n");
-               print_memory_map(machine_specific_memory_setup());
+               print_memory_map(memory_setup());
        }
  
        copy_edd();
diff --combined arch/i386/kernel/smp.c
index 9827cf927ecb2c49223d6bc856a15c48151a5e06,1b080ab8a49fad87d600b397d12748393d46ed6e..5285aff8367fec481d33a7ed94c0278815202286
@@@ -321,7 -321,6 +321,6 @@@ static inline void leave_mm (unsigned l
  
  fastcall void smp_invalidate_interrupt(struct pt_regs *regs)
  {
-       struct pt_regs *old_regs = set_irq_regs(regs);
        unsigned long cpu;
  
        cpu = get_cpu();
        smp_mb__after_clear_bit();
  out:
        put_cpu_no_resched();
-       set_irq_regs(old_regs);
  }
  
  static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
@@@ -607,14 -605,11 +605,11 @@@ void smp_send_stop(void
   */
  fastcall void smp_reschedule_interrupt(struct pt_regs *regs)
  {
-       struct pt_regs *old_regs = set_irq_regs(regs);
        ack_APIC_irq();
-       set_irq_regs(old_regs);
  }
  
  fastcall void smp_call_function_interrupt(struct pt_regs *regs)
  {
-       struct pt_regs *old_regs = set_irq_regs(regs);
        void (*func) (void *info) = call_data->func;
        void *info = call_data->info;
        int wait = call_data->wait;
                mb();
                atomic_inc(&call_data->finished);
        }
-       set_irq_regs(old_regs);
  }
  
  /*
@@@ -699,10 -693,6 +693,10 @@@ int smp_call_function_single(int cpu, v
                put_cpu();
                return -EBUSY;
        }
 +
 +      /* Can deadlock when called with interrupts disabled */
 +      WARN_ON(irqs_disabled());
 +
        spin_lock_bh(&call_lock);
        __smp_call_function_single(cpu, func, info, nonatomic, wait);
        spin_unlock_bh(&call_lock);
index 02a9b66b6ac38ae95aa199e8d91e7576d10daeba,b4e6f32de4539deb76e8878672f5f500625c8e24..4bf0e3c83b8b3244536eb54a02d4d087c0b15cab
   *            Dave Jones      :       Report invalid combinations of Athlon CPUs.
  *             Rusty Russell   :       Hacked into shape for new "hotplug" boot process. */
  
+ /* SMP boot always wants to use real time delay to allow sufficient time for
+  * the APs to come online */
+ #define USE_REAL_TIME_DELAY
  #include <linux/module.h>
  #include <linux/init.h>
  #include <linux/kernel.h>
@@@ -52,6 -57,8 +57,8 @@@
  #include <asm/desc.h>
  #include <asm/arch_hooks.h>
  #include <asm/nmi.h>
+ #include <asm/pda.h>
+ #include <asm/genapic.h>
  
  #include <mach_apic.h>
  #include <mach_wakecpu.h>
@@@ -536,11 -543,11 +543,11 @@@ set_cpu_sibling_map(int cpu
  static void __devinit start_secondary(void *unused)
  {
        /*
-        * Dont put anything before smp_callin(), SMP
+        * Don't put *anything* before secondary_cpu_init(), SMP
         * booting is too fragile that we want to limit the
         * things done here to the most necessary things.
         */
-       cpu_init();
+       secondary_cpu_init();
        preempt_disable();
        smp_callin();
        while (!cpu_isset(smp_processor_id(), smp_commenced_mask))
@@@ -599,13 -606,16 +606,16 @@@ void __devinit initialize_secondary(voi
                "movl %0,%%esp\n\t"
                "jmp *%1"
                :
-               :"r" (current->thread.esp),"r" (current->thread.eip));
+               :"m" (current->thread.esp),"m" (current->thread.eip));
  }
  
+ /* Static state in head.S used to set up a CPU */
  extern struct {
        void * esp;
        unsigned short ss;
  } stack_start;
+ extern struct i386_pda *start_pda;
+ extern struct Xgt_desc_struct cpu_gdt_descr;
  
  #ifdef CONFIG_NUMA
  
@@@ -936,9 -946,6 +946,6 @@@ static int __devinit do_boot_cpu(int ap
        unsigned long start_eip;
        unsigned short nmi_high = 0, nmi_low = 0;
  
-       ++cpucount;
-       alternatives_smp_switch(1);
        /*
         * We can't use kernel_thread since we must avoid to
         * reschedule the child.
        idle = alloc_idle_task(cpu);
        if (IS_ERR(idle))
                panic("failed fork for CPU %d", cpu);
+       /* Pre-allocate and initialize the CPU's GDT and PDA so it
+          doesn't have to do any memory allocation during the
+          delicate CPU-bringup phase. */
+       if (!init_gdt(cpu, idle)) {
+               printk(KERN_INFO "Couldn't allocate GDT/PDA for CPU %d\n", cpu);
+               return -1;      /* ? */
+       }
        idle->thread.eip = (unsigned long) start_secondary;
        /* start_eip had better be page-aligned! */
        start_eip = setup_trampoline();
  
+       ++cpucount;
+       alternatives_smp_switch(1);
        /* So we see what's up   */
        printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip);
        /* Stack for startup_32 can be just as for start_secondary onwards */
        stack_start.esp = (void *) idle->thread.esp;
  
+       start_pda = cpu_pda(cpu);
+       cpu_gdt_descr = per_cpu(cpu_gdt_descr, cpu);
        irq_ctx_init(cpu);
  
        x86_cpu_to_apicid[cpu] = apicid;
@@@ -1049,15 -1071,13 +1071,15 @@@ void cpu_exit_clear(void
  
  struct warm_boot_cpu_info {
        struct completion *complete;
 +      struct work_struct task;
        int apicid;
        int cpu;
  };
  
 -static void __cpuinit do_warm_boot_cpu(void *p)
 +static void __cpuinit do_warm_boot_cpu(struct work_struct *work)
  {
 -      struct warm_boot_cpu_info *info = p;
 +      struct warm_boot_cpu_info *info =
 +              container_of(work, struct warm_boot_cpu_info, task);
        do_boot_cpu(info->apicid, info->cpu);
        complete(info->complete);
  }
@@@ -1066,6 -1086,7 +1088,6 @@@ static int __cpuinit __smp_prepare_cpu(
  {
        DECLARE_COMPLETION_ONSTACK(done);
        struct warm_boot_cpu_info info;
 -      struct work_struct task;
        int     apicid, ret;
        struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
  
        info.complete = &done;
        info.apicid = apicid;
        info.cpu = cpu;
 -      INIT_WORK(&task, do_warm_boot_cpu, &info);
 +      INIT_WORK(&info.task, do_warm_boot_cpu);
  
        tsc_sync_disabled = 1;
  
        clone_pgd_range(swapper_pg_dir, swapper_pg_dir + USER_PGD_PTRS,
                        KERNEL_PGD_PTRS);
        flush_tlb_all();
 -      schedule_work(&task);
 +      schedule_work(&info.task);
        wait_for_completion(&done);
  
        tsc_sync_disabled = 0;
@@@ -1109,34 -1130,15 +1131,15 @@@ exit
  }
  #endif
  
- static void smp_tune_scheduling (void)
+ static void smp_tune_scheduling(void)
  {
        unsigned long cachesize;       /* kB   */
-       unsigned long bandwidth = 350; /* MB/s */
-       /*
-        * Rough estimation for SMP scheduling, this is the number of
-        * cycles it takes for a fully memory-limited process to flush
-        * the SMP-local cache.
-        *
-        * (For a P5 this pretty much means we will choose another idle
-        *  CPU almost always at wakeup time (this is due to the small
-        *  L1 cache), on PIIs it's around 50-100 usecs, depending on
-        *  the cache size)
-        */
  
-       if (!cpu_khz) {
-               /*
-                * this basically disables processor-affinity
-                * scheduling on SMP without a TSC.
-                */
-               return;
-       } else {
+       if (cpu_khz) {
                cachesize = boot_cpu_data.x86_cache_size;
-               if (cachesize == -1) {
-                       cachesize = 16; /* Pentiums, 2x8kB cache */
-                       bandwidth = 100;
-               }
-               max_cache_size = cachesize * 1024;
+               if (cachesize > 0)
+                       max_cache_size = cachesize * 1024;
        }
  }
  
@@@ -1462,6 -1464,12 +1465,12 @@@ int __devinit __cpu_up(unsigned int cpu
        cpu_set(cpu, smp_commenced_mask);
        while (!cpu_isset(cpu, cpu_online_map))
                cpu_relax();
+ #ifdef CONFIG_X86_GENERICARCH
+       if (num_online_cpus() > 8 && genapic == &apic_default)
+               panic("Default flat APIC routing can't be used with > 8 cpus\n");
+ #endif
        return 0;
  }
  
index 0bbacd0ec175c8d7ef4e3b7607398e27aa8cff7a,92849c7def5a7b061ebe409776ecc71c2875bdf8..7de9117b5a3ada15bf9e401afc9695e849bac8af
   * Should the kernel map a VDSO page into processes and pass its
   * address down to glibc upon exec()?
   */
+ #ifdef CONFIG_PARAVIRT
+ unsigned int __read_mostly vdso_enabled = 0;
+ #else
  unsigned int __read_mostly vdso_enabled = 1;
+ #endif
  
  EXPORT_SYMBOL_GPL(vdso_enabled);
  
@@@ -132,7 -136,7 +136,7 @@@ int arch_setup_additional_pages(struct 
                goto up_fail;
        }
  
 -      vma = kmem_cache_zalloc(vm_area_cachep, SLAB_KERNEL);
 +      vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
        if (!vma) {
                ret = -ENOMEM;
                goto up_fail;
diff --combined arch/i386/kernel/traps.c
index 3124f1b04d67c511768dbbbf2d14d05faf6ca28b,c447807e2a45dd5911942a12674246d72468297e..68de48e498ca910804e6d71bf2f61bc01caed126
@@@ -29,6 -29,7 +29,7 @@@
  #include <linux/kexec.h>
  #include <linux/unwind.h>
  #include <linux/uaccess.h>
+ #include <linux/nmi.h>
  
  #ifdef CONFIG_EISA
  #include <linux/ioport.h>
@@@ -61,9 -62,6 +62,6 @@@ int panic_on_unrecovered_nmi
  
  asmlinkage int system_call(void);
  
- struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
-               { 0, 0 }, { 0, 0 } };
  /* Do we ignore FPU interrupts ? */
  char ignore_fpu_irq = 0;
  
@@@ -94,7 -92,7 +92,7 @@@ asmlinkage void alignment_check(void)
  asmlinkage void spurious_interrupt_bug(void);
  asmlinkage void machine_check(void);
  
static int kstack_depth_to_print = 24;
+ int kstack_depth_to_print = 24;
  #ifdef CONFIG_STACK_UNWIND
  static int call_trace = 1;
  #else
@@@ -163,16 -161,25 +161,25 @@@ dump_trace_unwind(struct unwind_frame_i
  {
        struct ops_and_data *oad = (struct ops_and_data *)data;
        int n = 0;
+       unsigned long sp = UNW_SP(info);
  
+       if (arch_unw_user_mode(info))
+               return -1;
        while (unwind(info) == 0 && UNW_PC(info)) {
                n++;
                oad->ops->address(oad->data, UNW_PC(info));
                if (arch_unw_user_mode(info))
                        break;
+               if ((sp & ~(PAGE_SIZE - 1)) == (UNW_SP(info) & ~(PAGE_SIZE - 1))
+                   && sp > UNW_SP(info))
+                       break;
+               sp = UNW_SP(info);
        }
        return n;
  }
  
+ #define MSG(msg) ops->warning(data, msg)
  void dump_trace(struct task_struct *task, struct pt_regs *regs,
                unsigned long *stack,
                struct stacktrace_ops *ops, void *data)
                        if (unwind_init_frame_info(&info, task, regs) == 0)
                                unw_ret = dump_trace_unwind(&info, &oad);
                } else if (task == current)
-                       unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad);
+                       unw_ret = unwind_init_running(&info, dump_trace_unwind,
+                                                     &oad);
                else {
                        if (unwind_init_blocked(&info, task) == 0)
                                unw_ret = dump_trace_unwind(&info, &oad);
                }
                if (unw_ret > 0) {
                        if (call_trace == 1 && !arch_unw_user_mode(&info)) {
-                               ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n",
+                               ops->warning_symbol(data,
+                                            "DWARF2 unwinder stuck at %s",
                                             UNW_PC(&info));
                                if (UNW_SP(&info) >= PAGE_OFFSET) {
-                                       ops->warning(data, "Leftover inexact backtrace:\n");
+                                       MSG("Leftover inexact backtrace:");
                                        stack = (void *)UNW_SP(&info);
                                        if (!stack)
                                                return;
                                        ebp = UNW_FP(&info);
                                } else
-                                       ops->warning(data, "Full inexact backtrace again:\n");
+                                       MSG("Full inexact backtrace again:");
                        } else if (call_trace >= 1)
                                return;
                        else
-                               ops->warning(data, "Full inexact backtrace again:\n");
+                               MSG("Full inexact backtrace again:");
                } else
-                       ops->warning(data, "Inexact backtrace:\n");
+                       MSG("Inexact backtrace:");
        }
        if (!stack) {
                unsigned long dummy;
                stack = (unsigned long*)context->previous_esp;
                if (!stack)
                        break;
+               touch_nmi_watchdog();
        }
  }
  EXPORT_SYMBOL(dump_trace);
@@@ -379,7 -389,7 +389,7 @@@ void show_registers(struct pt_regs *reg
         * time of the fault..
         */
        if (in_kernel) {
-               u8 __user *eip;
+               u8 *eip;
                int code_bytes = 64;
                unsigned char c;
  
  
                printk(KERN_EMERG "Code: ");
  
-               eip = (u8 __user *)regs->eip - 43;
-               if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) {
+               eip = (u8 *)regs->eip - 43;
+               if (eip < (u8 *)PAGE_OFFSET ||
+                       probe_kernel_address(eip, c)) {
                        /* try starting at EIP */
-                       eip = (u8 __user *)regs->eip;
+                       eip = (u8 *)regs->eip;
                        code_bytes = 32;
                }
                for (i = 0; i < code_bytes; i++, eip++) {
-                       if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) {
+                       if (eip < (u8 *)PAGE_OFFSET ||
+                               probe_kernel_address(eip, c)) {
                                printk(" Bad EIP value.");
                                break;
                        }
-                       if (eip == (u8 __user *)regs->eip)
+                       if (eip == (u8 *)regs->eip)
                                printk("<%02x> ", c);
                        else
                                printk("%02x ", c);
@@@ -415,7 -427,7 +427,7 @@@ static void handle_BUG(struct pt_regs *
  
        if (eip < PAGE_OFFSET)
                return;
-       if (probe_kernel_address((unsigned short __user *)eip, ud2))
+       if (probe_kernel_address((unsigned short *)eip, ud2))
                return;
        if (ud2 != 0x0b0f)
                return;
                char *file;
                char c;
  
-               if (probe_kernel_address((unsigned short __user *)(eip + 2),
-                                       line))
+               if (probe_kernel_address((unsigned short *)(eip + 2), line))
                        break;
-               if (__get_user(file, (char * __user *)(eip + 4)) ||
-                   (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
+               if (probe_kernel_address((char **)(eip + 4), file) ||
+                   (unsigned long)file < PAGE_OFFSET ||
+                       probe_kernel_address(file, c))
                        file = "<bad filename>";
  
                printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
@@@ -452,7 -464,7 +464,7 @@@ void die(const char * str, struct pt_re
                u32 lock_owner;
                int lock_owner_depth;
        } die = {
 -              .lock =                 SPIN_LOCK_UNLOCKED,
 +              .lock =                 __SPIN_LOCK_UNLOCKED(die.lock),
                .lock_owner =           -1,
                .lock_owner_depth =     0
        };
@@@ -707,8 -719,7 +719,7 @@@ mem_parity_error(unsigned char reason, 
  {
        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");
+       printk(KERN_EMERG "You have some hardware problem, likely on the PCI bus.\n");
        if (panic_on_unrecovered_nmi)
                  panic("NMI: Not continuing");
  
@@@ -773,7 -784,6 +784,6 @@@ void __kprobes die_nmi(struct pt_regs *
        printk(" on CPU%d, eip %08lx, registers:\n",
                smp_processor_id(), regs->eip);
        show_registers(regs);
-       printk(KERN_EMERG "console shuts up ...\n");
        console_silent();
        spin_unlock(&nmi_print_lock);
        bust_spinlocks(0);
@@@ -1088,49 -1098,24 +1098,24 @@@ fastcall void do_spurious_interrupt_bug
  #endif
  }
  
- fastcall void setup_x86_bogus_stack(unsigned char * stk)
- {
-       unsigned long *switch16_ptr, *switch32_ptr;
-       struct pt_regs *regs;
-       unsigned long stack_top, stack_bot;
-       unsigned short iret_frame16_off;
-       int cpu = smp_processor_id();
-       /* reserve the space on 32bit stack for the magic switch16 pointer */
-       memmove(stk, stk + 8, sizeof(struct pt_regs));
-       switch16_ptr = (unsigned long *)(stk + sizeof(struct pt_regs));
-       regs = (struct pt_regs *)stk;
-       /* now the switch32 on 16bit stack */
-       stack_bot = (unsigned long)&per_cpu(cpu_16bit_stack, cpu);
-       stack_top = stack_bot + CPU_16BIT_STACK_SIZE;
-       switch32_ptr = (unsigned long *)(stack_top - 8);
-       iret_frame16_off = CPU_16BIT_STACK_SIZE - 8 - 20;
-       /* copy iret frame on 16bit stack */
-       memcpy((void *)(stack_bot + iret_frame16_off), &regs->eip, 20);
-       /* fill in the switch pointers */
-       switch16_ptr[0] = (regs->esp & 0xffff0000) | iret_frame16_off;
-       switch16_ptr[1] = __ESPFIX_SS;
-       switch32_ptr[0] = (unsigned long)stk + sizeof(struct pt_regs) +
-               8 - CPU_16BIT_STACK_SIZE;
-       switch32_ptr[1] = __KERNEL_DS;
- }
- fastcall unsigned char * fixup_x86_bogus_stack(unsigned short sp)
+ fastcall unsigned long patch_espfix_desc(unsigned long uesp,
+                                         unsigned long kesp)
  {
-       unsigned long *switch32_ptr;
-       unsigned char *stack16, *stack32;
-       unsigned long stack_top, stack_bot;
-       int len;
        int cpu = smp_processor_id();
-       stack_bot = (unsigned long)&per_cpu(cpu_16bit_stack, cpu);
-       stack_top = stack_bot + CPU_16BIT_STACK_SIZE;
-       switch32_ptr = (unsigned long *)(stack_top - 8);
-       /* copy the data from 16bit stack to 32bit stack */
-       len = CPU_16BIT_STACK_SIZE - 8 - sp;
-       stack16 = (unsigned char *)(stack_bot + sp);
-       stack32 = (unsigned char *)
-               (switch32_ptr[0] + CPU_16BIT_STACK_SIZE - 8 - len);
-       memcpy(stack32, stack16, len);
-       return stack32;
+       struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
+       struct desc_struct *gdt = (struct desc_struct *)cpu_gdt_descr->address;
+       unsigned long base = (kesp - uesp) & -THREAD_SIZE;
+       unsigned long new_kesp = kesp - base;
+       unsigned long lim_pages = (new_kesp | (THREAD_SIZE - 1)) >> PAGE_SHIFT;
+       __u64 desc = *(__u64 *)&gdt[GDT_ENTRY_ESPFIX_SS];
+       /* Set up base for espfix segment */
+       desc &= 0x00f0ff0000000000ULL;
+       desc |= ((((__u64)base) << 16) & 0x000000ffffff0000ULL) |
+               ((((__u64)base) << 32) & 0xff00000000000000ULL) |
+               ((((__u64)lim_pages) << 32) & 0x000f000000000000ULL) |
+               (lim_pages & 0xffff);
+       *(__u64 *)&gdt[GDT_ENTRY_ESPFIX_SS] = desc;
+       return new_kesp;
  }
  
  /*
   * Must be called with kernel preemption disabled (in this case,
   * local interrupts are disabled at the call-site in entry.S).
   */
- asmlinkage void math_state_restore(struct pt_regs regs)
+ asmlinkage void math_state_restore(void)
  {
        struct thread_info *thread = current_thread_info();
        struct task_struct *tsk = thread->task;
                init_fpu(tsk);
        restore_fpu(tsk);
        thread->status |= TS_USEDFPU;   /* So we fnsave on switch_to() */
+       tsk->fpu_counter++;
  }
  
  #ifndef CONFIG_MATH_EMULATION
diff --combined arch/i386/kernel/tsc.c
index 9810c8c9075060bb5bb54d2c4e6657214ccb44a9,7f22e03253e27916981da850e69d8d01788afbeb..1bbe45dca7a0ec626a3b2963d9031e579811d195
@@@ -13,7 -13,6 +13,6 @@@
  
  #include <asm/delay.h>
  #include <asm/tsc.h>
- #include <asm/delay.h>
  #include <asm/io.h>
  
  #include "mach_timer.h"
@@@ -217,7 -216,7 +216,7 @@@ static unsigned int cpufreq_delayed_iss
  static unsigned int cpufreq_init = 0;
  static struct work_struct cpufreq_delayed_get_work;
  
 -static void handle_cpufreq_delayed_get(void *v)
 +static void handle_cpufreq_delayed_get(struct work_struct *work)
  {
        unsigned int cpu;
  
@@@ -306,7 -305,7 +305,7 @@@ static int __init cpufreq_tsc(void
  {
        int ret;
  
 -      INIT_WORK(&cpufreq_delayed_get_work, handle_cpufreq_delayed_get, NULL);
 +      INIT_WORK(&cpufreq_delayed_get_work, handle_cpufreq_delayed_get);
        ret = cpufreq_register_notifier(&time_cpufreq_notifier_block,
                                        CPUFREQ_TRANSITION_NOTIFIER);
        if (!ret)
diff --combined arch/i386/mm/init.c
index a6a8e397dd88ab28b18e63f8b69399e9525d7a9b,f4dd048187ff7534080216ed6857915450c8dcf7..84697dfc7348b93c6be087584b8653a0e6fd427b
@@@ -192,8 -192,6 +192,6 @@@ static inline int page_kills_ppro(unsig
        return 0;
  }
  
- extern int is_available_memory(efi_memory_desc_t *);
  int page_is_ram(unsigned long pagenr)
  {
        int i;
@@@ -699,8 -697,8 +697,8 @@@ int remove_memory(u64 start, u64 size
  #endif
  #endif
  
 -kmem_cache_t *pgd_cache;
 -kmem_cache_t *pmd_cache;
 +struct kmem_cache *pgd_cache;
 +struct kmem_cache *pmd_cache;
  
  void __init pgtable_cache_init(void)
  {
diff --combined arch/i386/mm/pgtable.c
index 33be236fc6afa14c71b1f088e20663cdd9356050,65b5c0959033d44324d1cda1c10a60f2818c8329..f349eaf450b0db542c5c3e56c3b598da94562a66
@@@ -95,8 -95,11 +95,11 @@@ static void set_pte_pfn(unsigned long v
                return;
        }
        pte = pte_offset_kernel(pmd, vaddr);
-       /* <pfn,flags> stored as-is, to permit clearing entries */
-       set_pte(pte, pfn_pte(pfn, flags));
+       if (pgprot_val(flags))
+               /* <pfn,flags> stored as-is, to permit clearing entries */
+               set_pte(pte, pfn_pte(pfn, flags));
+       else
+               pte_clear(&init_mm, vaddr, pte);
  
        /*
         * It's enough to flush this one mapping.
@@@ -193,7 -196,7 +196,7 @@@ struct page *pte_alloc_one(struct mm_st
        return pte;
  }
  
 -void pmd_ctor(void *pmd, kmem_cache_t *cache, unsigned long flags)
 +void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags)
  {
        memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
  }
@@@ -233,7 -236,7 +236,7 @@@ static inline void pgd_list_del(pgd_t *
                set_page_private(next, (unsigned long)pprev);
  }
  
 -void pgd_ctor(void *pgd, kmem_cache_t *cache, unsigned long unused)
 +void pgd_ctor(void *pgd, struct kmem_cache *cache, unsigned long unused)
  {
        unsigned long flags;
  
  }
  
  /* never called when PTRS_PER_PMD > 1 */
 -void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused)
 +void pgd_dtor(void *pgd, struct kmem_cache *cache, unsigned long unused)
  {
        unsigned long flags; /* can be called from interrupt context */
  
diff --combined arch/x86_64/kernel/mce.c
index bc863c464a1fbf91f5bb7fdd71d0fa02eedbb879,a7440cb9c14fe20d9aa7c329cdd6d0c6801f1689..ac085038af2924aab65b5eb82c77fdc26d5430d6
@@@ -306,8 -306,8 +306,8 @@@ void mce_log_therm_throt_event(unsigne
   */
  
  static int check_interval = 5 * 60; /* 5 minutes */
 -static void mcheck_timer(void *data);
 -static DECLARE_WORK(mcheck_work, mcheck_timer, NULL);
 +static void mcheck_timer(struct work_struct *work);
 +static DECLARE_DELAYED_WORK(mcheck_work, mcheck_timer);
  
  static void mcheck_check_cpu(void *info)
  {
                do_machine_check(NULL, 0);
  }
  
 -static void mcheck_timer(void *data)
 +static void mcheck_timer(struct work_struct *work)
  {
        on_each_cpu(mcheck_check_cpu, NULL, 1, 1);
        schedule_delayed_work(&mcheck_work, check_interval * HZ);
@@@ -641,6 -641,7 +641,6 @@@ static __cpuinit int mce_create_device(
        return err;
  }
  
 -#ifdef CONFIG_HOTPLUG_CPU
  static void mce_remove_device(unsigned int cpu)
  {
        int i;
        sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant);
        sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
        sysdev_unregister(&per_cpu(device_mce,cpu));
+       memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
  }
  
  /* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@@ -673,6 -675,7 +674,6 @@@ mce_cpu_callback(struct notifier_block 
  static struct notifier_block mce_cpu_notifier = {
        .notifier_call = mce_cpu_callback,
  };
 -#endif
  
  static __init int mce_init_device(void)
  {
index f12f266f3e98e286758662e400bfbbdc98417040,6595a4ebe7f164430ee5d9d449b5ba6ba6bc0d77..af425a8049fb5620596a0bc61bf005d399df3e32
@@@ -471,7 -471,8 +471,7 @@@ void __init setup_arch(char **cmdline_p
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) {
                        reserve_bootmem_generic(INITRD_START, INITRD_SIZE);
 -                      initrd_start =
 -                              INITRD_START ? INITRD_START + PAGE_OFFSET : 0;
 +                      initrd_start = INITRD_START + PAGE_OFFSET;
                        initrd_end = initrd_start+INITRD_SIZE;
                }
                else {
@@@ -731,11 -732,8 +731,8 @@@ static void __cpuinit init_amd(struct c
        /* 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);
+       /* RDTSC can be speculated around */
+       clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
  }
  
  static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
@@@ -834,6 -832,15 +831,15 @@@ static void __cpuinit init_intel(struc
                        set_bit(X86_FEATURE_ARCH_PERFMON, &c->x86_capability);
        }
  
+       if (cpu_has_ds) {
+               unsigned int l1, l2;
+               rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
+               if (!(l1 & (1<<11)))
+                       set_bit(X86_FEATURE_BTS, c->x86_capability);
+               if (!(l1 & (1<<12)))
+                       set_bit(X86_FEATURE_PEBS, c->x86_capability);
+       }
        n = c->extended_cpuid_level;
        if (n >= 0x80000008) {
                unsigned eax = cpuid_eax(0x80000008);
                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);
+       if (c->x86 == 15)
+               set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
+       else
+               clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
        c->x86_max_cores = intel_num_cpu_cores(c);
  
        srat_detect_node();
diff --combined arch/x86_64/kernel/smp.c
index 32f4d7e2a0608119467058968bae73bf0bd7ee4f,1bf0e094f43939175f0dd2b4146fdb44581cd509..af1ec4d23cf89131f16e5063f31c81a6810c63ba
@@@ -379,16 -379,13 +379,17 @@@ int smp_call_function_single (int cpu, 
                put_cpu();
                return 0;
        }
 +
 +      /* Can deadlock when called with interrupts disabled */
 +      WARN_ON(irqs_disabled());
 +
        spin_lock_bh(&call_lock);
        __smp_call_function_single(cpu, func, info, nonatomic, wait);
        spin_unlock_bh(&call_lock);
        put_cpu();
        return 0;
  }
+ EXPORT_SYMBOL(smp_call_function_single);
  
  /*
   * this function sends a 'generic call function' IPI to all other CPUs
index 9800147c4c68e86fa9fefa848c4d7e73cdfb59e5,4c161c208d5bfec288b96ef02e48923a2ee45316..daf19332f0dd02ed7ab4257e5c887989dfeb0ef8
@@@ -60,6 -60,7 +60,7 @@@
  #include <asm/irq.h>
  #include <asm/hw_irq.h>
  #include <asm/numa.h>
+ #include <asm/genapic.h>
  
  /* Number of siblings per CPU package */
  int smp_num_siblings = 1;
@@@ -753,16 -754,14 +754,16 @@@ static int __cpuinit wakeup_secondary_v
  }
  
  struct create_idle {
 +      struct work_struct work;
        struct task_struct *idle;
        struct completion done;
        int cpu;
  };
  
 -void do_fork_idle(void *_c_idle)
 +void do_fork_idle(struct work_struct *work)
  {
 -      struct create_idle *c_idle = _c_idle;
 +      struct create_idle *c_idle =
 +              container_of(work, struct create_idle, work);
  
        c_idle->idle = fork_idle(c_idle->cpu);
        complete(&c_idle->done);
@@@ -777,10 -776,10 +778,10 @@@ static int __cpuinit do_boot_cpu(int cp
        int timeout;
        unsigned long start_rip;
        struct create_idle c_idle = {
 +              .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle),
                .cpu = cpu,
                .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
        };
 -      DECLARE_WORK(work, do_fork_idle, &c_idle);
  
        /* allocate memory for gdts of secondary cpus. Hotplug is considered */
        if (!cpu_gdt_descr[cpu].address &&
         * thread.
         */
        if (!keventd_up() || current_is_keventd())
 -              work.func(work.data);
 +              c_idle.work.func(&c_idle.work);
        else {
 -              schedule_work(&work);
 +              schedule_work(&c_idle.work);
                wait_for_completion(&c_idle.done);
        }
  
@@@ -1169,6 -1168,13 +1170,13 @@@ int __cpuinit __cpu_up(unsigned int cpu
  
        while (!cpu_isset(cpu, cpu_online_map))
                cpu_relax();
+       if (num_online_cpus() > 8 && genapic == &apic_flat) {
+               printk(KERN_WARNING
+                      "flat APIC routing can't be used with > 8 cpus\n");
+               BUG();
+       }
        err = 0;
  
        return err;
index 3785e4954734d2f4a3fdee3734d253b96450ccc7,c3de9a09cd9fe6eca120cec758859dc082e6ca7f..4a673f5397a05fbbf5aec90b5067bbafcd8e1ad5
@@@ -42,7 -42,6 +42,7 @@@
  #include <asm/topology.h>
  
  #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
 +#define __syscall_clobber "r11","rcx","memory"
  
  int __sysctl_vsyscall __section_sysctl_vsyscall = 1;
  seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED;
@@@ -275,6 -274,7 +275,6 @@@ static void __cpuinit cpu_vsyscall_init
        vsyscall_set_cpu(raw_smp_processor_id());
  }
  
 -#ifdef CONFIG_HOTPLUG_CPU
  static int __cpuinit
  cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
  {
                smp_call_function_single(cpu, cpu_vsyscall_init, NULL, 0, 1);
        return NOTIFY_DONE;
  }
 -#endif
  
  static void __init map_vsyscall(void)
  {
        extern char __vsyscall_0;
        unsigned long physaddr_page0 = __pa_symbol(&__vsyscall_0);
  
+       /* Note that VSYSCALL_MAPPED_PAGES must agree with the code below. */
        __set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_page0, PAGE_KERNEL_VSYSCALL);
  }
  
index 81186f479a3fffd20b4d9adb1faffe71a976b1ac,80066ad792f7b3166b3e9a2fff3542a4ee4bbba5..33adeba1a31f1c87930e1266989a44b36b9f775e
@@@ -61,7 -61,6 +61,7 @@@
  #include <linux/dmi.h>
  #include <linux/delay.h>
  #include <linux/acpi.h>
 +#include <linux/freezer.h>
  
  #include <asm/page.h>
  #include <asm/desc.h>
@@@ -531,7 -530,8 +531,8 @@@ static int __init pnpbios_init(void
        if (check_legacy_ioport(PNPBIOS_BASE))
                return -ENODEV;
  #endif
-       if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table)) {
+       if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table) ||
+           paravirt_enabled()) {
                printk(KERN_INFO "PnPBIOS: Disabled\n");
                return -ENODEV;
        }
diff --combined fs/compat_ioctl.c
index 6e31776855564450b2980f4cc7d0bf9fd4a3cca4,47bb78d1c3fb7a908b727d8e553fbea3e934cea0..bcc3caf5d8209651de43e34fd95f3297bc59202b
@@@ -211,10 -211,8 +211,10 @@@ static int do_video_stillpicture(unsign
        up_native =
                compat_alloc_user_space(sizeof(struct video_still_picture));
  
 -      put_user(compat_ptr(fp), &up_native->iFrame);
 -      put_user(size, &up_native->size);
 +      err =  put_user(compat_ptr(fp), &up_native->iFrame);
 +      err |= put_user(size, &up_native->size);
 +      if (err)
 +              return -EFAULT;
  
        err = sys_ioctl(fd, cmd, (unsigned long) up_native);
  
@@@ -238,10 -236,8 +238,10 @@@ static int do_video_set_spu_palette(uns
        err |= get_user(length, &up->length);
  
        up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
 -      put_user(compat_ptr(palp), &up_native->palette);
 -      put_user(length, &up_native->length);
 +      err  = put_user(compat_ptr(palp), &up_native->palette);
 +      err |= put_user(length, &up_native->length);
 +      if (err)
 +              return -EFAULT;
  
        err = sys_ioctl(fd, cmd, (unsigned long) up_native);
  
@@@ -2047,19 -2043,16 +2047,19 @@@ static int serial_struct_ioctl(unsigne
          struct serial_struct ss;
          mm_segment_t oldseg = get_fs();
          __u32 udata;
 +      unsigned int base;
  
          if (cmd == TIOCSSERIAL) {
                  if (!access_ok(VERIFY_READ, ss32, sizeof(SS32)))
                          return -EFAULT;
                  if (__copy_from_user(&ss, ss32, offsetof(SS32, iomem_base)))
                        return -EFAULT;
 -                __get_user(udata, &ss32->iomem_base);
 +                if (__get_user(udata, &ss32->iomem_base))
 +                      return -EFAULT;
                  ss.iomem_base = compat_ptr(udata);
 -                __get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
 -                __get_user(ss.port_high, &ss32->port_high);
 +                if (__get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift) ||
 +                  __get_user(ss.port_high, &ss32->port_high))
 +                      return -EFAULT;
                  ss.iomap_base = 0UL;
          }
          set_fs(KERNEL_DS);
                          return -EFAULT;
                  if (__copy_to_user(ss32,&ss,offsetof(SS32,iomem_base)))
                        return -EFAULT;
 -                __put_user((unsigned long)ss.iomem_base  >> 32 ?
 -                            0xffffffff : (unsigned)(unsigned long)ss.iomem_base,
 -                            &ss32->iomem_base);
 -                __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
 -                __put_user(ss.port_high, &ss32->port_high);
 -
 +              base = (unsigned long)ss.iomem_base  >> 32 ?
 +                      0xffffffff : (unsigned)(unsigned long)ss.iomem_base;
 +              if (__put_user(base, &ss32->iomem_base) ||
 +                  __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift) ||
 +                  __put_user(ss.port_high, &ss32->port_high))
 +                      return -EFAULT;
          }
          return err;
  }
@@@ -2404,6 -2397,7 +2404,7 @@@ HANDLE_IOCTL(SIOCGIFMAP, dev_ifsioc
  HANDLE_IOCTL(SIOCSIFMAP, dev_ifsioc)
  HANDLE_IOCTL(SIOCGIFADDR, dev_ifsioc)
  HANDLE_IOCTL(SIOCSIFADDR, dev_ifsioc)
+ HANDLE_IOCTL(SIOCSIFHWBROADCAST, dev_ifsioc)
  
  /* ioctls used by appletalk ddp.c */
  HANDLE_IOCTL(SIOCATALKDIFADDR, dev_ifsioc)
index a6c024e2506f8126195c337b8ff8bc4759cb8e2c,6aab7a105fad1e34bb7f92a65170ba3c1d02b91d..c57441bb290502c449e4217684711a3b11c34a3f
@@@ -14,7 -14,7 +14,7 @@@
   * on us. We need to use _exactly_ the address the user gave us,
   * not some alias that contains the same information.
   */
 -typedef struct { volatile int counter; } atomic_t;
 +typedef struct { int counter; } atomic_t;
  
  #define ATOMIC_INIT(i)        { (i) }
  
@@@ -187,9 -187,9 +187,9 @@@ static __inline__ int atomic_add_return
        /* Modern 486+ processor */
        __i = i;
        __asm__ __volatile__(
-               LOCK_PREFIX "xaddl %0, %1;"
-               :"=r"(i)
-               :"m"(v->counter), "0"(i));
+               LOCK_PREFIX "xaddl %0, %1"
+               :"+r" (i), "+m" (v->counter)
+               : : "memory");
        return i + __i;
  
  #ifdef CONFIG_M386
index bfee7ddfff535216aa7c37adfe8afb836a888af0,b4a301f647baead84edc85d25d08b56d53e8beed..e6a4723f0eb1f088affdc67cd42a8f5d7c02ce21
@@@ -15,6 -15,7 +15,7 @@@
  #include <asm/processor.h>
  #include <asm/fixmap.h>
  #include <linux/threads.h>
+ #include <asm/paravirt.h>
  
  #ifndef _I386_BITOPS_H
  #include <asm/bitops.h>
@@@ -34,14 -35,14 +35,14 @@@ struct vm_area_struct
  #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
  extern unsigned long empty_zero_page[1024];
  extern pgd_t swapper_pg_dir[1024];
 -extern kmem_cache_t *pgd_cache;
 -extern kmem_cache_t *pmd_cache;
 +extern struct kmem_cache *pgd_cache;
 +extern struct kmem_cache *pmd_cache;
  extern spinlock_t pgd_lock;
  extern struct page *pgd_list;
  
 -void pmd_ctor(void *, kmem_cache_t *, unsigned long);
 -void pgd_ctor(void *, kmem_cache_t *, unsigned long);
 -void pgd_dtor(void *, kmem_cache_t *, unsigned long);
 +void pmd_ctor(void *, struct kmem_cache *, unsigned long);
 +void pgd_ctor(void *, struct kmem_cache *, unsigned long);
 +void pgd_dtor(void *, struct kmem_cache *, unsigned long);
  void pgtable_cache_init(void);
  void paging_init(void);
  
@@@ -246,6 -247,7 +247,7 @@@ static inline pte_t pte_mkhuge(pte_t pt
  # include <asm/pgtable-2level.h>
  #endif
  
+ #ifndef CONFIG_PARAVIRT
  /*
   * Rules for using pte_update - it must be called after any PTE update which
   * has not been done using the set_pte / clear_pte interfaces.  It is used by
   */
  #define pte_update(mm, addr, ptep)            do { } while (0)
  #define pte_update_defer(mm, addr, ptep)      do { } while (0)
+ #endif
  
  /*
   * We only update the dirty/accessed state if we set
  do {                                                                  \
        if (dirty) {                                                    \
                (ptep)->pte_low = (entry).pte_low;                      \
-               pte_update_defer((vma)->vm_mm, (addr), (ptep));         \
+               pte_update_defer((vma)->vm_mm, (address), (ptep));      \
                flush_tlb_page(vma, address);                           \
        }                                                               \
  } while (0)
@@@ -305,7 -307,7 +307,7 @@@ do {                                                                       
        __dirty = pte_dirty(*(ptep));                                   \
        if (__dirty) {                                                  \
                clear_bit(_PAGE_BIT_DIRTY, &(ptep)->pte_low);           \
-               pte_update_defer((vma)->vm_mm, (addr), (ptep));         \
+               pte_update_defer((vma)->vm_mm, (address), (ptep));      \
                flush_tlb_page(vma, address);                           \
        }                                                               \
        __dirty;                                                        \
        __young = pte_young(*(ptep));                                   \
        if (__young) {                                                  \
                clear_bit(_PAGE_BIT_ACCESSED, &(ptep)->pte_low);        \
-               pte_update_defer((vma)->vm_mm, (addr), (ptep));         \
+               pte_update_defer((vma)->vm_mm, (address), (ptep));      \
                flush_tlb_page(vma, address);                           \
        }                                                               \
        __young;                                                        \
  })
  
+ #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
+ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+ {
+       pte_t pte = raw_ptep_get_and_clear(ptep);
+       pte_update(mm, addr, ptep);
+       return pte;
+ }
  #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)
  {
diff --combined include/asm-i386/setup.h
index c5b504bfbaadc4609a030a41705a2d6fe98aaa71,9930c5a355fc1261d7e38d0ebeda296b8289b6a8..67659dbaf120a8dd4ec816bcde1734736fd20026
@@@ -6,8 -6,6 +6,8 @@@
  #ifndef _i386_SETUP_H
  #define _i386_SETUP_H
  
 +#define COMMAND_LINE_SIZE 256
 +
  #ifdef __KERNEL__
  #include <linux/pfn.h>
  
   */
  #define MAXMEM_PFN    PFN_DOWN(MAXMEM)
  #define MAX_NONPAE_PFN        (1 << 20)
 -#endif
  
  #define PARAM_SIZE 4096
 -#define COMMAND_LINE_SIZE 256
  
  #define OLD_CL_MAGIC_ADDR     0x90020
  #define OLD_CL_MAGIC          0xA33F
@@@ -70,6 -70,7 +70,7 @@@ extern unsigned char boot_params[PARAM_
  struct e820entry;
  
  char * __init machine_specific_memory_setup(void);
+ char *memory_setup(void);
  
  int __init copy_e820_map(struct e820entry * biosmap, int nr_map);
  int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
@@@ -78,6 -79,4 +79,6 @@@ void __init add_memory_region(unsigned 
  
  #endif /* __ASSEMBLY__ */
  
 +#endif  /*  __KERNEL__  */
 +
  #endif /* _i386_SETUP_H */
index c1da5caafaf753a96ce01e6fbf91ad5f9081b71f,30361526d568db1f2d19ba1ba8decf9e7e843837..8dbaafe611ffc744b426d944bb893c54445f2e32
@@@ -6,18 -6,25 +6,14 @@@
  #include <asm/desc.h>
  #include <asm/i387.h>
  
 -static inline int
 -arch_prepare_suspend(void)
 -{
 -      /* If you want to make non-PSE machine work, turn off paging
 -           in swsusp_arch_suspend. swsusp_pg_dir should have identity mapping, so
 -           it could work...  */
 -      if (!cpu_has_pse) {
 -              printk(KERN_ERR "PSE is required for swsusp.\n");
 -              return -EPERM;
 -      }
 -      return 0;
 -}
 +static inline int arch_prepare_suspend(void) { return 0; }
  
  /* image of the saved processor state */
  struct saved_context {
        u16 es, fs, gs, ss;
        unsigned long cr0, cr2, cr3, cr4;
-       u16 gdt_pad;
-       u16 gdt_limit;
-       unsigned long gdt_base;
-       u16 idt_pad;
-       u16 idt_limit;
-       unsigned long idt_base;
+       struct Xgt_desc_struct gdt;
+       struct Xgt_desc_struct idt;
        u16 ldt;
        u16 tss;
        unsigned long tr;
index 763521358fb851c32365e00cf41c10df090dafdb,6c455b4068c05149d926aa4336d52d2303033deb..ebd7117782a67f1dfe4995a3165a947ce80bc7b7
@@@ -6,12 -6,12 +6,11 @@@ ALTARCHDEF := defined __i386_
  
  header-y += boot.h
  header-y += bootsetup.h
- header-y += cpufeature.h
  header-y += debugreg.h
  header-y += ldt.h
  header-y += msr.h
  header-y += prctl.h
  header-y += ptrace-abi.h
 -header-y += setup.h
  header-y += sigcontext32.h
  header-y += ucontext.h
  header-y += vsyscall32.h
index 93849f7abc2480fe8f730f129ba00970d71fac2c,626d3715fbb50ae64e41ee7535d10053750e4928..706ca4b60000ec2091efa2a45e096a4f5fef0c5e
@@@ -21,7 -21,7 +21,7 @@@
   * on us. We need to use _exactly_ the address the user gave us,
   * not some alias that contains the same information.
   */
 -typedef struct { volatile int counter; } atomic_t;
 +typedef struct { int counter; } atomic_t;
  
  #define ATOMIC_INIT(i)        { (i) }
  
@@@ -189,9 -189,9 +189,9 @@@ static __inline__ int atomic_add_return
  {
        int __i = i;
        __asm__ __volatile__(
-               LOCK_PREFIX "xaddl %0, %1;"
-               :"=r"(i)
-               :"m"(v->counter), "0"(i));
+               LOCK_PREFIX "xaddl %0, %1"
+               :"+r" (i), "+m" (v->counter)
+               : : "memory");
        return i + __i;
  }
  
diff --combined include/asm-x86_64/smp.h
index f1bdd500d7ac1de84992c19166c149d5743e7cda,7ae7e7d89d164d0145284bd2ac8813b2ad5835b2..e17b9ec42e98d105d61d373ce47a828f8e6eaabc
@@@ -82,11 -82,6 +82,6 @@@ extern u8 x86_cpu_to_apicid[NR_CPUS];        /
  extern u8 x86_cpu_to_log_apicid[NR_CPUS];
  extern u8 bios_cpu_apicid[];
  
- static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
- {
-       return cpus_addr(cpumask)[0];
- }
  static inline int cpu_present_to_apicid(int mps_cpu)
  {
        if (mps_cpu < NR_CPUS)
@@@ -118,6 -113,13 +113,6 @@@ static __inline int logical_smp_process
  #define cpu_physical_id(cpu)          x86_cpu_to_apicid[cpu]
  #else
  #define cpu_physical_id(cpu)          boot_cpu_id
 -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/cpu.h
index bf00ce6ecadfe076199355f00d992e65423ceb2e,ad90340e7dba042c8c937b37e832961756fab048..bfb520212d7109eafb9811d9df5f827dc0a9b5f6
  #include <linux/compiler.h>
  #include <linux/cpumask.h>
  #include <asm/semaphore.h>
 +#include <linux/mutex.h>
  
  struct cpu {
        int node_id;            /* The node which contains the CPU */
-       int no_control;         /* Should the sysfs control file be created? */
+       int hotpluggable;       /* creates sysfs control file if hotpluggable */
        struct sys_device sysdev;
  };
  
@@@ -75,17 -74,6 +75,17 @@@ extern struct sysdev_class cpu_sysdev_c
  
  #ifdef CONFIG_HOTPLUG_CPU
  /* Stop CPUs going up and down. */
 +
 +static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
 +{
 +      mutex_lock(cpu_hp_mutex);
 +}
 +
 +static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
 +{
 +      mutex_unlock(cpu_hp_mutex);
 +}
 +
  extern void lock_cpu_hotplug(void);
  extern void unlock_cpu_hotplug(void);
  #define hotcpu_notifier(fn, pri) {                            \
  #define unregister_hotcpu_notifier(nb)        unregister_cpu_notifier(nb)
  int cpu_down(unsigned int cpu);
  #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
 -#else
 +
 +#else         /* CONFIG_HOTPLUG_CPU */
 +
 +static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
 +{ }
 +static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
 +{ }
 +
  #define lock_cpu_hotplug()    do { } while (0)
  #define unlock_cpu_hotplug()  do { } while (0)
  #define lock_cpu_hotplug_interruptible() 0
 -#define hotcpu_notifier(fn, pri)      do { } while (0)
 -#define register_hotcpu_notifier(nb)  do { } while (0)
 -#define unregister_hotcpu_notifier(nb)        do { } while (0)
 +#define hotcpu_notifier(fn, pri)      do { (void)(fn); } while (0)
 +#define register_hotcpu_notifier(nb)  do { (void)(nb); } while (0)
 +#define unregister_hotcpu_notifier(nb)        do { (void)(nb); } while (0)
  
  /* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
  static inline int cpu_is_offline(int cpu) { return 0; }
 -#endif
 +#endif                /* CONFIG_HOTPLUG_CPU */
  
  #ifdef CONFIG_SUSPEND_SMP
  extern int disable_nonboot_cpus(void);
diff --combined include/linux/uaccess.h
index 76c3fe325101cc90660af3ee05902a02359633c7,65a68da8bd5d1bfc67d5f138a445909a6b9f073e..975c963e57898aee95fed95e129bd91a1578a414
@@@ -1,43 -1,8 +1,43 @@@
  #ifndef __LINUX_UACCESS_H__
  #define __LINUX_UACCESS_H__
  
 +#include <linux/preempt.h>
  #include <asm/uaccess.h>
  
 +/*
 + * These routines enable/disable the pagefault handler in that
 + * it will not take any locks and go straight to the fixup table.
 + *
 + * They have great resemblance to the preempt_disable/enable calls
 + * and in fact they are identical; this is because currently there is
 + * no other way to make the pagefault handlers do this. So we do
 + * disable preemption but we don't necessarily care about that.
 + */
 +static inline void pagefault_disable(void)
 +{
 +      inc_preempt_count();
 +      /*
 +       * make sure to have issued the store before a pagefault
 +       * can hit.
 +       */
 +      barrier();
 +}
 +
 +static inline void pagefault_enable(void)
 +{
 +      /*
 +       * make sure to issue those last loads/stores before enabling
 +       * the pagefault handler again.
 +       */
 +      barrier();
 +      dec_preempt_count();
 +      /*
 +       * make sure we do..
 +       */
 +      barrier();
 +      preempt_check_resched();
 +}
 +
  #ifndef ARCH_HAS_NOCACHE_UACCESS
  
  static inline unsigned long __copy_from_user_inatomic_nocache(void *to,
@@@ -65,22 -30,14 +65,22 @@@ static inline unsigned long __copy_from
   * do_page_fault() doesn't attempt to take mmap_sem.  This makes
   * probe_kernel_address() suitable for use within regions where the caller
   * already holds mmap_sem, or other locks which nest inside mmap_sem.
 + * This must be a macro because __get_user() needs to know the types of the
 + * args.
 + *
 + * We don't include enough header files to be able to do the set_fs().  We
 + * require that the probe_kernel_address() caller will do that.
   */
  #define probe_kernel_address(addr, retval)            \
        ({                                              \
                long ret;                               \
 +              mm_segment_t old_fs = get_fs();         \
                                                        \
 -              inc_preempt_count();                    \
 -              ret = __get_user(retval, (__force typeof(*addr) __user *)addr);\
 -              dec_preempt_count();                    \
 +              set_fs(KERNEL_DS);                      \
 +              pagefault_disable();                    \
-               ret = __get_user(retval, addr);         \
++              ret = __get_user(retval, (__force typeof(retval) __user *)(addr));              \
 +              pagefault_enable();                     \
 +              set_fs(old_fs);                         \
                ret;                                    \
        })
  
diff --combined init/main.c
index 46508300d6b9efa3db86145d0b9537eed292585d,985c9ed86050f029f270f39c094f90172b683521..1174ae3aec8c0741f7ec3303c241816613ce3ff0
@@@ -29,6 -29,7 +29,7 @@@
  #include <linux/percpu.h>
  #include <linux/kmod.h>
  #include <linux/kernel_stat.h>
+ #include <linux/start_kernel.h>
  #include <linux/security.h>
  #include <linux/workqueue.h>
  #include <linux/profile.h>
  #error Sorry, your GCC is too old. It builds incorrect kernels.
  #endif
  
 +#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0
 +#warning gcc-4.1.0 is known to miscompile the kernel.  A different compiler version is recommended.
 +#endif
 +
  static int init(void *);
  
  extern void init_IRQ(void);
diff --combined kernel/fork.c
index 6588381486470254c3e34aa04a84b963c12c51b6,fd22245e388102dbc085257810e1f62801016221..7f2e31ba33af16b2e6cde516b9e51c63bcc64383
@@@ -82,26 -82,26 +82,26 @@@ int nr_processes(void
  #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
  # define alloc_task_struct()  kmem_cache_alloc(task_struct_cachep, GFP_KERNEL)
  # define free_task_struct(tsk)        kmem_cache_free(task_struct_cachep, (tsk))
 -static kmem_cache_t *task_struct_cachep;
 +static struct kmem_cache *task_struct_cachep;
  #endif
  
  /* SLAB cache for signal_struct structures (tsk->signal) */
 -static kmem_cache_t *signal_cachep;
 +static struct kmem_cache *signal_cachep;
  
  /* SLAB cache for sighand_struct structures (tsk->sighand) */
 -kmem_cache_t *sighand_cachep;
 +struct kmem_cache *sighand_cachep;
  
  /* SLAB cache for files_struct structures (tsk->files) */
 -kmem_cache_t *files_cachep;
 +struct kmem_cache *files_cachep;
  
  /* SLAB cache for fs_struct structures (tsk->fs) */
 -kmem_cache_t *fs_cachep;
 +struct kmem_cache *fs_cachep;
  
  /* SLAB cache for vm_area_struct structures */
 -kmem_cache_t *vm_area_cachep;
 +struct kmem_cache *vm_area_cachep;
  
  /* SLAB cache for mm_struct structures (tsk->mm) */
 -static kmem_cache_t *mm_cachep;
 +static struct kmem_cache *mm_cachep;
  
  void free_task(struct task_struct *tsk)
  {
@@@ -237,7 -237,7 +237,7 @@@ static inline int dup_mmap(struct mm_st
                                goto fail_nomem;
                        charge = len;
                }
 -              tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 +              tmp = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
                if (!tmp)
                        goto fail_nomem;
                *tmp = *mpnt;
@@@ -319,7 -319,7 +319,7 @@@ static inline void mm_free_pgd(struct m
  
   __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
  
 -#define allocate_mm() (kmem_cache_alloc(mm_cachep, SLAB_KERNEL))
 +#define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL))
  #define free_mm(mm)   (kmem_cache_free(mm_cachep, (mm)))
  
  #include <linux/init_task.h>
@@@ -448,16 -448,7 +448,16 @@@ void mm_release(struct task_struct *tsk
                tsk->vfork_done = NULL;
                complete(vfork_done);
        }
 -      if (tsk->clear_child_tid && atomic_read(&mm->mm_users) > 1) {
 +
 +      /*
 +       * If we're exiting normally, clear a user-space tid field if
 +       * requested.  We leave this alone when dying by signal, to leave
 +       * the value intact in a core dump, and to save the unnecessary
 +       * trouble otherwise.  Userland only wants this done for a sys_exit.
 +       */
 +      if (tsk->clear_child_tid
 +          && !(tsk->flags & PF_SIGNALED)
 +          && atomic_read(&mm->mm_users) > 1) {
                u32 __user * tidptr = tsk->clear_child_tid;
                tsk->clear_child_tid = NULL;
  
@@@ -488,10 -479,6 +488,10 @@@ static struct mm_struct *dup_mm(struct 
  
        memcpy(mm, oldmm, sizeof(*mm));
  
 +      /* Initializing for Swap token stuff */
 +      mm->token_priority = 0;
 +      mm->last_interval = 0;
 +
        if (!mm_init(mm))
                goto fail_nomem;
  
@@@ -555,10 -542,6 +555,10 @@@ static int copy_mm(unsigned long clone_
                goto fail_nomem;
  
  good_mm:
 +      /* Initializing for Swap token stuff */
 +      mm->token_priority = 0;
 +      mm->last_interval = 0;
 +
        tsk->mm = mm;
        tsk->active_mm = mm;
        return 0;
@@@ -630,7 -613,7 +630,7 @@@ static struct files_struct *alloc_files
        struct files_struct *newf;
        struct fdtable *fdt;
  
 -      newf = kmem_cache_alloc(files_cachep, SLAB_KERNEL);
 +      newf = kmem_cache_alloc(files_cachep, GFP_KERNEL);
        if (!newf)
                goto out;
  
@@@ -847,6 -830,7 +847,6 @@@ static inline int copy_signal(unsigned 
        if (clone_flags & CLONE_THREAD) {
                atomic_inc(&current->signal->count);
                atomic_inc(&current->signal->live);
 -              taskstats_tgid_alloc(current);
                return 0;
        }
        sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
@@@ -1319,7 -1303,7 +1319,7 @@@ fork_out
        return ERR_PTR(retval);
  }
  
- struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs)
noinline struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs)
  {
        memset(regs, 0, sizeof(struct pt_regs));
        return regs;
@@@ -1429,7 -1413,7 +1429,7 @@@ long do_fork(unsigned long clone_flags
  #define ARCH_MIN_MMSTRUCT_ALIGN 0
  #endif
  
 -static void sighand_ctor(void *data, kmem_cache_t *cachep, unsigned long flags)
 +static void sighand_ctor(void *data, struct kmem_cache *cachep, unsigned long flags)
  {
        struct sighand_struct *sighand = data;
  
diff --combined kernel/lockdep.c
index 62e73ce681972ad350cda5b50037ab30c381c67a,9bb8d784eb02c457281bba5607f980ea359843a0..b02032476dc2e88967940060a84b5bc5742f1a5e
@@@ -140,6 -140,13 +140,6 @@@ void lockdep_on(void
  
  EXPORT_SYMBOL(lockdep_on);
  
 -int lockdep_internal(void)
 -{
 -      return current->lockdep_recursion != 0;
 -}
 -
 -EXPORT_SYMBOL(lockdep_internal);
 -
  /*
   * Debugging switches:
   */
@@@ -221,19 -228,13 +221,15 @@@ static int save_trace(struct stack_trac
        trace->skip = 3;
        trace->all_contexts = 0;
  
-       /* Make sure to not recurse in case the the unwinder needs to tak
- e        locks. */
-       lockdep_off();
        save_stack_trace(trace, NULL);
-       lockdep_on();
  
        trace->max_entries = trace->nr_entries;
  
        nr_stack_trace_entries += trace->nr_entries;
 -      if (DEBUG_LOCKS_WARN_ON(nr_stack_trace_entries > MAX_STACK_TRACE_ENTRIES))
 +      if (DEBUG_LOCKS_WARN_ON(nr_stack_trace_entries > MAX_STACK_TRACE_ENTRIES)) {
 +              __raw_spin_unlock(&hash_lock);
                return 0;
 +      }
  
        if (nr_stack_trace_entries == MAX_STACK_TRACE_ENTRIES) {
                __raw_spin_unlock(&hash_lock);
@@@ -352,7 -353,7 +348,7 @@@ get_usage_chars(struct lock_class *clas
  
  static void print_lock_name(struct lock_class *class)
  {
 -      char str[128], c1, c2, c3, c4;
 +      char str[KSYM_NAME_LEN + 1], c1, c2, c3, c4;
        const char *name;
  
        get_usage_chars(class, &c1, &c2, &c3, &c4);
  static void print_lockdep_cache(struct lockdep_map *lock)
  {
        const char *name;
 -      char str[128];
 +      char str[KSYM_NAME_LEN + 1];
  
        name = lock->name;
        if (!name)
@@@ -444,9 -445,7 +440,9 @@@ static void print_lock_dependencies(str
        print_lock_class_header(class, depth);
  
        list_for_each_entry(entry, &class->locks_after, entry) {
 -              DEBUG_LOCKS_WARN_ON(!entry->class);
 +              if (DEBUG_LOCKS_WARN_ON(!entry->class))
 +                      return;
 +
                print_lock_dependencies(entry->class, depth + 1);
  
                printk("%*s ... acquired at:\n",depth,"");
@@@ -471,8 -470,7 +467,8 @@@ static int add_lock_to_list(struct lock
                return 0;
  
        entry->class = this;
 -      save_trace(&entry->trace);
 +      if (!save_trace(&entry->trace))
 +              return 0;
  
        /*
         * Since we never remove from the dependency list, the list can
@@@ -560,12 -558,8 +556,12 @@@ static noinline int print_circular_bug_
        if (debug_locks_silent)
                return 0;
  
 +      /* hash_lock unlocked by the header */
 +      __raw_spin_lock(&hash_lock);
        this.class = check_source->class;
 -      save_trace(&this.trace);
 +      if (!save_trace(&this.trace))
 +              return 0;
 +      __raw_spin_unlock(&hash_lock);
        print_circular_bug_entry(&this, 0);
  
        printk("\nother info that might help us debug this:\n\n");
@@@ -968,11 -962,14 +964,11 @@@ check_prev_add(struct task_struct *curr
                               &prev->class->locks_after, next->acquire_ip);
        if (!ret)
                return 0;
 -      /*
 -       * Return value of 2 signals 'dependency already added',
 -       * in that case we dont have to add the backlink either.
 -       */
 -      if (ret == 2)
 -              return 2;
 +
        ret = add_lock_to_list(next->class, prev->class,
                               &next->class->locks_before, next->acquire_ip);
 +      if (!ret)
 +              return 0;
  
        /*
         * Debugging printouts:
@@@ -1024,8 -1021,7 +1020,8 @@@ check_prevs_add(struct task_struct *cur
                 * added:
                 */
                if (hlock->read != 2) {
 -                      check_prev_add(curr, hlock, next);
 +                      if (!check_prev_add(curr, hlock, next))
 +                              return 0;
                        /*
                         * Stop after the first non-trylock entry,
                         * as non-trylock entries have added their
@@@ -1182,7 -1178,6 +1178,7 @@@ register_lock_class(struct lockdep_map 
        struct lockdep_subclass_key *key;
        struct list_head *hash_head;
        struct lock_class *class;
 +      unsigned long flags;
  
        class = look_up_lock_class(lock, subclass);
        if (likely(class))
        key = lock->key->subkeys + subclass;
        hash_head = classhashentry(key);
  
 +      raw_local_irq_save(flags);
        __raw_spin_lock(&hash_lock);
        /*
         * We have to do the hash-walk again, to avoid races
         */
        if (nr_lock_classes >= MAX_LOCKDEP_KEYS) {
                __raw_spin_unlock(&hash_lock);
 +              raw_local_irq_restore(flags);
                debug_locks_off();
                printk("BUG: MAX_LOCKDEP_KEYS too low!\n");
                printk("turning off the locking correctness validator.\n");
  
        if (verbose(class)) {
                __raw_spin_unlock(&hash_lock);
 +              raw_local_irq_restore(flags);
                printk("\nnew class %p: %s", class->key, class->name);
                if (class->name_version > 1)
                        printk("#%d", class->name_version);
                printk("\n");
                dump_stack();
 +              raw_local_irq_save(flags);
                __raw_spin_lock(&hash_lock);
        }
  out_unlock_set:
        __raw_spin_unlock(&hash_lock);
 +      raw_local_irq_restore(flags);
  
        if (!subclass || force)
                lock->class_cache = class;
@@@ -1734,7 -1724,6 +1730,7 @@@ static int mark_lock(struct task_struc
                debug_atomic_dec(&nr_unused_locks);
                break;
        default:
 +              __raw_spin_unlock(&hash_lock);
                debug_locks_off();
                WARN_ON(1);
                return 0;
@@@ -2652,7 -2641,6 +2648,7 @@@ void debug_check_no_locks_freed(const v
        }
        local_irq_restore(flags);
  }
 +EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
  
  static void print_held_locks_bug(struct task_struct *curr)
  {
diff --combined kernel/sysctl.c
index 758dbbf972a544d0889d7230464983bb52ce6c41,6fc5e17086f4ec094780161b7c431e98debd0077..8e9f00fd6d18f0a63e40806ff066e7e0aebfae20
@@@ -54,6 -54,7 +54,7 @@@ extern int proc_nr_files(ctl_table *tab
  
  #ifdef CONFIG_X86
  #include <asm/nmi.h>
+ #include <asm/stacktrace.h>
  #endif
  
  #if defined(CONFIG_SYSCTL)
@@@ -170,7 -171,7 +171,7 @@@ static ssize_t proc_readsys(struct fil
  static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *);
  static int proc_opensys(struct inode *, struct file *);
  
 -struct file_operations proc_sys_file_operations = {
 +const struct file_operations proc_sys_file_operations = {
        .open           = proc_opensys,
        .read           = proc_readsys,
        .write          = proc_writesys,
@@@ -707,6 -708,14 +708,14 @@@ static ctl_table kern_table[] = 
                .mode           = 0444,
                .proc_handler   = &proc_dointvec,
        },
+       {
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "kstack_depth_to_print",
+               .data           = &kstack_depth_to_print,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
  #endif
  #if defined(CONFIG_MMU)
        {
@@@ -977,6 -986,17 +986,6 @@@ static ctl_table vm_table[] = 
                .extra1         = &zero,
        },
  #endif
 -#ifdef CONFIG_SWAP
 -      {
 -              .ctl_name       = VM_SWAP_TOKEN_TIMEOUT,
 -              .procname       = "swap_token_timeout",
 -              .data           = &swap_token_default_timeout,
 -              .maxlen         = sizeof(swap_token_default_timeout),
 -              .mode           = 0644,
 -              .proc_handler   = &proc_dointvec_jiffies,
 -              .strategy       = &sysctl_jiffies,
 -      },
 -#endif
  #ifdef CONFIG_NUMA
        {
                .ctl_name       = VM_ZONE_RECLAIM_MODE,
@@@ -1875,7 -1895,7 +1884,7 @@@ static int __do_proc_dointvec(void *tbl
                        p = buf;
                        if (*p == '-' && left > 1) {
                                neg = 1;
 -                              left--, p++;
 +                              p++;
                        }
                        if (*p < '0' || *p > '9')
                                break;
@@@ -2126,7 -2146,7 +2135,7 @@@ static int __do_proc_doulongvec_minmax(
                        p = buf;
                        if (*p == '-' && left > 1) {
                                neg = 1;
 -                              left--, p++;
 +                              p++;
                        }
                        if (*p < '0' || *p > '9')
                                break;