Skip to content

Commit 34be751

Browse files
author
Ingo Molnar
committed
Merge branch 'x86/mm' into x86/core, to resolve conflicts
Conflicts: arch/x86/mm/numa.c arch/x86/mm/pgtable.c Signed-off-by: Ingo Molnar <[email protected]>
2 parents 69cb33e + 1b3f2bd commit 34be751

File tree

25 files changed

+130
-331
lines changed

25 files changed

+130
-331
lines changed

arch/x86/Kconfig.assembler

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ config AS_SHA256_NI
1515
def_bool $(as-instr,sha256msg1 %xmm0$(comma)%xmm1)
1616
help
1717
Supported by binutils >= 2.24 and LLVM integrated assembler
18-
config AS_TPAUSE
19-
def_bool $(as-instr,tpause %ecx)
20-
help
21-
Supported by binutils >= 2.31.1 and LLVM integrated assembler >= V7
2218

2319
config AS_GFNI
2420
def_bool $(as-instr,vgf2p8mulb %xmm0$(comma)%xmm1$(comma)%xmm2)

arch/x86/include/asm/mwait.h

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,31 @@
2525
#define TPAUSE_C01_STATE 1
2626
#define TPAUSE_C02_STATE 0
2727

28-
static __always_inline void __monitor(const void *eax, unsigned long ecx,
29-
unsigned long edx)
28+
static __always_inline void __monitor(const void *eax, u32 ecx, u32 edx)
3029
{
31-
/* "monitor %eax, %ecx, %edx;" */
32-
asm volatile(".byte 0x0f, 0x01, 0xc8;"
33-
:: "a" (eax), "c" (ecx), "d"(edx));
30+
/*
31+
* Use the instruction mnemonic with implicit operands, as the LLVM
32+
* assembler fails to assemble the mnemonic with explicit operands:
33+
*/
34+
asm volatile("monitor" :: "a" (eax), "c" (ecx), "d" (edx));
3435
}
3536

