Skip to content

Commit 0fd2e9c

Browse files
author
Ingo Molnar
committed
Merge commit 'upstream-x86-entry' into WIP.x86/mm
Pull in a minimal set of v4.15 entry code changes, for a base for the MM isolation patches. Signed-off-by: Ingo Molnar <[email protected]>
2 parents 1784f91 + 1e4c4f6 commit 0fd2e9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+579
-361
lines changed

Documentation/x86/orc-unwinder.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ORC unwinder
44
Overview
55
--------
66

7-
The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is
7+
The kernel CONFIG_UNWINDER_ORC option enables the ORC unwinder, which is
88
similar in concept to a DWARF unwinder. The difference is that the
99
format of the ORC data is much simpler than DWARF, which in turn allows
1010
the ORC unwinder to be much simpler and faster.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,8 @@ ifdef CONFIG_STACK_VALIDATION
934934
ifeq ($(has_libelf),1)
935935
objtool_target := tools/objtool FORCE
936936
else
937-
ifdef CONFIG_ORC_UNWINDER
938-
$(error "Cannot generate ORC metadata for CONFIG_ORC_UNWINDER=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
937+
ifdef CONFIG_UNWINDER_ORC
938+
$(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
939939
else
940940
$(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
941941
endif

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ config X86
171171
select HAVE_PERF_USER_STACK_DUMP
172172
select HAVE_RCU_TABLE_FREE
173173
select HAVE_REGS_AND_STACK_ACCESS_API
174-
select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
174+
select HAVE_RELIABLE_STACKTRACE if X86_64 && UNWINDER_FRAME_POINTER && STACK_VALIDATION
175175
select HAVE_STACK_VALIDATION if X86_64
176176
select HAVE_SYSCALL_TRACEPOINTS
177177
select HAVE_UNSTABLE_SCHED_CLOCK

arch/x86/Kconfig.debug

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -359,28 +359,14 @@ config PUNIT_ATOM_DEBUG
359359

360360
choice
361361
prompt "Choose kernel unwinder"
362-
default FRAME_POINTER_UNWINDER
362+
default UNWINDER_ORC if X86_64
363+
default UNWINDER_FRAME_POINTER if X86_32
363364
---help---
364365
This determines which method will be used for unwinding kernel stack
365366
traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
366367
livepatch, lockdep, and more.
367368

368-
config FRAME_POINTER_UNWINDER
369-
bool "Frame pointer unwinder"
370-
select FRAME_POINTER
371-
---help---
372-
This option enables the frame pointer unwinder for unwinding kernel
373-
stack traces.
374-
375-
The unwinder itself is fast and it uses less RAM than the ORC
376-
unwinder, but the kernel text size will grow by ~3% and the kernel's
377-
overall performance will degrade by roughly 5-10%.
378-
379-
This option is recommended if you want to use the livepatch
380-
consistency model, as this is currently the only way to get a
381-
reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
382-
383-
config ORC_UNWINDER
369+
config UNWINDER_ORC
384370
bool "ORC unwinder"
385371
depends on X86_64
386372
select STACK_VALIDATION
@@ -396,7 +382,22 @@ config ORC_UNWINDER
396382
Enabling this option will increase the kernel's runtime memory usage
397383
by roughly 2-4MB, depending on your kernel config.
398384

399-
config GUESS_UNWINDER
385+
config UNWINDER_FRAME_POINTER
386+
bool "Frame pointer unwinder"
387+
select FRAME_POINTER
388+
---help---
389+
This option enables the frame pointer unwinder for unwinding kernel
390+
stack traces.
391+
392+
The unwinder itself is fast and it uses less RAM than the ORC
393+
unwinder, but the kernel text size will grow by ~3% and the kernel's
394+
overall performance will degrade by roughly 5-10%.
395+
396+
This option is recommended if you want to use the livepatch
397+
consistency model, as this is currently the only way to get a
398+
reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
399+
400+
config UNWINDER_GUESS
400401
bool "Guess unwinder"
401402
depends on EXPERT
402403
---help---
@@ -411,7 +412,7 @@ config GUESS_UNWINDER
411412
endchoice
412413

413414
config FRAME_POINTER
414-
depends on !ORC_UNWINDER && !GUESS_UNWINDER
415+
depends on !UNWINDER_ORC && !UNWINDER_GUESS
415416
bool
416417

417418
endmenu

arch/x86/configs/tiny.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CONFIG_NOHIGHMEM=y
22
# CONFIG_HIGHMEM4G is not set
33
# CONFIG_HIGHMEM64G is not set
4-
CONFIG_GUESS_UNWINDER=y
5-
# CONFIG_FRAME_POINTER_UNWINDER is not set
4+
CONFIG_UNWINDER_GUESS=y
5+
# CONFIG_UNWINDER_FRAME_POINTER is not set

arch/x86/configs/x86_64_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y
299299
# CONFIG_DEBUG_RODATA_TEST is not set
300300
CONFIG_DEBUG_BOOT_PARAMS=y
301301
CONFIG_OPTIMIZE_INLINING=y
302+
CONFIG_UNWINDER_ORC=y
302303
CONFIG_SECURITY=y
303304
CONFIG_SECURITY_NETWORK=y
304305
CONFIG_SECURITY_SELINUX=y

arch/x86/entry/calling.h

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -142,56 +142,25 @@ For 32-bit we have the following conventions - kernel is built with
142142
UNWIND_HINT_REGS offset=\offset
143143
.endm
144144

145-
.macro RESTORE_EXTRA_REGS offset=0
146-
movq 0*8+\offset(%rsp), %r15
147-
movq 1*8+\offset(%rsp), %r14
148-
movq 2*8+\offset(%rsp), %r13
149-
movq 3*8+\offset(%rsp), %r12
150-
movq 4*8+\offset(%rsp), %rbp
151-
movq 5*8+\offset(%rsp), %rbx
152-
UNWIND_HINT_REGS offset=\offset extra=0
153-
.endm
154-
155-
.macro RESTORE_C_REGS_HELPER rstor_rax=1, rstor_rcx=1, rstor_r11=1, rstor_r8910=1, rstor_rdx=1
156-
.if \rstor_r11
157-
movq 6*8(%rsp), %r11
158-
.endif
159-
.if \rstor_r8910
160-
movq 7*8(%rsp), %r10
161-
movq 8*8(%rsp), %r9
162-
movq 9*8(%rsp), %r8
163-
.endif
164-
.if \rstor_rax
165-
movq 10*8(%rsp), %rax
166-
.endif
167-
.if \rstor_rcx
168-
movq 11*8(%rsp), %rcx
169-
.endif
170-
.if \rstor_rdx
171-
movq 12*8(%rsp), %rdx
172-
.endif
173-
movq 13*8(%rsp), %rsi
174-
movq 14*8(%rsp), %rdi
175-
UNWIND_HINT_IRET_REGS offset=16*8
176-
.endm
177-
.macro RESTORE_C_REGS
178-
RESTORE_C_REGS_HELPER 1,1,1,1,1
179-
.endm
180-
.macro RESTORE_C_REGS_EXCEPT_RAX
181-
RESTORE_C_REGS_HELPER 0,1,1,1,1
182-
.endm
183-
.macro RESTORE_C_REGS_EXCEPT_RCX
184-
RESTORE_C_REGS_HELPER 1,0,1,1,1
185-
.endm
186-
.macro RESTORE_C_REGS_EXCEPT_R11
187-
RESTORE_C_REGS_HELPER 1,1,0,1,1
188-
.endm
189-
.macro RESTORE_C_REGS_EXCEPT_RCX_R11
190-
RESTORE_C_REGS_HELPER 1,0,0,1,1
191-
.endm
192-
193-
.macro REMOVE_PT_GPREGS_FROM_STACK addskip=0
194-
subq $-(15*8+\addskip), %rsp
145+
.macro POP_EXTRA_REGS
146+
popq %r15
147+
popq %r14
148+
popq %r13
149+
popq %r12
150+
popq %rbp
151+
popq %rbx
152+
.endm
153+
154+
.macro POP_C_REGS
155+
popq %r11
156+
popq %r10
157+
popq %r9
158+
popq %r8
159+
popq %rax
160+
popq %rcx
161+
popq %rdx
162+
popq %rsi
163+
popq %rdi
195164
.endm
196165

197166
.macro icebp

0 commit comments

Comments
 (0)