aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 12:14:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 12:14:50 -0400
commit197fe6b0e6843b6859c6a1436ff19e3c444c0502 (patch)
tree0aca5adb302db005bbb5e95f9c7905f279769a3c
parentfaafcba3b5e15999cf75d5c5a513ac8e47e2545f (diff)
parentf74954f01ec9bb2004bcc24f247d1f26f1063ad2 (diff)
Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 asm updates from Ingo Molnar: "The changes in this cycle were: - Speed up the x86 __preempt_schedule() implementation - Fix/improve low level asm code debug info annotations" * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86: Unwind-annotate thunk_32.S x86: Improve cmpxchg8b_emu.S x86: Improve cmpxchg16b_emu.S x86/lib/Makefile: Remove the unnecessary "+= thunk_64.o" x86: Speed up ___preempt_schedule*() by using THUNK helpers
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/preempt.S25
-rw-r--r--arch/x86/lib/Makefile2
-rw-r--r--arch/x86/lib/cmpxchg16b_emu.S32
-rw-r--r--arch/x86/lib/cmpxchg8b_emu.S20
-rw-r--r--arch/x86/lib/thunk_32.S41
-rw-r--r--arch/x86/lib/thunk_64.S7
7 files changed, 61 insertions, 68 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index ada2e2d6be3e..8f1e77440b2b 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -39,8 +39,6 @@ obj-y += tsc.o tsc_msr.o io_delay.o rtc.o
39obj-y += pci-iommu_table.o 39obj-y += pci-iommu_table.o
40obj-y += resource.o 40obj-y += resource.o
41 41
42obj-$(CONFIG_PREEMPT) += preempt.o
43
44obj-y += process.o 42obj-y += process.o
45obj-y += i387.o xsave.o 43obj-y += i387.o xsave.o
46obj-y += ptrace.o 44obj-y += ptrace.o
diff --git a/arch/x86/kernel/preempt.S b/arch/x86/kernel/preempt.S
deleted file mode 100644
index ca7f0d58a87d..000000000000
--- a/arch/x86/kernel/preempt.S
+++ /dev/null
@@ -1,25 +0,0 @@
1
2#include <linux/linkage.h>
3#include <asm/dwarf2.h>
4#include <asm/asm.h>
5#include <asm/calling.h>
6
7ENTRY(___preempt_schedule)
8 CFI_STARTPROC
9 SAVE_ALL
10 call preempt_schedule
11 RESTORE_ALL
12 ret
13 CFI_ENDPROC
14
15#ifdef CONFIG_CONTEXT_TRACKING
16
17ENTRY(___preempt_schedule_context)
18 CFI_STARTPROC
19 SAVE_ALL
20 call preempt_schedule_context
21 RESTORE_ALL
22 ret
23 CFI_ENDPROC
24
25#endif
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 7ef9a30e7dac..db92793b7e23 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -38,7 +38,7 @@ endif
38else 38else
39 obj-y += iomap_copy_64.o 39 obj-y += iomap_copy_64.o
40 lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o 40 lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
41 lib-y += thunk_64.o clear_page_64.o copy_page_64.o 41 lib-y += clear_page_64.o copy_page_64.o
42 lib-y += memmove_64.o memset_64.o 42 lib-y += memmove_64.o memset_64.o
43 lib-y += copy_user_64.o copy_user_nocache_64.o 43 lib-y += copy_user_64.o copy_user_nocache_64.o
44 lib-y += cmpxchg16b_emu.o 44 lib-y += cmpxchg16b_emu.o
diff --git a/arch/x86/lib/cmpxchg16b_emu.S b/arch/x86/lib/cmpxchg16b_emu.S
index 1e572c507d06..40a172541ee2 100644
--- a/arch/x86/lib/cmpxchg16b_emu.S
+++ b/arch/x86/lib/cmpxchg16b_emu.S
@@ -6,15 +6,8 @@
6 * 6 *
7 */ 7 */
8#include <linux/linkage.h> 8#include <linux/linkage.h>
9#include <asm/alternative-asm.h>
10#include <asm/frame.h>
11#include <asm/dwarf2.h> 9#include <asm/dwarf2.h>
12 10#include <asm/percpu.h>
13#ifdef CONFIG_SMP
14#define SEG_PREFIX %gs:
15#else
16#define SEG_PREFIX
17#endif
18 11
19.text 12.text
20 13
@@ -39,24 +32,25 @@ CFI_STARTPROC
39# *atomic* on a single cpu (as provided by the this_cpu_xx class of 32# *atomic* on a single cpu (as provided by the this_cpu_xx class of
40# macros). 33# macros).
41# 34#
42this_cpu_cmpxchg16b_emu: 35 pushfq_cfi
43 pushf
44 cli 36 cli
45 37
46 cmpq SEG_PREFIX(%rsi), %rax 38 cmpq PER_CPU_VAR((%rsi)), %rax
47 jne not_same 39 jne .Lnot_same
48 cmpq SEG_PREFIX 8(%rsi), %rdx 40 cmpq PER_CPU_VAR(8(%rsi)), %rdx
49 jne not_same 41 jne .Lnot_same
50 42
51 movq %rbx, SEG_PREFIX(%rsi) 43 movq %rbx, PER_CPU_VAR((%rsi))
52 movq %rcx, SEG_PREFIX 8(%rsi) 44 movq %rcx, PER_CPU_VAR(8(%rsi))
53 45
54 popf 46 CFI_REMEMBER_STATE
47 popfq_cfi
55 mov $1, %al 48 mov $1, %al
56 ret 49 ret
57 50
58 not_same: 51 CFI_RESTORE_STATE
59 popf 52.Lnot_same:
53 popfq_cfi
60 xor %al,%al 54 xor %al,%al
61 ret 55 ret
62 56
diff --git a/arch/x86/lib/cmpxchg8b_emu.S b/arch/x86/lib/cmpxchg8b_emu.S
index 828cb710dec2..b4807fce5177 100644
--- a/arch/x86/lib/cmpxchg8b_emu.S
+++ b/arch/x86/lib/cmpxchg8b_emu.S
@@ -7,11 +7,8 @@
7 */ 7 */
8 8
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <asm/alternative-asm.h>
11#include <asm/frame.h>
12#include <asm/dwarf2.h> 10#include <asm/dwarf2.h>
13 11
14
15.text 12.text
16 13
17/* 14/*
@@ -30,27 +27,28 @@ CFI_STARTPROC
30# set the whole ZF thing (caller will just compare 27# set the whole ZF thing (caller will just compare
31# eax:edx with the expected value) 28# eax:edx with the expected value)
32# 29#
33cmpxchg8b_emu: 30 pushfl_cfi
34 pushfl
35 cli 31 cli
36 32
37 cmpl (%esi), %eax 33 cmpl (%esi), %eax
38 jne not_same 34 jne .Lnot_same
39 cmpl 4(%esi), %edx 35 cmpl 4(%esi), %edx
40 jne half_same 36 jne .Lhalf_same
41 37
42 movl %ebx, (%esi) 38 movl %ebx, (%esi)
43 movl %ecx, 4(%esi) 39 movl %ecx, 4(%esi)
44 40
45 popfl 41 CFI_REMEMBER_STATE
42 popfl_cfi
46 ret 43 ret
47 44
48 not_same: 45 CFI_RESTORE_STATE
46.Lnot_same:
49 movl (%esi), %eax 47 movl (%esi), %eax
50 half_same: 48.Lhalf_same:
51 movl 4(%esi), %edx 49 movl 4(%esi), %edx
52 50
53 popfl 51 popfl_cfi
54 ret 52 ret
55 53
56CFI_ENDPROC 54CFI_ENDPROC
diff --git a/arch/x86/lib/thunk_32.S b/arch/x86/lib/thunk_32.S
index 28f85c916712..e28cdaf5ac2c 100644
--- a/arch/x86/lib/thunk_32.S
+++ b/arch/x86/lib/thunk_32.S
@@ -6,25 +6,46 @@
6 */ 6 */
7 #include <linux/linkage.h> 7 #include <linux/linkage.h>
8 #include <asm/asm.h> 8 #include <asm/asm.h>
9 #include <asm/dwarf2.h>
9 10
10#ifdef CONFIG_TRACE_IRQFLAGS
11 /* put return address in eax (arg1) */ 11 /* put return address in eax (arg1) */
12 .macro thunk_ra name,func 12 .macro THUNK name, func, put_ret_addr_in_eax=0
13 .globl \name 13 .globl \name
14\name: 14\name:
15 pushl %eax 15 CFI_STARTPROC
16 pushl %ecx 16 pushl_cfi %eax
17 pushl %edx 17 CFI_REL_OFFSET eax, 0
18 pushl_cfi %ecx
19 CFI_REL_OFFSET ecx, 0
20 pushl_cfi %edx
21 CFI_REL_OFFSET edx, 0
22
23 .if \put_ret_addr_in_eax
18 /* Place EIP in the arg1 */ 24 /* Place EIP in the arg1 */
19 movl 3*4(%esp), %eax 25 movl 3*4(%esp), %eax
26 .endif
27
20 call \func 28 call \func
21 popl %edx 29 popl_cfi %edx
22 popl %ecx 30 CFI_RESTORE edx
23 popl %eax 31 popl_cfi %ecx
32 CFI_RESTORE ecx
33 popl_cfi %eax
34 CFI_RESTORE eax
24 ret 35 ret
36 CFI_ENDPROC
25 _ASM_NOKPROBE(\name) 37 _ASM_NOKPROBE(\name)
26 .endm 38 .endm
27 39
28 thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller 40#ifdef CONFIG_TRACE_IRQFLAGS
29 thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller 41 THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
42 THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
43#endif
44
45#ifdef CONFIG_PREEMPT
46 THUNK ___preempt_schedule, preempt_schedule
47#ifdef CONFIG_CONTEXT_TRACKING
48 THUNK ___preempt_schedule_context, preempt_schedule_context
30#endif 49#endif
50#endif
51
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S
index 92d9feaff42b..b30b5ebd614a 100644
--- a/arch/x86/lib/thunk_64.S
+++ b/arch/x86/lib/thunk_64.S
@@ -38,6 +38,13 @@
38 THUNK lockdep_sys_exit_thunk,lockdep_sys_exit 38 THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
39#endif 39#endif
40 40
41#ifdef CONFIG_PREEMPT
42 THUNK ___preempt_schedule, preempt_schedule
43#ifdef CONFIG_CONTEXT_TRACKING
44 THUNK ___preempt_schedule_context, preempt_schedule_context
45#endif
46#endif
47
41 /* SAVE_ARGS below is used only for the .cfi directives it contains. */ 48 /* SAVE_ARGS below is used only for the .cfi directives it contains. */
42 CFI_STARTPROC 49 CFI_STARTPROC
43 SAVE_ARGS 50 SAVE_ARGS