提交 197fe6b0 编写于 作者: L Linus Torvalds

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
...@@ -39,8 +39,6 @@ obj-y += tsc.o tsc_msr.o io_delay.o rtc.o ...@@ -39,8 +39,6 @@ obj-y += tsc.o tsc_msr.o io_delay.o rtc.o
obj-y += pci-iommu_table.o obj-y += pci-iommu_table.o
obj-y += resource.o obj-y += resource.o
obj-$(CONFIG_PREEMPT) += preempt.o
obj-y += process.o obj-y += process.o
obj-y += i387.o xsave.o obj-y += i387.o xsave.o
obj-y += ptrace.o obj-y += ptrace.o
......
#include <linux/linkage.h>
#include <asm/dwarf2.h>
#include <asm/asm.h>
#include <asm/calling.h>
ENTRY(___preempt_schedule)
CFI_STARTPROC
SAVE_ALL
call preempt_schedule
RESTORE_ALL
ret
CFI_ENDPROC
#ifdef CONFIG_CONTEXT_TRACKING
ENTRY(___preempt_schedule_context)
CFI_STARTPROC
SAVE_ALL
call preempt_schedule_context
RESTORE_ALL
ret
CFI_ENDPROC
#endif
...@@ -38,7 +38,7 @@ endif ...@@ -38,7 +38,7 @@ endif
else else
obj-y += iomap_copy_64.o obj-y += iomap_copy_64.o
lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
lib-y += thunk_64.o clear_page_64.o copy_page_64.o lib-y += clear_page_64.o copy_page_64.o
lib-y += memmove_64.o memset_64.o lib-y += memmove_64.o memset_64.o
lib-y += copy_user_64.o copy_user_nocache_64.o lib-y += copy_user_64.o copy_user_nocache_64.o
lib-y += cmpxchg16b_emu.o lib-y += cmpxchg16b_emu.o
......
...@@ -6,15 +6,8 @@ ...@@ -6,15 +6,8 @@
* *
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/alternative-asm.h>
#include <asm/frame.h>
#include <asm/dwarf2.h> #include <asm/dwarf2.h>
#include <asm/percpu.h>
#ifdef CONFIG_SMP
#define SEG_PREFIX %gs:
#else
#define SEG_PREFIX
#endif
.text .text
...@@ -39,24 +32,25 @@ CFI_STARTPROC ...@@ -39,24 +32,25 @@ CFI_STARTPROC
# *atomic* on a single cpu (as provided by the this_cpu_xx class of # *atomic* on a single cpu (as provided by the this_cpu_xx class of
# macros). # macros).
# #
this_cpu_cmpxchg16b_emu: pushfq_cfi
pushf
cli cli
cmpq SEG_PREFIX(%rsi), %rax cmpq PER_CPU_VAR((%rsi)), %rax
jne not_same jne .Lnot_same
cmpq SEG_PREFIX 8(%rsi), %rdx cmpq PER_CPU_VAR(8(%rsi)), %rdx
jne not_same jne .Lnot_same
movq %rbx, SEG_PREFIX(%rsi) movq %rbx, PER_CPU_VAR((%rsi))
movq %rcx, SEG_PREFIX 8(%rsi) movq %rcx, PER_CPU_VAR(8(%rsi))
popf CFI_REMEMBER_STATE
popfq_cfi
mov $1, %al mov $1, %al
ret ret
not_same: CFI_RESTORE_STATE
popf .Lnot_same:
popfq_cfi
xor %al,%al xor %al,%al
ret ret
......
...@@ -7,11 +7,8 @@ ...@@ -7,11 +7,8 @@
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/alternative-asm.h>
#include <asm/frame.h>
#include <asm/dwarf2.h> #include <asm/dwarf2.h>
.text .text
/* /*
...@@ -30,27 +27,28 @@ CFI_STARTPROC ...@@ -30,27 +27,28 @@ CFI_STARTPROC
# set the whole ZF thing (caller will just compare # set the whole ZF thing (caller will just compare
# eax:edx with the expected value) # eax:edx with the expected value)
# #
cmpxchg8b_emu: pushfl_cfi
pushfl
cli cli
cmpl (%esi), %eax cmpl (%esi), %eax
jne not_same jne .Lnot_same
cmpl 4(%esi), %edx cmpl 4(%esi), %edx
jne half_same jne .Lhalf_same
movl %ebx, (%esi) movl %ebx, (%esi)
movl %ecx, 4(%esi) movl %ecx, 4(%esi)
popfl CFI_REMEMBER_STATE
popfl_cfi
ret ret
not_same: CFI_RESTORE_STATE
.Lnot_same:
movl (%esi), %eax movl (%esi), %eax
half_same: .Lhalf_same:
movl 4(%esi), %edx movl 4(%esi), %edx
popfl popfl_cfi
ret ret
CFI_ENDPROC CFI_ENDPROC
......
...@@ -6,25 +6,46 @@ ...@@ -6,25 +6,46 @@
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/dwarf2.h>
#ifdef CONFIG_TRACE_IRQFLAGS
/* put return address in eax (arg1) */ /* put return address in eax (arg1) */
.macro thunk_ra name,func .macro THUNK name, func, put_ret_addr_in_eax=0
.globl \name .globl \name
\name: \name:
pushl %eax CFI_STARTPROC
pushl %ecx pushl_cfi %eax
pushl %edx CFI_REL_OFFSET eax, 0
pushl_cfi %ecx
CFI_REL_OFFSET ecx, 0
pushl_cfi %edx
CFI_REL_OFFSET edx, 0
.if \put_ret_addr_in_eax
/* Place EIP in the arg1 */ /* Place EIP in the arg1 */
movl 3*4(%esp), %eax movl 3*4(%esp), %eax
.endif
call \func call \func
popl %edx popl_cfi %edx
popl %ecx CFI_RESTORE edx
popl %eax popl_cfi %ecx
CFI_RESTORE ecx
popl_cfi %eax
CFI_RESTORE eax
ret ret
CFI_ENDPROC
_ASM_NOKPROBE(\name) _ASM_NOKPROBE(\name)
.endm .endm
thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller #ifdef CONFIG_TRACE_IRQFLAGS
thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
#endif
#ifdef CONFIG_PREEMPT
THUNK ___preempt_schedule, preempt_schedule
#ifdef CONFIG_CONTEXT_TRACKING
THUNK ___preempt_schedule_context, preempt_schedule_context
#endif #endif
#endif
...@@ -38,6 +38,13 @@ ...@@ -38,6 +38,13 @@
THUNK lockdep_sys_exit_thunk,lockdep_sys_exit THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
#endif #endif
#ifdef CONFIG_PREEMPT
THUNK ___preempt_schedule, preempt_schedule
#ifdef CONFIG_CONTEXT_TRACKING
THUNK ___preempt_schedule_context, preempt_schedule_context
#endif
#endif
/* SAVE_ARGS below is used only for the .cfi directives it contains. */ /* SAVE_ARGS below is used only for the .cfi directives it contains. */
CFI_STARTPROC CFI_STARTPROC
SAVE_ARGS SAVE_ARGS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册