diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/crypto/aesni-intel_asm.S | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable-3level.h | 30 | ||||
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 7 | ||||
-rw-r--r-- | arch/x86/lib/usercopy.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/ioremap.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/pageattr.c | 2 | ||||
-rw-r--r-- | arch/x86/um/sys_call_table_32.c | 4 | ||||
-rw-r--r-- | arch/x86/xen/enlighten.c | 8 | ||||
-rw-r--r-- | arch/x86/xen/p2m.c | 36 | ||||
-rw-r--r-- | arch/x86/xen/setup.c | 3 |
12 files changed, 80 insertions, 30 deletions
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index be6d9e365a80..3470624d7835 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S | |||
@@ -2460,10 +2460,12 @@ ENTRY(aesni_cbc_dec) | |||
2460 | pxor IN3, STATE4 | 2460 | pxor IN3, STATE4 |
2461 | movaps IN4, IV | 2461 | movaps IN4, IV |
2462 | #else | 2462 | #else |
2463 | pxor (INP), STATE2 | ||
2464 | pxor 0x10(INP), STATE3 | ||
2465 | pxor IN1, STATE4 | 2463 | pxor IN1, STATE4 |
2466 | movaps IN2, IV | 2464 | movaps IN2, IV |
2465 | movups (INP), IN1 | ||
2466 | pxor IN1, STATE2 | ||
2467 | movups 0x10(INP), IN2 | ||
2468 | pxor IN2, STATE3 | ||
2467 | #endif | 2469 | #endif |
2468 | movups STATE1, (OUTP) | 2470 | movups STATE1, (OUTP) |
2469 | movups STATE2, 0x10(OUTP) | 2471 | movups STATE2, 0x10(OUTP) |
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h index 43876f16caf1..cb00ccc7d571 100644 --- a/arch/x86/include/asm/pgtable-3level.h +++ b/arch/x86/include/asm/pgtable-3level.h | |||
@@ -47,16 +47,26 @@ static inline void native_set_pte(pte_t *ptep, pte_t pte) | |||
47 | * they can run pmd_offset_map_lock or pmd_trans_huge or other pmd | 47 | * they can run pmd_offset_map_lock or pmd_trans_huge or other pmd |
48 | * operations. | 48 | * operations. |
49 | * | 49 | * |
50 | * Without THP if the mmap_sem is hold for reading, the | 50 | * Without THP if the mmap_sem is hold for reading, the pmd can only |
51 | * pmd can only transition from null to not null while pmd_read_atomic runs. | 51 | * transition from null to not null while pmd_read_atomic runs. So |
52 | * So there's no need of literally reading it atomically. | 52 | * we can always return atomic pmd values with this function. |
53 | * | 53 | * |
54 | * With THP if the mmap_sem is hold for reading, the pmd can become | 54 | * With THP if the mmap_sem is hold for reading, the pmd can become |
55 | * THP or null or point to a pte (and in turn become "stable") at any | 55 | * trans_huge or none or point to a pte (and in turn become "stable") |
56 | * time under pmd_read_atomic, so it's mandatory to read it atomically | 56 | * at any time under pmd_read_atomic. We could read it really |
57 | * with cmpxchg8b. | 57 | * atomically here with a atomic64_read for the THP enabled case (and |
58 | * it would be a whole lot simpler), but to avoid using cmpxchg8b we | ||
59 | * only return an atomic pmdval if the low part of the pmdval is later | ||
60 | * found stable (i.e. pointing to a pte). And we're returning a none | ||
61 | * pmdval if the low part of the pmd is none. In some cases the high | ||
62 | * and low part of the pmdval returned may not be consistent if THP is | ||
63 | * enabled (the low part may point to previously mapped hugepage, | ||
64 | * while the high part may point to a more recently mapped hugepage), | ||
65 | * but pmd_none_or_trans_huge_or_clear_bad() only needs the low part | ||
66 | * of the pmd to be read atomically to decide if the pmd is unstable | ||
67 | * or not, with the only exception of when the low part of the pmd is | ||
68 | * zero in which case we return a none pmd. | ||
58 | */ | 69 | */ |
59 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE | ||
60 | static inline pmd_t pmd_read_atomic(pmd_t *pmdp) | 70 | static inline pmd_t pmd_read_atomic(pmd_t *pmdp) |
61 | { | 71 | { |
62 | pmdval_t ret; | 72 | pmdval_t ret; |
@@ -74,12 +84,6 @@ static inline pmd_t pmd_read_atomic(pmd_t *pmdp) | |||
74 | 84 | ||
75 | return (pmd_t) { ret }; | 85 | return (pmd_t) { ret }; |
76 | } | 86 | } |
77 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ | ||
78 | static inline pmd_t pmd_read_atomic(pmd_t *pmdp) | ||
79 | { | ||
80 | return (pmd_t) { atomic64_read((atomic64_t *)pmdp) }; | ||
81 | } | ||
82 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | ||
83 | 87 | ||
84 | static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte) | 88 | static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte) |
85 | { | 89 | { |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 086eb58c6e80..f1b42b3a186c 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -120,11 +120,6 @@ bool kvm_check_and_clear_guest_paused(void) | |||
120 | bool ret = false; | 120 | bool ret = false; |
121 | struct pvclock_vcpu_time_info *src; | 121 | struct pvclock_vcpu_time_info *src; |
122 | 122 | ||
123 | /* | ||
124 | * per_cpu() is safe here because this function is only called from | ||
125 | * timer functions where preemption is already disabled. | ||
126 | */ | ||
127 | WARN_ON(!in_atomic()); | ||
128 | src = &__get_cpu_var(hv_clock); | 123 | src = &__get_cpu_var(hv_clock); |
129 | if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { | 124 | if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { |
130 | __this_cpu_and(hv_clock.flags, ~PVCLOCK_GUEST_STOPPED); | 125 | __this_cpu_and(hv_clock.flags, ~PVCLOCK_GUEST_STOPPED); |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 62c9457ccd2f..c0f420f76cd3 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -100,7 +100,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, | |||
100 | struct dma_attrs *attrs) | 100 | struct dma_attrs *attrs) |
101 | { | 101 | { |
102 | unsigned long dma_mask; | 102 | unsigned long dma_mask; |
103 | struct page *page = NULL; | 103 | struct page *page; |
104 | unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; | 104 | unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
105 | dma_addr_t addr; | 105 | dma_addr_t addr; |
106 | 106 | ||
@@ -108,6 +108,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, | |||
108 | 108 | ||
109 | flag |= __GFP_ZERO; | 109 | flag |= __GFP_ZERO; |
110 | again: | 110 | again: |
111 | page = NULL; | ||
111 | if (!(flag & GFP_ATOMIC)) | 112 | if (!(flag & GFP_ATOMIC)) |
112 | page = dma_alloc_from_contiguous(dev, count, get_order(size)); | 113 | page = dma_alloc_from_contiguous(dev, count, get_order(size)); |
113 | if (!page) | 114 | if (!page) |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 3fab55bea29b..7bd8a0823654 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -349,9 +349,12 @@ static bool __cpuinit match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) | |||
349 | 349 | ||
350 | static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) | 350 | static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) |
351 | { | 351 | { |
352 | if (c->phys_proc_id == o->phys_proc_id) | 352 | if (c->phys_proc_id == o->phys_proc_id) { |
353 | return topology_sane(c, o, "mc"); | 353 | if (cpu_has(c, X86_FEATURE_AMD_DCM)) |
354 | return true; | ||
354 | 355 | ||
356 | return topology_sane(c, o, "mc"); | ||
357 | } | ||
355 | return false; | 358 | return false; |
356 | } | 359 | } |
357 | 360 | ||
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c index 677b1ed184c9..4f74d94c8d97 100644 --- a/arch/x86/lib/usercopy.c +++ b/arch/x86/lib/usercopy.c | |||
@@ -22,7 +22,7 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n) | |||
22 | void *map; | 22 | void *map; |
23 | int ret; | 23 | int ret; |
24 | 24 | ||
25 | if (__range_not_ok(from, n, TASK_SIZE) == 0) | 25 | if (__range_not_ok(from, n, TASK_SIZE)) |
26 | return len; | 26 | return len; |
27 | 27 | ||
28 | do { | 28 | do { |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index be1ef574ce9a..78fe3f1ac49f 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -180,7 +180,7 @@ err_free_memtype: | |||
180 | 180 | ||
181 | /** | 181 | /** |
182 | * ioremap_nocache - map bus memory into CPU space | 182 | * ioremap_nocache - map bus memory into CPU space |
183 | * @offset: bus address of the memory | 183 | * @phys_addr: bus address of the memory |
184 | * @size: size of the resource to map | 184 | * @size: size of the resource to map |
185 | * | 185 | * |
186 | * ioremap_nocache performs a platform specific sequence of operations to | 186 | * ioremap_nocache performs a platform specific sequence of operations to |
@@ -217,7 +217,7 @@ EXPORT_SYMBOL(ioremap_nocache); | |||
217 | 217 | ||
218 | /** | 218 | /** |
219 | * ioremap_wc - map memory into CPU space write combined | 219 | * ioremap_wc - map memory into CPU space write combined |
220 | * @offset: bus address of the memory | 220 | * @phys_addr: bus address of the memory |
221 | * @size: size of the resource to map | 221 | * @size: size of the resource to map |
222 | * | 222 | * |
223 | * This version of ioremap ensures that the memory is marked write combining. | 223 | * This version of ioremap ensures that the memory is marked write combining. |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index e1ebde315210..a718e0d23503 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -122,7 +122,7 @@ within(unsigned long addr, unsigned long start, unsigned long end) | |||
122 | 122 | ||
123 | /** | 123 | /** |
124 | * clflush_cache_range - flush a cache range with clflush | 124 | * clflush_cache_range - flush a cache range with clflush |
125 | * @addr: virtual start address | 125 | * @vaddr: virtual start address |
126 | * @size: number of bytes to flush | 126 | * @size: number of bytes to flush |
127 | * | 127 | * |
128 | * clflush is an unordered instruction which needs fencing with mfence | 128 | * clflush is an unordered instruction which needs fencing with mfence |
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c index 416bd40c0eba..68d1dc91b37b 100644 --- a/arch/x86/um/sys_call_table_32.c +++ b/arch/x86/um/sys_call_table_32.c | |||
@@ -39,9 +39,9 @@ | |||
39 | #undef __SYSCALL_I386 | 39 | #undef __SYSCALL_I386 |
40 | #define __SYSCALL_I386(nr, sym, compat) [ nr ] = sym, | 40 | #define __SYSCALL_I386(nr, sym, compat) [ nr ] = sym, |
41 | 41 | ||
42 | typedef void (*sys_call_ptr_t)(void); | 42 | typedef asmlinkage void (*sys_call_ptr_t)(void); |
43 | 43 | ||
44 | extern void sys_ni_syscall(void); | 44 | extern asmlinkage void sys_ni_syscall(void); |
45 | 45 | ||
46 | const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { | 46 | const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { |
47 | /* | 47 | /* |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index e74df9548a02..ff962d4b821e 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -209,6 +209,9 @@ static void __init xen_banner(void) | |||
209 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); | 209 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); |
210 | } | 210 | } |
211 | 211 | ||
212 | #define CPUID_THERM_POWER_LEAF 6 | ||
213 | #define APERFMPERF_PRESENT 0 | ||
214 | |||
212 | static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; | 215 | static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; |
213 | static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; | 216 | static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; |
214 | 217 | ||
@@ -242,6 +245,11 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, | |||
242 | *dx = cpuid_leaf5_edx_val; | 245 | *dx = cpuid_leaf5_edx_val; |
243 | return; | 246 | return; |
244 | 247 | ||
248 | case CPUID_THERM_POWER_LEAF: | ||
249 | /* Disabling APERFMPERF for kernel usage */ | ||
250 | maskecx = ~(1 << APERFMPERF_PRESENT); | ||
251 | break; | ||
252 | |||
245 | case 0xb: | 253 | case 0xb: |
246 | /* Suppress extended topology stuff */ | 254 | /* Suppress extended topology stuff */ |
247 | maskebx = 0; | 255 | maskebx = 0; |
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index ffd08c414e91..64effdc6da94 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -706,6 +706,7 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
706 | unsigned long uninitialized_var(address); | 706 | unsigned long uninitialized_var(address); |
707 | unsigned level; | 707 | unsigned level; |
708 | pte_t *ptep = NULL; | 708 | pte_t *ptep = NULL; |
709 | int ret = 0; | ||
709 | 710 | ||
710 | pfn = page_to_pfn(page); | 711 | pfn = page_to_pfn(page); |
711 | if (!PageHighMem(page)) { | 712 | if (!PageHighMem(page)) { |
@@ -741,6 +742,24 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
741 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); | 742 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); |
742 | spin_unlock_irqrestore(&m2p_override_lock, flags); | 743 | spin_unlock_irqrestore(&m2p_override_lock, flags); |
743 | 744 | ||
745 | /* p2m(m2p(mfn)) == mfn: the mfn is already present somewhere in | ||
746 | * this domain. Set the FOREIGN_FRAME_BIT in the p2m for the other | ||
747 | * pfn so that the following mfn_to_pfn(mfn) calls will return the | ||
748 | * pfn from the m2p_override (the backend pfn) instead. | ||
749 | * We need to do this because the pages shared by the frontend | ||
750 | * (xen-blkfront) can be already locked (lock_page, called by | ||
751 | * do_read_cache_page); when the userspace backend tries to use them | ||
752 | * with direct_IO, mfn_to_pfn returns the pfn of the frontend, so | ||
753 | * do_blockdev_direct_IO is going to try to lock the same pages | ||
754 | * again resulting in a deadlock. | ||
755 | * As a side effect get_user_pages_fast might not be safe on the | ||
756 | * frontend pages while they are being shared with the backend, | ||
757 | * because mfn_to_pfn (that ends up being called by GUPF) will | ||
758 | * return the backend pfn rather than the frontend pfn. */ | ||
759 | ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); | ||
760 | if (ret == 0 && get_phys_to_machine(pfn) == mfn) | ||
761 | set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)); | ||
762 | |||
744 | return 0; | 763 | return 0; |
745 | } | 764 | } |
746 | EXPORT_SYMBOL_GPL(m2p_add_override); | 765 | EXPORT_SYMBOL_GPL(m2p_add_override); |
@@ -752,6 +771,7 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
752 | unsigned long uninitialized_var(address); | 771 | unsigned long uninitialized_var(address); |
753 | unsigned level; | 772 | unsigned level; |
754 | pte_t *ptep = NULL; | 773 | pte_t *ptep = NULL; |
774 | int ret = 0; | ||
755 | 775 | ||
756 | pfn = page_to_pfn(page); | 776 | pfn = page_to_pfn(page); |
757 | mfn = get_phys_to_machine(pfn); | 777 | mfn = get_phys_to_machine(pfn); |
@@ -821,6 +841,22 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
821 | } else | 841 | } else |
822 | set_phys_to_machine(pfn, page->index); | 842 | set_phys_to_machine(pfn, page->index); |
823 | 843 | ||
844 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present | ||
845 | * somewhere in this domain, even before being added to the | ||
846 | * m2p_override (see comment above in m2p_add_override). | ||
847 | * If there are no other entries in the m2p_override corresponding | ||
848 | * to this mfn, then remove the FOREIGN_FRAME_BIT from the p2m for | ||
849 | * the original pfn (the one shared by the frontend): the backend | ||
850 | * cannot do any IO on this page anymore because it has been | ||
851 | * unshared. Removing the FOREIGN_FRAME_BIT from the p2m entry of | ||
852 | * the original pfn causes mfn_to_pfn(mfn) to return the frontend | ||
853 | * pfn again. */ | ||
854 | mfn &= ~FOREIGN_FRAME_BIT; | ||
855 | ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); | ||
856 | if (ret == 0 && get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) && | ||
857 | m2p_find_override(mfn) == NULL) | ||
858 | set_phys_to_machine(pfn, mfn); | ||
859 | |||
824 | return 0; | 860 | return 0; |
825 | } | 861 | } |
826 | EXPORT_SYMBOL_GPL(m2p_remove_override); | 862 | EXPORT_SYMBOL_GPL(m2p_remove_override); |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 3ebba0753d38..a4790bf22c59 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -371,7 +371,8 @@ char * __init xen_memory_setup(void) | |||
371 | populated = xen_populate_chunk(map, memmap.nr_entries, | 371 | populated = xen_populate_chunk(map, memmap.nr_entries, |
372 | max_pfn, &last_pfn, xen_released_pages); | 372 | max_pfn, &last_pfn, xen_released_pages); |
373 | 373 | ||
374 | extra_pages += (xen_released_pages - populated); | 374 | xen_released_pages -= populated; |
375 | extra_pages += xen_released_pages; | ||
375 | 376 | ||
376 | if (last_pfn > max_pfn) { | 377 | if (last_pfn > max_pfn) { |
377 | max_pfn = min(MAX_DOMAIN_PAGES, last_pfn); | 378 | max_pfn = min(MAX_DOMAIN_PAGES, last_pfn); |