36-
static __always_inline void __monitorx(const void *eax, unsigned long ecx,
37-
unsigned long edx)
37+
static __always_inline void __monitorx(const void *eax, u32 ecx, u32 edx)
3838
{
39-
/* "monitorx %eax, %ecx, %edx;" */
40-
asm volatile(".byte 0x0f, 0x01, 0xfa;"
39+
/* "monitorx %eax, %ecx, %edx" */
40+
asm volatile(".byte 0x0f, 0x01, 0xfa"
4141
:: "a" (eax), "c" (ecx), "d"(edx));
4242
}
4343

44-
static __always_inline void __mwait(unsigned long eax, unsigned long ecx)
44+
static __always_inline void __mwait(u32 eax, u32 ecx)
4545
{
4646
mds_idle_clear_cpu_buffers();
4747

48-
/* "mwait %eax, %ecx;" */
49-
asm volatile(".byte 0x0f, 0x01, 0xc9;"
50-
:: "a" (eax), "c" (ecx));
48+
/*
49+
* Use the instruction mnemonic with implicit operands, as the LLVM
50+
* assembler fails to assemble the mnemonic with explicit operands:
51+
*/
52+
asm volatile("mwait" :: "a" (eax), "c" (ecx));
5153
}
5254

5355
/*
@@ -76,13 +78,12 @@ static __always_inline void __mwait(unsigned long eax, unsigned long ecx)
7678
* EAX (logical) address to monitor
7779
* ECX #GP if not zero
7880
*/
79-
static __always_inline void __mwaitx(unsigned long eax, unsigned long ebx,
80-
unsigned long ecx)
81+
static __always_inline void __mwaitx(u32 eax, u32 ebx, u32 ecx)
8182
{
8283
/* No MDS buffer clear as this is AMD/HYGON only */
8384

84-
/* "mwaitx %eax, %ebx, %ecx;" */
85-
asm volatile(".byte 0x0f, 0x01, 0xfb;"
85+
/* "mwaitx %eax, %ebx, %ecx" */
86+
asm volatile(".byte 0x0f, 0x01, 0xfb"
8687
:: "a" (eax), "b" (ebx), "c" (ecx));
8788
}
8889

@@ -95,12 +96,11 @@ static __always_inline void __mwaitx(unsigned long eax, unsigned long ebx,
9596
* executing mwait, it would otherwise go unnoticed and the next tick
9697
* would not be reprogrammed accordingly before mwait ever wakes up.
9798
*/
98-
static __always_inline void __sti_mwait(unsigned long eax, unsigned long ecx)
99+
static __always_inline void __sti_mwait(u32 eax, u32 ecx)
99100
{
100101
mds_idle_clear_cpu_buffers();
101-
/* "mwait %eax, %ecx;" */
102-
asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
103-
:: "a" (eax), "c" (ecx));
102+
103+
asm volatile("sti; mwait" :: "a" (eax), "c" (ecx));
104104
}
105105

106106
/*
@@ -113,16 +113,13 @@ static __always_inline void __sti_mwait(unsigned long eax, unsigned long ecx)
113113
* New with Core Duo processors, MWAIT can take some hints based on CPU
114114
* capability.
115115
*/
116-
static __always_inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
116+
static __always_inline void mwait_idle_with_hints(u32 eax, u32 ecx)
117117
{
118118
if (static_cpu_has_bug(X86_BUG_MONITOR) || !current_set_polling_and_test()) {
119-
if (static_cpu_has_bug(X86_BUG_CLFLUSH_MONITOR)) {
120-
mb();
121-
clflush((void *)&current_thread_info()->flags);
122-
mb();
123-
}
119+
const void *addr = &current_thread_info()->flags;
124120

125-
__monitor((void *)&current_thread_info()->flags, 0, 0);
121+
alternative_input("", "clflush (%[addr])", X86_BUG_CLFLUSH_MONITOR, [addr] "a" (addr));
122+
__monitor(addr, 0, 0);
126123

127124
if (!need_resched()) {
128125
if (ecx & 1) {
@@ -144,16 +141,9 @@ static __always_inline void mwait_idle_with_hints(unsigned long eax, unsigned lo
144141
*/
145142
static inline void __tpause(u32 ecx, u32 edx, u32 eax)
146143
{
147-
/* "tpause %ecx, %edx, %eax;" */
148-
#ifdef CONFIG_AS_TPAUSE
149-
asm volatile("tpause %%ecx\n"
150-
:
151-
: "c"(ecx), "d"(edx), "a"(eax));
152-
#else
153-
asm volatile(".byte 0x66, 0x0f, 0xae, 0xf1\t\n"
154-
:
155-
: "c"(ecx), "d"(edx), "a"(eax));
156-
#endif
144+
/* "tpause %ecx" */
145+
asm volatile(".byte 0x66, 0x0f, 0xae, 0xf1"
146+
:: "c" (ecx), "d" (edx), "a" (eax));
157147
}
158148

159149
#endif /* _ASM_X86_MWAIT_H */

arch/x86/include/asm/page_32_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ extern unsigned int __VMALLOC_RESERVE;
7373
extern int sysctl_legacy_va_layout;
7474

7575
extern void find_low_pfn_range(void);
76-
extern void setup_bootmem_allocator(void);
7776

7877
#endif /* !__ASSEMBLER__ */
7978

arch/x86/include/asm/pgtable-2level_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ typedef union {
1818
} pte_t;
1919
#endif /* !__ASSEMBLER__ */
2020

21-
#define SHARED_KERNEL_PMD 0
22-
2321
#define ARCH_PAGE_TABLE_SYNC_MASK PGTBL_PMD_MODIFIED
2422

2523
/*

arch/x86/include/asm/pgtable-3level_types.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ typedef union {
2727
} pmd_t;
2828
#endif /* !__ASSEMBLER__ */
2929

30-
#define SHARED_KERNEL_PMD (!static_cpu_has(X86_FEATURE_PTI))
31-
32-
#define ARCH_PAGE_TABLE_SYNC_MASK (SHARED_KERNEL_PMD ? 0 : PGTBL_PMD_MODIFIED)
30+
#define ARCH_PAGE_TABLE_SYNC_MASK PGTBL_PMD_MODIFIED
3331

3432
/*
3533
* PGDIR_SHIFT determines what a top-level page table entry can map

arch/x86/include/asm/pgtable.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,6 @@ static inline unsigned long pgd_pfn(pgd_t pgd)
292292
return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT;
293293
}
294294

295-
#define p4d_leaf p4d_leaf
296-
static inline bool p4d_leaf(p4d_t p4d)
297-
{
298-
/* No 512 GiB pages yet */
299-
return 0;
300-
}
301-
302295
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
303296

304297
#define pmd_leaf pmd_leaf
@@ -1472,9 +1465,6 @@ static inline bool pgdp_maps_userspace(void *__ptr)
14721465
return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START);
14731466
}
14741467

1475-
#define pgd_leaf pgd_leaf
1476-
static inline bool pgd_leaf(pgd_t pgd) { return false; }
1477-
14781468
#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
14791469
/*
14801470
* All top-level MITIGATION_PAGE_TABLE_ISOLATION page tables are order-1 pages

arch/x86/include/asm/pgtable_64_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ extern unsigned int ptrs_per_p4d;
4646

4747
#endif /* !__ASSEMBLER__ */
4848

49-
#define SHARED_KERNEL_PMD 0
50-
5149
#ifdef CONFIG_X86_5LEVEL
5250

5351
/*

arch/x86/kernel/process.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -901,13 +901,10 @@ static __init bool prefer_mwait_c1_over_halt(void)
901901
static __cpuidle void mwait_idle(void)
902902
{
903903
if (!current_set_polling_and_test()) {
904-
if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
905-
mb(); /* quirk */
906-
clflush((void *)&current_thread_info()->flags);
907-
mb(); /* quirk */
908-
}
904+
const void *addr = &current_thread_info()->flags;
909905

910-
__monitor((void *)&current_thread_info()->flags, 0, 0);
906+
alternative_input("", "clflush (%[addr])", X86_BUG_CLFLUSH_MONITOR, [addr] "a" (addr));
907+
__monitor(addr, 0, 0);
911908
if (!need_resched()) {
912909
__sti_mwait(0, 0);
913910
raw_local_irq_disable();

arch/x86/mm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ obj-$(CONFIG_MMIOTRACE) += mmiotrace.o
4747
mmiotrace-y := kmmio.o pf_in.o mmio-mod.o
4848
obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o
4949

50-
obj-$(CONFIG_NUMA) += numa.o numa_$(BITS).o
50+
obj-$(CONFIG_NUMA) += numa.o
5151
obj-$(CONFIG_AMD_NUMA) += amdtopology.o
5252
obj-$(CONFIG_ACPI_NUMA) += srat.o
5353

arch/x86/mm/fault.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/mmiotrace.h> /* kmmio_handler, ... */
1414
#include <linux/perf_event.h> /* perf_sw_event */
1515
#include <linux/hugetlb.h> /* hstate_index_to_shift */
16-
#include <linux/prefetch.h> /* prefetchw */
1716
#include <linux/context_tracking.h> /* exception_enter(), ... */
1817
#include <linux/uaccess.h> /* faulthandler_disabled() */
1918
#include <linux/efi.h> /* efi_crash_gracefully_on_page_fault()*/
@@ -1496,8 +1495,6 @@ DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault)
14961495

14971496
address = cpu_feature_enabled(X86_FEATURE_FRED) ? fred_event_data(regs) : read_cr2();
14981497

1499-
prefetchw(&current->mm->mmap_lock);
1500-
15011498
/*
15021499
* KVM uses #PF vector to deliver 'page not present' events to guests
15031500
* (asynchronous page fault mechanism). The event happens when a

0 commit comments

Comments
 (0)