diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-12-06 11:08:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-12-06 11:08:56 -0500 |
commit | 69d2ca60029684360bc8f1000bf394fc60031e81 (patch) | |
tree | 551e0ff6abc568fb1fe17f7323a09bd1f03d2eee | |
parent | 19190f5ea9917645c770c85f5119bacdcaf4261a (diff) | |
parent | 22eab1108781eff09961ae7001704f7bd8fb1dce (diff) |
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thoma Gleixner:
"Another round of fixes for x86:
- Move the initialization of the microcode driver to late_initcall to
make sure everything that init function needs is available.
- Make sure that lockdep knows about interrupts being off in the
entry code before calling into c-code.
- Undo the cpu hotplug init delay regression.
- Use the proper conditionals in the mpx instruction decoder.
- Fixup restart_syscall for x32 tasks.
- Fix the hugepage regression on PAE kernels which was introduced
with the latest PAT changes"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/signal: Fix restart_syscall number for x32 tasks
x86/mpx: Fix instruction decoder condition
x86/mm: Fix regression with huge pages on PAE
x86 smpboot: Re-enable init_udelay=0 by default on modern CPUs
x86/entry/64: Fix irqflag tracing wrt context tracking
x86/microcode: Initialize the driver late when facilities are up
-rw-r--r-- | arch/x86/boot/boot.h | 1 | ||||
-rw-r--r-- | arch/x86/boot/video-mode.c | 2 | ||||
-rw-r--r-- | arch/x86/boot/video.c | 2 | ||||
-rw-r--r-- | arch/x86/entry/entry_64.S | 19 | ||||
-rw-r--r-- | arch/x86/include/asm/page_types.h | 16 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_types.h | 14 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/microcode/core.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/signal.c | 17 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 9 | ||||
-rw-r--r-- | arch/x86/mm/mpx.c | 6 |
12 files changed, 54 insertions, 36 deletions
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index 0033e96c3f09..9011a88353de 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <stdarg.h> | 23 | #include <stdarg.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/edd.h> | 25 | #include <linux/edd.h> |
26 | #include <asm/boot.h> | ||
27 | #include <asm/setup.h> | 26 | #include <asm/setup.h> |
28 | #include "bitops.h" | 27 | #include "bitops.h" |
29 | #include "ctype.h" | 28 | #include "ctype.h" |
diff --git a/arch/x86/boot/video-mode.c b/arch/x86/boot/video-mode.c index aa8a96b052e3..95c7a818c0ed 100644 --- a/arch/x86/boot/video-mode.c +++ b/arch/x86/boot/video-mode.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include "video.h" | 19 | #include "video.h" |
20 | #include "vesa.h" | 20 | #include "vesa.h" |
21 | 21 | ||
22 | #include <uapi/asm/boot.h> | ||
23 | |||
22 | /* | 24 | /* |
23 | * Common variables | 25 | * Common variables |
24 | */ | 26 | */ |
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c index 05111bb8d018..77780e386e9b 100644 --- a/arch/x86/boot/video.c +++ b/arch/x86/boot/video.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * Select video mode | 13 | * Select video mode |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <uapi/asm/boot.h> | ||
17 | |||
16 | #include "boot.h" | 18 | #include "boot.h" |
17 | #include "video.h" | 19 | #include "video.h" |
18 | #include "vesa.h" | 20 | #include "vesa.h" |
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 53616ca03244..a55697d19824 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S | |||
@@ -509,6 +509,17 @@ END(irq_entries_start) | |||
509 | * tracking that we're in kernel mode. | 509 | * tracking that we're in kernel mode. |
510 | */ | 510 | */ |
511 | SWAPGS | 511 | SWAPGS |
512 | |||
513 | /* | ||
514 | * We need to tell lockdep that IRQs are off. We can't do this until | ||
515 | * we fix gsbase, and we should do it before enter_from_user_mode | ||
516 | * (which can take locks). Since TRACE_IRQS_OFF idempotent, | ||
517 | * the simplest way to handle it is to just call it twice if | ||
518 | * we enter from user mode. There's no reason to optimize this since | ||
519 | * TRACE_IRQS_OFF is a no-op if lockdep is off. | ||
520 | */ | ||
521 | TRACE_IRQS_OFF | ||
522 | |||
512 | #ifdef CONFIG_CONTEXT_TRACKING | 523 | #ifdef CONFIG_CONTEXT_TRACKING |
513 | call enter_from_user_mode | 524 | call enter_from_user_mode |
514 | #endif | 525 | #endif |
@@ -1049,12 +1060,18 @@ ENTRY(error_entry) | |||
1049 | SWAPGS | 1060 | SWAPGS |
1050 | 1061 | ||
1051 | .Lerror_entry_from_usermode_after_swapgs: | 1062 | .Lerror_entry_from_usermode_after_swapgs: |
1063 | /* | ||
1064 | * We need to tell lockdep that IRQs are off. We can't do this until | ||
1065 | * we fix gsbase, and we should do it before enter_from_user_mode | ||
1066 | * (which can take locks). | ||
1067 | */ | ||
1068 | TRACE_IRQS_OFF | ||
1052 | #ifdef CONFIG_CONTEXT_TRACKING | 1069 | #ifdef CONFIG_CONTEXT_TRACKING |
1053 | call enter_from_user_mode | 1070 | call enter_from_user_mode |
1054 | #endif | 1071 | #endif |
1072 | ret | ||
1055 | 1073 | ||
1056 | .Lerror_entry_done: | 1074 | .Lerror_entry_done: |
1057 | |||
1058 | TRACE_IRQS_OFF | 1075 | TRACE_IRQS_OFF |
1059 | ret | 1076 | ret |
1060 | 1077 | ||
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index c5b7fb2774d0..cc071c6f7d4d 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h | |||
@@ -9,19 +9,21 @@ | |||
9 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) | 9 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) |
10 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 10 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
11 | 11 | ||
12 | #define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) | ||
13 | #define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) | ||
14 | |||
15 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) | ||
16 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) | ||
17 | |||
12 | #define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1)) | 18 | #define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1)) |
13 | #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) | 19 | #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) |
14 | 20 | ||
15 | /* Cast PAGE_MASK to a signed type so that it is sign-extended if | 21 | /* Cast *PAGE_MASK to a signed type so that it is sign-extended if |
16 | virtual addresses are 32-bits but physical addresses are larger | 22 | virtual addresses are 32-bits but physical addresses are larger |
17 | (ie, 32-bit PAE). */ | 23 | (ie, 32-bit PAE). */ |
18 | #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK) | 24 | #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK) |
19 | 25 | #define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK) | |
20 | #define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) | 26 | #define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK) |
21 | #define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) | ||
22 | |||
23 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) | ||
24 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) | ||
25 | 27 | ||
26 | #define HPAGE_SHIFT PMD_SHIFT | 28 | #define HPAGE_SHIFT PMD_SHIFT |
27 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) | 29 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) |
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index dd5b0aa9dd2f..a471cadb9630 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h | |||
@@ -279,17 +279,14 @@ static inline pmdval_t native_pmd_val(pmd_t pmd) | |||
279 | static inline pudval_t pud_pfn_mask(pud_t pud) | 279 | static inline pudval_t pud_pfn_mask(pud_t pud) |
280 | { | 280 | { |
281 | if (native_pud_val(pud) & _PAGE_PSE) | 281 | if (native_pud_val(pud) & _PAGE_PSE) |
282 | return PUD_PAGE_MASK & PHYSICAL_PAGE_MASK; | 282 | return PHYSICAL_PUD_PAGE_MASK; |
283 | else | 283 | else |
284 | return PTE_PFN_MASK; | 284 | return PTE_PFN_MASK; |
285 | } | 285 | } |
286 | 286 | ||
287 | static inline pudval_t pud_flags_mask(pud_t pud) | 287 | static inline pudval_t pud_flags_mask(pud_t pud) |
288 | { | 288 | { |
289 | if (native_pud_val(pud) & _PAGE_PSE) | 289 | return ~pud_pfn_mask(pud); |
290 | return ~(PUD_PAGE_MASK & (pudval_t)PHYSICAL_PAGE_MASK); | ||
291 | else | ||
292 | return ~PTE_PFN_MASK; | ||
293 | } | 290 | } |
294 | 291 | ||
295 | static inline pudval_t pud_flags(pud_t pud) | 292 | static inline pudval_t pud_flags(pud_t pud) |
@@ -300,17 +297,14 @@ static inline pudval_t pud_flags(pud_t pud) | |||
300 | static inline pmdval_t pmd_pfn_mask(pmd_t pmd) | 297 | static inline pmdval_t pmd_pfn_mask(pmd_t pmd) |
301 | { | 298 | { |
302 | if (native_pmd_val(pmd) & _PAGE_PSE) | 299 | if (native_pmd_val(pmd) & _PAGE_PSE) |
303 | return PMD_PAGE_MASK & PHYSICAL_PAGE_MASK; | 300 | return PHYSICAL_PMD_PAGE_MASK; |
304 | else | 301 | else |
305 | return PTE_PFN_MASK; | 302 | return PTE_PFN_MASK; |
306 | } | 303 | } |
307 | 304 | ||
308 | static inline pmdval_t pmd_flags_mask(pmd_t pmd) | 305 | static inline pmdval_t pmd_flags_mask(pmd_t pmd) |
309 | { | 306 | { |
310 | if (native_pmd_val(pmd) & _PAGE_PSE) | 307 | return ~pmd_pfn_mask(pmd); |
311 | return ~(PMD_PAGE_MASK & (pmdval_t)PHYSICAL_PAGE_MASK); | ||
312 | else | ||
313 | return ~PTE_PFN_MASK; | ||
314 | } | 308 | } |
315 | 309 | ||
316 | static inline pmdval_t pmd_flags(pmd_t pmd) | 310 | static inline pmdval_t pmd_flags(pmd_t pmd) |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 48d34d28f5a6..cd0fc0cc78bc 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _ASM_X86_PLATFORM_H | 1 | #ifndef _ASM_X86_PLATFORM_H |
2 | #define _ASM_X86_PLATFORM_H | 2 | #define _ASM_X86_PLATFORM_H |
3 | 3 | ||
4 | #include <asm/pgtable_types.h> | ||
5 | #include <asm/bootparam.h> | 4 | #include <asm/bootparam.h> |
6 | 5 | ||
7 | struct mpc_bus; | 6 | struct mpc_bus; |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 7fc27f1cca58..b3e94ef461fd 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c | |||
@@ -698,3 +698,4 @@ int __init microcode_init(void) | |||
698 | return error; | 698 | return error; |
699 | 699 | ||
700 | } | 700 | } |
701 | late_initcall(microcode_init); | ||
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 29db25f9a745..d2bbe343fda7 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1250,8 +1250,6 @@ void __init setup_arch(char **cmdline_p) | |||
1250 | if (efi_enabled(EFI_BOOT)) | 1250 | if (efi_enabled(EFI_BOOT)) |
1251 | efi_apply_memmap_quirks(); | 1251 | efi_apply_memmap_quirks(); |
1252 | #endif | 1252 | #endif |
1253 | |||
1254 | microcode_init(); | ||
1255 | } | 1253 | } |
1256 | 1254 | ||
1257 | #ifdef CONFIG_X86_32 | 1255 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index b7ffb7c00075..cb6282c3638f 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -690,12 +690,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) | |||
690 | signal_setup_done(failed, ksig, stepping); | 690 | signal_setup_done(failed, ksig, stepping); |
691 | } | 691 | } |
692 | 692 | ||
693 | #ifdef CONFIG_X86_32 | 693 | static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs) |
694 | #define NR_restart_syscall __NR_restart_syscall | 694 | { |
695 | #else /* !CONFIG_X86_32 */ | 695 | #if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64) |
696 | #define NR_restart_syscall \ | 696 | return __NR_restart_syscall; |
697 | test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall | 697 | #else /* !CONFIG_X86_32 && CONFIG_X86_64 */ |
698 | #endif /* CONFIG_X86_32 */ | 698 | return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : |
699 | __NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT); | ||
700 | #endif /* CONFIG_X86_32 || !CONFIG_X86_64 */ | ||
701 | } | ||
699 | 702 | ||
700 | /* | 703 | /* |
701 | * Note that 'init' is a special process: it doesn't get signals it doesn't | 704 | * Note that 'init' is a special process: it doesn't get signals it doesn't |
@@ -724,7 +727,7 @@ void do_signal(struct pt_regs *regs) | |||
724 | break; | 727 | break; |
725 | 728 | ||
726 | case -ERESTART_RESTARTBLOCK: | 729 | case -ERESTART_RESTARTBLOCK: |
727 | regs->ax = NR_restart_syscall; | 730 | regs->ax = get_nr_restart_syscall(regs); |
728 | regs->ip -= 2; | 731 | regs->ip -= 2; |
729 | break; | 732 | break; |
730 | } | 733 | } |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 892ee2e5ecbc..fbabe4fcc7fb 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -509,7 +509,7 @@ void __inquire_remote_apic(int apicid) | |||
509 | */ | 509 | */ |
510 | #define UDELAY_10MS_DEFAULT 10000 | 510 | #define UDELAY_10MS_DEFAULT 10000 |
511 | 511 | ||
512 | static unsigned int init_udelay = INT_MAX; | 512 | static unsigned int init_udelay = UINT_MAX; |
513 | 513 | ||
514 | static int __init cpu_init_udelay(char *str) | 514 | static int __init cpu_init_udelay(char *str) |
515 | { | 515 | { |
@@ -522,14 +522,15 @@ early_param("cpu_init_udelay", cpu_init_udelay); | |||
522 | static void __init smp_quirk_init_udelay(void) | 522 | static void __init smp_quirk_init_udelay(void) |
523 | { | 523 | { |
524 | /* if cmdline changed it from default, leave it alone */ | 524 | /* if cmdline changed it from default, leave it alone */ |
525 | if (init_udelay != INT_MAX) | 525 | if (init_udelay != UINT_MAX) |
526 | return; | 526 | return; |
527 | 527 | ||
528 | /* if modern processor, use no delay */ | 528 | /* if modern processor, use no delay */ |
529 | if (((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 6)) || | 529 | if (((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 6)) || |
530 | ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && (boot_cpu_data.x86 >= 0xF))) | 530 | ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && (boot_cpu_data.x86 >= 0xF))) { |
531 | init_udelay = 0; | 531 | init_udelay = 0; |
532 | 532 | return; | |
533 | } | ||
533 | /* else, use legacy delay */ | 534 | /* else, use legacy delay */ |
534 | init_udelay = UDELAY_10MS_DEFAULT; | 535 | init_udelay = UDELAY_10MS_DEFAULT; |
535 | } | 536 | } |
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c index 1202d5ca2fb5..b2fd67da1701 100644 --- a/arch/x86/mm/mpx.c +++ b/arch/x86/mm/mpx.c | |||
@@ -101,19 +101,19 @@ static int get_reg_offset(struct insn *insn, struct pt_regs *regs, | |||
101 | switch (type) { | 101 | switch (type) { |
102 | case REG_TYPE_RM: | 102 | case REG_TYPE_RM: |
103 | regno = X86_MODRM_RM(insn->modrm.value); | 103 | regno = X86_MODRM_RM(insn->modrm.value); |
104 | if (X86_REX_B(insn->rex_prefix.value) == 1) | 104 | if (X86_REX_B(insn->rex_prefix.value)) |
105 | regno += 8; | 105 | regno += 8; |
106 | break; | 106 | break; |
107 | 107 | ||
108 | case REG_TYPE_INDEX: | 108 | case REG_TYPE_INDEX: |
109 | regno = X86_SIB_INDEX(insn->sib.value); | 109 | regno = X86_SIB_INDEX(insn->sib.value); |
110 | if (X86_REX_X(insn->rex_prefix.value) == 1) | 110 | if (X86_REX_X(insn->rex_prefix.value)) |
111 | regno += 8; | 111 | regno += 8; |
112 | break; | 112 | break; |
113 | 113 | ||
114 | case REG_TYPE_BASE: | 114 | case REG_TYPE_BASE: |
115 | regno = X86_SIB_BASE(insn->sib.value); | 115 | regno = X86_SIB_BASE(insn->sib.value); |
116 | if (X86_REX_B(insn->rex_prefix.value) == 1) | 116 | if (X86_REX_B(insn->rex_prefix.value)) |
117 | regno += 8; | 117 | regno += 8; |
118 | break; | 118 | break; |
119 | 119 | ||