Skip to content

Commit 69d2ca6

Browse files
committed
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
2 parents 19190f5 + 22eab11 commit 69d2ca6

File tree

12 files changed

+54
-36
lines changed

12 files changed

+54
-36
lines changed

arch/x86/boot/boot.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <stdarg.h>
2424
#include <linux/types.h>
2525
#include <linux/edd.h>
26-
#include <asm/boot.h>
2726
#include <asm/setup.h>
2827
#include "bitops.h"
2928
#include "ctype.h"

arch/x86/boot/video-mode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "video.h"
2020
#include "vesa.h"
2121

22+
#include <uapi/asm/boot.h>
23+
2224
/*
2325
* Common variables
2426
*/

arch/x86/boot/video.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Select video mode
1414
*/
1515

16+
#include <uapi/asm/boot.h>
17+
1618
#include "boot.h"
1719
#include "video.h"
1820
#include "vesa.h"

arch/x86/entry/entry_64.S

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@ END(irq_entries_start)
509509
* tracking that we're in kernel mode.
510510
*/
511511
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+
512523
#ifdef CONFIG_CONTEXT_TRACKING
513524
call enter_from_user_mode
514525
#endif
@@ -1049,12 +1060,18 @@ ENTRY(error_entry)
10491060
SWAPGS
10501061

10511062
.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
10521069
#ifdef CONFIG_CONTEXT_TRACKING
10531070
call enter_from_user_mode
10541071
#endif
1072+
ret
10551073

10561074
.Lerror_entry_done:
1057-
10581075
TRACE_IRQS_OFF
10591076
ret
10601077

arch/x86/include/asm/page_types.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
1010
#define PAGE_MASK (~(PAGE_SIZE-1))
1111

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+
1218
#define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))
1319
#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
1420

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
1622
virtual addresses are 32-bits but physical addresses are larger
1723
(ie, 32-bit PAE). */
1824
#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
19-
20-
#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
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+
#define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK)
26+
#define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)
2527

2628
#define HPAGE_SHIFT PMD_SHIFT
2729
#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)

arch/x86/include/asm/pgtable_types.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,17 +279,14 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
279279
static inline pudval_t pud_pfn_mask(pud_t pud)
280280
{
281281
if (native_pud_val(pud) & _PAGE_PSE)
282-
return PUD_PAGE_MASK & PHYSICAL_PAGE_MASK;
282+
return PHYSICAL_PUD_PAGE_MASK;
283283
else
284284
return PTE_PFN_MASK;
285285
}
286286

287287
static inline pudval_t pud_flags_mask(pud_t pud)
288288
{
289-
if (native_pud_val(pud) & _PAGE_PSE)
290-
return ~(PUD_PAGE_MASK & (pudval_t)PHYSICAL_PAGE_MASK);
291-
else
292-
return ~PTE_PFN_MASK;
289+
return ~pud_pfn_mask(pud);
293290
}
294291

295292
static inline pudval_t pud_flags(pud_t pud)
@@ -300,17 +297,14 @@ static inline pudval_t pud_flags(pud_t pud)
300297
static inline pmdval_t pmd_pfn_mask(pmd_t pmd)
301298
{
302299
if (native_pmd_val(pmd) & _PAGE_PSE)
303-
return PMD_PAGE_MASK & PHYSICAL_PAGE_MASK;
300+
return PHYSICAL_PMD_PAGE_MASK;
304301
else
305302
return PTE_PFN_MASK;
306303
}
307304

308305
static inline pmdval_t pmd_flags_mask(pmd_t pmd)
309306
{
310-
if (native_pmd_val(pmd) & _PAGE_PSE)
311-
return ~(PMD_PAGE_MASK & (pmdval_t)PHYSICAL_PAGE_MASK);
312-
else
313-
return ~PTE_PFN_MASK;
307+
return ~pmd_pfn_mask(pmd);
314308
}
315309

316310
static inline pmdval_t pmd_flags(pmd_t pmd)

arch/x86/include/asm/x86_init.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef _ASM_X86_PLATFORM_H
22
#define _ASM_X86_PLATFORM_H
33

4-
#include <asm/pgtable_types.h>
54
#include <asm/bootparam.h>
65

76
struct mpc_bus;

arch/x86/kernel/cpu/microcode/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,3 +698,4 @@ int __init microcode_init(void)
698698
return error;
699699

700700
}
701+
late_initcall(microcode_init);

arch/x86/kernel/setup.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,8 +1250,6 @@ void __init setup_arch(char **cmdline_p)
12501250
if (efi_enabled(EFI_BOOT))
12511251
efi_apply_memmap_quirks();
12521252
#endif
1253-
1254-
microcode_init();
12551253
}
12561254

12571255
#ifdef CONFIG_X86_32

arch/x86/kernel/signal.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
690690
signal_setup_done(failed, ksig, stepping);
691691
}
692692

693-
#ifdef CONFIG_X86_32
694-
#define NR_restart_syscall __NR_restart_syscall
695-
#else /* !CONFIG_X86_32 */
696-
#define NR_restart_syscall \
697-
test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
698-
#endif /* CONFIG_X86_32 */
693+
static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
694+
{
695+
#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
696+
return __NR_restart_syscall;
697+
#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
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+
}
699702

700703
/*
701704
* 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)
724727
break;
725728

726729
case -ERESTART_RESTARTBLOCK:
727-
regs->ax = NR_restart_syscall;
730+
regs->ax = get_nr_restart_syscall(regs);
728731
regs->ip -= 2;
729732
break;
730733
}

arch/x86/kernel/smpboot.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ void __inquire_remote_apic(int apicid)
509509
*/
510510
#define UDELAY_10MS_DEFAULT 10000
511511

512-
static unsigned int init_udelay = INT_MAX;
512+
static unsigned int init_udelay = UINT_MAX;
513513

514514
static int __init cpu_init_udelay(char *str)
515515
{
@@ -522,14 +522,15 @@ early_param("cpu_init_udelay", cpu_init_udelay);
522522
static void __init smp_quirk_init_udelay(void)
523523
{
524524
/* if cmdline changed it from default, leave it alone */
525-
if (init_udelay != INT_MAX)
525+
if (init_udelay != UINT_MAX)
526526
return;
527527

528528
/* if modern processor, use no delay */
529529
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))) {
531531
init_udelay = 0;
532-
532+
return;
533+
}
533534
/* else, use legacy delay */
534535
init_udelay = UDELAY_10MS_DEFAULT;
535536
}

arch/x86/mm/mpx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,19 @@ static int get_reg_offset(struct insn *insn, struct pt_regs *regs,
101101
switch (type) {
102102
case REG_TYPE_RM:
103103
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))
105105
regno += 8;
106106
break;
107107

108108
case REG_TYPE_INDEX:
109109
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))
111111
regno += 8;
112112
break;
113113

114114
case REG_TYPE_BASE:
115115
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))
117117
regno += 8;
118118
break;
119119

0 commit comments

Comments
 (0)