Skip to content

Commit 70ad636

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 Ingo Molnar: "The biggest part is a series of reverts for the macro based GCC inlining workarounds. It caused regressions in distro build and other kernel tooling environments, and the GCC project was very receptive to fixing the underlying inliner weaknesses - so as time ran out we decided to do a reasonably straightforward revert of the patches. The plan is to rely on the 'asm inline' GCC 9 feature, which might be backported to GCC 8 and could thus become reasonably widely available on modern distros. Other than those reverts, there's misc fixes from all around the place. I wish our final x86 pull request for v4.20 was smaller..." * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: Revert "kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs" Revert "x86/objtool: Use asm macros to work around GCC inlining bugs" Revert "x86/refcount: Work around GCC inlining bug" Revert "x86/alternatives: Macrofy lock prefixes to work around GCC inlining bugs" Revert "x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs" Revert "x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops" Revert "x86/extable: Macrofy inline assembly code to work around GCC inlining bugs" Revert "x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs" Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs" x86/mtrr: Don't copy uninitialized gentry fields back to userspace x86/fsgsbase/64: Fix the base write helper functions x86/mm/cpa: Fix cpa_flush_array() TLB invalidation x86/vdso: Pass --eh-frame-hdr to the linker x86/mm: Fix decoy address handling vs 32-bit builds x86/intel_rdt: Ensure a CPU remains online for the region's pseudo-locking sequence x86/dump_pagetables: Fix LDT remap address marker x86/mm: Fix guard hole handling
2 parents 96d6ee7 + 6ac3893 commit 70ad636

27 files changed

+385
-392
lines changed

Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ scripts: scripts_basic scripts_dtc asm-generic gcc-plugins $(autoksyms_h)
10761076
# version.h and scripts_basic is processed / created.
10771077

10781078
# Listed in dependency order
1079-
PHONY += prepare archprepare macroprepare prepare0 prepare1 prepare2 prepare3
1079+
PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
10801080

10811081
# prepare3 is used to check if we are building in a separate output directory,
10821082
# and if so do:
@@ -1099,9 +1099,7 @@ prepare2: prepare3 outputmakefile asm-generic
10991099
prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h
11001100
$(cmd_crmodverdir)
11011101

1102-
macroprepare: prepare1 archmacros
1103-
1104-
archprepare: archheaders archscripts macroprepare scripts_basic
1102+
archprepare: archheaders archscripts prepare1 scripts_basic
11051103

11061104
prepare0: archprepare gcc-plugins
11071105
$(Q)$(MAKE) $(build)=.
@@ -1177,9 +1175,6 @@ archheaders:
11771175
PHONY += archscripts
11781176
archscripts:
11791177

1180-
PHONY += archmacros
1181-
archmacros:
1182-
11831178
PHONY += __headers
11841179
__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
11851180
$(Q)$(MAKE) $(build)=scripts build_unifdef

