]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'bugfix' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen...
authorIngo Molnar <mingo@elte.hu>
Thu, 20 Aug 2009 10:05:24 +0000 (12:05 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 20 Aug 2009 10:05:24 +0000 (12:05 +0200)
1  2 
arch/x86/kernel/cpu/Makefile
arch/x86/xen/Makefile
arch/x86/xen/enlighten.c

index 3efcb2b96a150e361f9a1f66ccbfaef692b98432,8b5b9b625ede46b7af40ed0efb9244b604719874..c1f253dac1552f63c0795a31ce5977b681b98592
@@@ -1,5 -1,5 +1,5 @@@
  #
 -# Makefile for x86-compatible CPU details and quirks
 +# Makefile for x86-compatible CPU details, features and quirks
  #
  
  # Don't trace early stages of a secondary CPU boot
@@@ -7,6 -7,10 +7,10 @@@ ifdef CONFIG_FUNCTION_TRACE
  CFLAGS_REMOVE_common.o = -pg
  endif
  
+ # Make sure load_percpu_segment has no stackprotector
+ nostackp := $(call cc-option, -fno-stack-protector)
+ CFLAGS_common.o               := $(nostackp)
  obj-y                 := intel_cacheinfo.o addon_cpuid_features.o
  obj-y                 += proc.o capflags.o powerflags.o common.o
  obj-y                 += vmware.o hypervisor.o
@@@ -23,13 -27,11 +27,13 @@@ obj-$(CONFIG_CPU_SUP_CENTAUR)              += centa
  obj-$(CONFIG_CPU_SUP_TRANSMETA_32)    += transmeta.o
  obj-$(CONFIG_CPU_SUP_UMC_32)          += umc.o
  
 -obj-$(CONFIG_X86_MCE) += mcheck/
 -obj-$(CONFIG_MTRR)    += mtrr/
 -obj-$(CONFIG_CPU_FREQ)        += cpufreq/
 +obj-$(CONFIG_PERF_COUNTERS)           += perf_counter.o
  
 -obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
 +obj-$(CONFIG_X86_MCE)                 += mcheck/
 +obj-$(CONFIG_MTRR)                    += mtrr/
 +obj-$(CONFIG_CPU_FREQ)                        += cpufreq/
 +
 +obj-$(CONFIG_X86_LOCAL_APIC)          += perfctr-watchdog.o
  
  quiet_cmd_mkcapflags = MKCAP   $@
        cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
diff --combined arch/x86/xen/Makefile
index 172438f86a02aaf01b3855e36318cf0bb8aaeba1,a5b9288b7da42803a1b05efbced9e5753075adb9..7410640db173b842db79b835dbdc2206e01c0c2a
@@@ -5,10 -5,13 +5,14 @@@ CFLAGS_REMOVE_time.o = -p
  CFLAGS_REMOVE_irq.o = -pg
  endif
  
+ # Make sure early boot has no stackprotector
+ nostackp := $(call cc-option, -fno-stack-protector)
+ CFLAGS_enlighten.o            := $(nostackp)
  obj-y         := enlighten.o setup.o multicalls.o mmu.o irq.o \
                        time.o xen-asm.o xen-asm_$(BITS).o \
                        grant-table.o suspend.o
  
 -obj-$(CONFIG_SMP)             += smp.o spinlock.o
 -obj-$(CONFIG_XEN_DEBUG_FS)    += debugfs.o
 +obj-$(CONFIG_SMP)             += smp.o
 +obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
 +obj-$(CONFIG_XEN_DEBUG_FS)    += debugfs.o
diff --combined arch/x86/xen/enlighten.c
index 0a1700a2be9c8c9a548822ca4deef1bb475b4059,edcf72a3c29c42abad5753d5d4a2084f83885e4f..e90540a46a0bca9ed06d03672010eb19ef648b24
@@@ -20,7 -20,6 +20,7 @@@
  #include <linux/delay.h>
  #include <linux/start_kernel.h>
  #include <linux/sched.h>
 +#include <linux/kprobes.h>
  #include <linux/bootmem.h>
  #include <linux/module.h>
  #include <linux/mm.h>
@@@ -45,7 -44,6 +45,7 @@@
  #include <asm/processor.h>
  #include <asm/proto.h>
  #include <asm/msr-index.h>
 +#include <asm/traps.h>
  #include <asm/setup.h>
  #include <asm/desc.h>
  #include <asm/pgtable.h>
@@@ -242,10 -240,10 +242,10 @@@ static unsigned long xen_get_debugreg(i
        return HYPERVISOR_get_debugreg(reg);
  }
  
 -void xen_leave_lazy(void)
 +static void xen_end_context_switch(struct task_struct *next)
  {
 -      paravirt_leave_lazy(paravirt_get_lazy_mode());
        xen_mc_flush();
 +      paravirt_end_context_switch(next);
  }
  
  static unsigned long xen_store_tr(void)
@@@ -430,44 -428,11 +430,44 @@@ static void xen_write_ldt_entry(struct 
  static int cvt_gate_to_trap(int vector, const gate_desc *val,
                            struct trap_info *info)
  {
 +      unsigned long addr;
 +
        if (val->type != GATE_TRAP && val->type != GATE_INTERRUPT)
                return 0;
  
        info->vector = vector;
 -      info->address = gate_offset(*val);
 +
 +      addr = gate_offset(*val);
 +#ifdef CONFIG_X86_64
 +      /*
 +       * Look for known traps using IST, and substitute them
 +       * appropriately.  The debugger ones are the only ones we care
 +       * about.  Xen will handle faults like double_fault and
 +       * machine_check, so we should never see them.  Warn if
 +       * there's an unexpected IST-using fault handler.
 +       */
 +      if (addr == (unsigned long)debug)
 +              addr = (unsigned long)xen_debug;
 +      else if (addr == (unsigned long)int3)
 +              addr = (unsigned long)xen_int3;
 +      else if (addr == (unsigned long)stack_segment)
 +              addr = (unsigned long)xen_stack_segment;
 +      else if (addr == (unsigned long)double_fault ||
 +               addr == (unsigned long)nmi) {
 +              /* Don't need to handle these */
 +              return 0;
 +#ifdef CONFIG_X86_MCE
 +      } else if (addr == (unsigned long)machine_check) {
 +              return 0;
 +#endif
 +      } else {
 +              /* Some other trap using IST? */
 +              if (WARN_ON(val->ist != 0))
 +                      return 0;
 +      }
 +#endif        /* CONFIG_X86_64 */
 +      info->address = addr;
 +
        info->cs = gate_segment(*val);
        info->flags = val->dpl;
        /* interrupt gates clear IF */
@@@ -658,26 -623,10 +658,26 @@@ static void xen_clts(void
        xen_mc_issue(PARAVIRT_LAZY_CPU);
  }
  
 +static DEFINE_PER_CPU(unsigned long, xen_cr0_value);
 +
 +static unsigned long xen_read_cr0(void)
 +{
 +      unsigned long cr0 = percpu_read(xen_cr0_value);
 +
 +      if (unlikely(cr0 == 0)) {
 +              cr0 = native_read_cr0();
 +              percpu_write(xen_cr0_value, cr0);
 +      }
 +
 +      return cr0;
 +}
 +
  static void xen_write_cr0(unsigned long cr0)
  {
        struct multicall_space mcs;
  
 +      percpu_write(xen_cr0_value, cr0);
 +
        /* Only pay attention to cr0.TS; everything else is
           ignored. */
        mcs = xen_mc_entry(0);
@@@ -863,7 -812,7 +863,7 @@@ static const struct pv_cpu_ops xen_cpu_
  
        .clts = xen_clts,
  
 -      .read_cr0 = native_read_cr0,
 +      .read_cr0 = xen_read_cr0,
        .write_cr0 = xen_write_cr0,
  
        .read_cr4 = native_read_cr4,
        /* Xen takes care of %gs when switching to usermode for us */
        .swapgs = paravirt_nop,
  
 -      .lazy_mode = {
 -              .enter = paravirt_enter_lazy_cpu,
 -              .leave = xen_leave_lazy,
 -      },
 +      .start_context_switch = paravirt_start_context_switch,
 +      .end_context_switch = xen_end_context_switch,
  };
  
  static const struct pv_apic_ops xen_apic_ops __initdata = {
@@@ -974,10 -925,6 +974,6 @@@ asmlinkage void __init xen_start_kernel
  
        xen_domain_type = XEN_PV_DOMAIN;
  
-       BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0);
-       xen_setup_features();
        /* Install Xen paravirt ops */
        pv_info = xen_info;
        pv_init_ops = xen_init_ops;
        pv_apic_ops = xen_apic_ops;
        pv_mmu_ops = xen_mmu_ops;
  
-       xen_init_irq_ops();
+ #ifdef CONFIG_X86_64
+       /*
+        * Setup percpu state.  We only need to do this for 64-bit
+        * because 32-bit already has %fs set properly.
+        */
+       load_percpu_segment(0);
+ #endif
  
+       xen_init_irq_ops();
        xen_init_cpuid_mask();
  
  #ifdef CONFIG_X86_LOCAL_APIC
        set_xen_basic_apic_ops();
  #endif
  
+       xen_setup_features();
        if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
                pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
                pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit;
  
        machine_ops = xen_machine_ops;
  
- #ifdef CONFIG_X86_64
-       /*
-        * Setup percpu state.  We only need to do this for 64-bit
-        * because 32-bit already has %fs set properly.
-        */
-       load_percpu_segment(0);
- #endif
        /*
         * The only reliable way to retain the initial address of the
         * percpu gdt_page is to remember it here, so we can go and