Merge branch 'core/percpu' into x86/paravirt
authorH. Peter Anvin <hpa@linux.intel.com>
Fri, 30 Jan 2009 22:50:57 +0000 (14:50 -0800)
committerH. Peter Anvin <hpa@linux.intel.com>
Fri, 30 Jan 2009 22:50:57 +0000 (14:50 -0800)
1  2 
arch/x86/include/asm/paravirt.h
arch/x86/xen/enlighten.c

index e25c410f3d8c54d34a48bf54685838a318624e54,c26c6bf4da00d2c66326ad60e4c1ccc3ac76e8c5..1757788870908c3bc88e081368f496b47b8ea3c1
@@@ -244,7 -244,8 +244,8 @@@ struct pv_mmu_ops 
        void (*flush_tlb_user)(void);
        void (*flush_tlb_kernel)(void);
        void (*flush_tlb_single)(unsigned long addr);
-       void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm,
+       void (*flush_tlb_others)(const struct cpumask *cpus,
+                                struct mm_struct *mm,
                                 unsigned long va);
  
        /* Hooks for allocating and freeing a pagetable top-level */
                                        pte_t *ptep, pte_t pte);
  
        pteval_t (*pte_val)(pte_t);
 -      pteval_t (*pte_flags)(pte_t);
        pte_t (*make_pte)(pteval_t pte);
  
        pgdval_t (*pgd_val)(pgd_t);
@@@ -983,10 -985,11 +984,11 @@@ static inline void __flush_tlb_single(u
        PVOP_VCALL1(pv_mmu_ops.flush_tlb_single, addr);
  }
  
- static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
+ static inline void flush_tlb_others(const struct cpumask *cpumask,
+                                   struct mm_struct *mm,
                                    unsigned long va)
  {
-       PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va);
+       PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, cpumask, mm, va);
  }
  
  static inline int paravirt_pgd_alloc(struct mm_struct *mm)
@@@ -1083,6 -1086,23 +1085,6 @@@ static inline pteval_t pte_val(pte_t pt
        return ret;
  }
  
 -static inline pteval_t pte_flags(pte_t pte)
 -{
 -      pteval_t ret;
 -
 -      if (sizeof(pteval_t) > sizeof(long))
 -              ret = PVOP_CALL2(pteval_t, pv_mmu_ops.pte_flags,
 -                               pte.pte, (u64)pte.pte >> 32);
 -      else
 -              ret = PVOP_CALL1(pteval_t, pv_mmu_ops.pte_flags,
 -                               pte.pte);
 -
 -#ifdef CONFIG_PARAVIRT_DEBUG
 -      BUG_ON(ret & PTE_PFN_MASK);
 -#endif
 -      return ret;
 -}
 -
  static inline pgd_t __pgd(pgdval_t val)
  {
        pgdval_t ret;
diff --combined arch/x86/xen/enlighten.c
index 6f1bb71aa13afe544b55d870aa1ea3d7e2f737e5,bef941f6145140c2c8ceeb50b532a163f9cd58e6..6b3f7eef57e3eea3cb6b5bf966385db090f1cf1f
@@@ -634,35 -634,27 +634,27 @@@ static void xen_flush_tlb_single(unsign
        preempt_enable();
  }
  
- static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm,
-                                unsigned long va)
+ static void xen_flush_tlb_others(const struct cpumask *cpus,
+                                struct mm_struct *mm, unsigned long va)
  {
        struct {
                struct mmuext_op op;
-               cpumask_t mask;
+               DECLARE_BITMAP(mask, NR_CPUS);
        } *args;
-       cpumask_t cpumask = *cpus;
        struct multicall_space mcs;
  
-       /*
-        * A couple of (to be removed) sanity checks:
-        *
-        * - current CPU must not be in mask
-        * - mask must exist :)
-        */
-       BUG_ON(cpus_empty(cpumask));
-       BUG_ON(cpu_isset(smp_processor_id(), cpumask));
+       BUG_ON(cpumask_empty(cpus));
        BUG_ON(!mm);
  
-       /* If a CPU which we ran on has gone down, OK. */
-       cpus_and(cpumask, cpumask, cpu_online_map);
-       if (cpus_empty(cpumask))
-               return;
        mcs = xen_mc_entry(sizeof(*args));
        args = mcs.args;
-       args->mask = cpumask;
-       args->op.arg2.vcpumask = &args->mask;
+       args->op.arg2.vcpumask = to_cpumask(args->mask);
+       /* Remove us, and any offline CPUS. */
+       cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask);
+       cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask));
+       if (unlikely(cpumask_empty(to_cpumask(args->mask))))
+               goto issue;
  
        if (va == TLB_FLUSH_ALL) {
                args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
  
        MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);
  
+ issue:
        xen_mc_issue(PARAVIRT_LAZY_MMU);
  }
  
@@@ -702,17 -695,17 +695,17 @@@ static void xen_write_cr0(unsigned lon
  
  static void xen_write_cr2(unsigned long cr2)
  {
-       x86_read_percpu(xen_vcpu)->arch.cr2 = cr2;
+       percpu_read(xen_vcpu)->arch.cr2 = cr2;
  }
  
  static unsigned long xen_read_cr2(void)
  {
-       return x86_read_percpu(xen_vcpu)->arch.cr2;
+       return percpu_read(xen_vcpu)->arch.cr2;
  }
  
  static unsigned long xen_read_cr2_direct(void)
  {
-       return x86_read_percpu(xen_vcpu_info.arch.cr2);
+       return percpu_read(xen_vcpu_info.arch.cr2);
  }
  
  static void xen_write_cr4(unsigned long cr4)
  
  static unsigned long xen_read_cr3(void)
  {
-       return x86_read_percpu(xen_cr3);
+       return percpu_read(xen_cr3);
  }
  
  static void set_current_cr3(void *v)
  {
-       x86_write_percpu(xen_current_cr3, (unsigned long)v);
+       percpu_write(xen_current_cr3, (unsigned long)v);
  }
  
  static void __xen_write_cr3(bool kernel, unsigned long cr3)
        MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
  
        if (kernel) {
-               x86_write_percpu(xen_cr3, cr3);
+               percpu_write(xen_cr3, cr3);
  
                /* Update xen_current_cr3 once the batch has actually
                   been submitted. */
@@@ -771,7 -764,7 +764,7 @@@ static void xen_write_cr3(unsigned lon
  
        /* Update while interrupts are disabled, so its atomic with
           respect to ipis */
-       x86_write_percpu(xen_cr3, cr3);
+       percpu_write(xen_cr3, cr3);
  
        __xen_write_cr3(true, cr3);
  
@@@ -1314,6 -1307,7 +1307,6 @@@ static const struct pv_mmu_ops xen_mmu_
        .ptep_modify_prot_commit = __ptep_modify_prot_commit,
  
        .pte_val = xen_pte_val,
 -      .pte_flags = native_pte_flags,
        .pgd_val = xen_pgd_val,
  
        .make_pte = xen_make_pte,
@@@ -1651,7 -1645,6 +1644,6 @@@ asmlinkage void __init xen_start_kernel
  #ifdef CONFIG_X86_64
        /* Disable until direct per-cpu data access. */
        have_vcpu_info_placement = 0;
-       x86_64_init_pda();
  #endif
  
        xen_smp_init();