arch/x86/Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,6 @@ archscripts: scripts_basic
232232
archheaders:
233233
$(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all
234234

235-
archmacros:
236-
$(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s
237-
238-
ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s
239-
export ASM_MACRO_FLAGS
240-
KBUILD_CFLAGS += $(ASM_MACRO_FLAGS)
241-
242235
###
243236
# Kernel objects
244237

arch/x86/entry/calling.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ For 32-bit we have the following conventions - kernel is built with
352352
.macro CALL_enter_from_user_mode
353353
#ifdef CONFIG_CONTEXT_TRACKING
354354
#ifdef HAVE_JUMP_LABEL
355-
STATIC_BRANCH_JMP l_yes=.Lafter_call_\@, key=context_tracking_enabled, branch=1
355+
STATIC_JUMP_IF_FALSE .Lafter_call_\@, context_tracking_enabled, def=0
356356
#endif
357357
call enter_from_user_mode
358358
.Lafter_call_\@:

arch/x86/entry/vdso/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ quiet_cmd_vdso = VDSO $@
171171
sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
172172

173173
VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \
174-
$(call ld-option, --build-id) -Bsymbolic
174+
$(call ld-option, --build-id) $(call ld-option, --eh-frame-hdr) \
175+
-Bsymbolic
175176
GCOV_PROFILE := n
176177

177178
#

arch/x86/include/asm/alternative-asm.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,16 @@
77
#include <asm/asm.h>
88

99
#ifdef CONFIG_SMP
10-
.macro LOCK_PREFIX_HERE
10+
.macro LOCK_PREFIX
11+
672: lock
1112
.pushsection .smp_locks,"a"
1213
.balign 4
13-
.long 671f - . # offset
14+
.long 672b - .
1415
.popsection
15-
671:
16-
.endm
17-
18-
.macro LOCK_PREFIX insn:vararg
19-
LOCK_PREFIX_HERE
20-
lock \insn
21-
.endm
16+
.endm
2217
#else
23-
.macro LOCK_PREFIX_HERE
24-
.endm
25-
26-
.macro LOCK_PREFIX insn:vararg
27-
.endm
18+
.macro LOCK_PREFIX
19+
.endm
2820
#endif
2921

3022
/*

arch/x86/include/asm/alternative.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,15 @@
3131
*/
3232

3333
#ifdef CONFIG_SMP
34-
#define LOCK_PREFIX_HERE "LOCK_PREFIX_HERE\n\t"
35-
#define LOCK_PREFIX "LOCK_PREFIX "
34+
#define LOCK_PREFIX_HERE \
35+
".pushsection .smp_locks,\"a\"\n" \
36+
".balign 4\n" \
37+
".long 671f - .\n" /* offset */ \
38+
".popsection\n" \
39+
"671:"
40+
41+
#define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; "
42+
3643
#else /* ! CONFIG_SMP */
3744
#define LOCK_PREFIX_HERE ""
3845
#define LOCK_PREFIX ""

arch/x86/include/asm/asm.h

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,12 @@
120120
/* Exception table entry */
121121
#ifdef __ASSEMBLY__
122122
# define _ASM_EXTABLE_HANDLE(from, to, handler) \
123-
ASM_EXTABLE_HANDLE from to handler
124-
125-
.macro ASM_EXTABLE_HANDLE from:req to:req handler:req
126-
.pushsection "__ex_table","a"
127-
.balign 4
128-
.long (\from) - .
129-
.long (\to) - .
130-
.long (\handler) - .
123+
.pushsection "__ex_table","a" ; \
124+
.balign 4 ; \
125+
.long (from) - . ; \
126+
.long (to) - . ; \
127+
.long (handler) - . ; \
131128
.popsection
132-
.endm
133-
#else /* __ASSEMBLY__ */
134-
135-
# define _ASM_EXTABLE_HANDLE(from, to, handler) \
136-
"ASM_EXTABLE_HANDLE from=" #from " to=" #to \
137-
" handler=\"" #handler "\"\n\t"
138-
139-
/* For C file, we already have NOKPROBE_SYMBOL macro */
140-
141-
#endif /* __ASSEMBLY__ */
142129

143130
# define _ASM_EXTABLE(from, to) \
144131
_ASM_EXTABLE_HANDLE(from, to, ex_handler_default)
@@ -161,7 +148,6 @@
161148
_ASM_PTR (entry); \
162149
.popsection
163150

164-
#ifdef __ASSEMBLY__
165151
.macro ALIGN_DESTINATION
166152
/* check for bad alignment of destination */
167153
movl %edi,%ecx
@@ -185,7 +171,34 @@
185171
_ASM_EXTABLE_UA(100b, 103b)
186172
_ASM_EXTABLE_UA(101b, 103b)
187173
.endm
188-
#endif /* __ASSEMBLY__ */
174+
175+
#else
176+
# define _EXPAND_EXTABLE_HANDLE(x) #x
177+
# define _ASM_EXTABLE_HANDLE(from, to, handler) \
178+
" .pushsection \"__ex_table\",\"a\"\n" \
179+
" .balign 4\n" \
180+
" .long (" #from ") - .\n" \
181+
" .long (" #to ") - .\n" \
182+
" .long (" _EXPAND_EXTABLE_HANDLE(handler) ") - .\n" \
183+
" .popsection\n"
184+
185+
# define _ASM_EXTABLE(from, to) \
186+
_ASM_EXTABLE_HANDLE(from, to, ex_handler_default)
187+
188+
# define _ASM_EXTABLE_UA(from, to) \
189+
_ASM_EXTABLE_HANDLE(from, to, ex_handler_uaccess)
190+
191+
# define _ASM_EXTABLE_FAULT(from, to) \
192+
_ASM_EXTABLE_HANDLE(from, to, ex_handler_fault)
193+
194+
# define _ASM_EXTABLE_EX(from, to) \
195+
_ASM_EXTABLE_HANDLE(from, to, ex_handler_ext)
196+
197+
# define _ASM_EXTABLE_REFCOUNT(from, to) \
198+
_ASM_EXTABLE_HANDLE(from, to, ex_handler_refcount)
199+
200+
/* For C file, we already have NOKPROBE_SYMBOL macro */
201+
#endif
189202

190203
#ifndef __ASSEMBLY__
191204
/*

arch/x86/include/asm/bug.h

Lines changed: 42 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
#include <linux/stringify.h>
66

7-
#ifndef __ASSEMBLY__
8-
97
/*
108
* Despite that some emulators terminate on UD2, we use it for WARN().
119
*
@@ -22,15 +20,53 @@
2220

2321
#define LEN_UD2 2
2422

23+
#ifdef CONFIG_GENERIC_BUG
24+
25+
#ifdef CONFIG_X86_32
26+
# define __BUG_REL(val) ".long " __stringify(val)
27+
#else
28+
# define __BUG_REL(val) ".long " __stringify(val) " - 2b"
29+
#endif
30+
31+
#ifdef CONFIG_DEBUG_BUGVERBOSE
32+
33+
#define _BUG_FLAGS(ins, flags) \
34+
do { \
35+
asm volatile("1:\t" ins "\n" \
36+
".pushsection __bug_table,\"aw\"\n" \
37+
"2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
38+
"\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \
39+
"\t.word %c1" "\t# bug_entry::line\n" \
40+
"\t.word %c2" "\t# bug_entry::flags\n" \
41+
"\t.org 2b+%c3\n" \
42+
".popsection" \
43+
: : "i" (__FILE__), "i" (__LINE__), \
44+
"i" (flags), \
45+
"i" (sizeof(struct bug_entry))); \
46+
} while (0)
47+
48+
#else /* !CONFIG_DEBUG_BUGVERBOSE */
49+
2550
#define _BUG_FLAGS(ins, flags) \
2651
do { \
27-
asm volatile("ASM_BUG ins=\"" ins "\" file=%c0 line=%c1 " \
28-
"flags=%c2 size=%c3" \
29-
: : "i" (__FILE__), "i" (__LINE__), \
30-
"i" (flags), \
52+
asm volatile("1:\t" ins "\n" \
53+
".pushsection __bug_table,\"aw\"\n" \
54+
"2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
55+
"\t.word %c0" "\t# bug_entry::flags\n" \
56+
"\t.org 2b+%c1\n" \
57+
".popsection" \
58+
: : "i" (flags), \
3159
"i" (sizeof(struct bug_entry))); \
3260
} while (0)
3361

62+
#endif /* CONFIG_DEBUG_BUGVERBOSE */
63+
64+
#else
65+
66+
#define _BUG_FLAGS(ins, flags) asm volatile(ins)
67+
68+
#endif /* CONFIG_GENERIC_BUG */
69+
3470
#define HAVE_ARCH_BUG
3571
#define BUG() \
3672
do { \
@@ -46,54 +82,4 @@ do { \
4682

4783
#include <asm-generic/bug.h>
4884

49-
#else /* __ASSEMBLY__ */
50-
51-
#ifdef CONFIG_GENERIC_BUG
52-
53-
#ifdef CONFIG_X86_32
54-
.macro __BUG_REL val:req
55-
.long \val
56-
.endm
57-
#else
58-
.macro __BUG_REL val:req
59-
.long \val - 2b
60-
.endm
61-
#endif
62-
63-
#ifdef CONFIG_DEBUG_BUGVERBOSE
64-
65-
.macro ASM_BUG ins:req file:req line:req flags:req size:req
66-
1: \ins
67-
.pushsection __bug_table,"aw"
68-
2: __BUG_REL val=1b # bug_entry::bug_addr
69-
__BUG_REL val=\file # bug_entry::file
70-
.word \line # bug_entry::line
71-
.word \flags # bug_entry::flags
72-
.org 2b+\size
73-
.popsection
74-
.endm
75-
76-
#else /* !CONFIG_DEBUG_BUGVERBOSE */
77-
78-
.macro ASM_BUG ins:req file:req line:req flags:req size:req
79-
1: \ins
80-
.pushsection __bug_table,"aw"
81-
2: __BUG_REL val=1b # bug_entry::bug_addr
82-
.word \flags # bug_entry::flags
83-
.org 2b+\size
84-
.popsection
85-
.endm
86-
87-
#endif /* CONFIG_DEBUG_BUGVERBOSE */
88-
89-
#else /* CONFIG_GENERIC_BUG */
90-
91-
.macro ASM_BUG ins:req file:req line:req flags:req size:req
92-
\ins
93-
.endm
94-
95-
#endif /* CONFIG_GENERIC_BUG */
96-
97-
#endif /* __ASSEMBLY__ */
98-
9985
#endif /* _ASM_X86_BUG_H */

0 commit comments

Comments
 (0)