Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Jul 2011 00:02:24 +0000 (17:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Jul 2011 00:02:24 +0000 (17:02 -0700)
* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Fix write lock scalability 64-bit issue
  x86: Unify rwsem assembly implementation
  x86: Unify rwlock assembly implementation
  x86, asm: Fix binutils 2.16 issue with __USER32_CS
  x86, asm: Cleanup thunk_64.S
  x86, asm: Flip RESTORE_ARGS arguments logic
  x86, asm: Flip SAVE_ARGS arguments logic
  x86, asm: Thin down SAVE/RESTORE_* asm macros

1  2 
arch/x86/kernel/entry_64.S
arch/x86/lib/Makefile

@@@ -297,26 -297,27 +297,26 @@@ ENDPROC(native_usergs_sysret64
        .endm
  
  /* save partial stack frame */
 -      .pushsection .kprobes.text, "ax"
 -ENTRY(save_args)
 -      XCPT_FRAME
 +      .macro SAVE_ARGS_IRQ
        cld
 -      /*
 -       * start from rbp in pt_regs and jump over
 -       * return address.
 -       */
 -      movq_cfi rdi, RDI+8-RBP
 -      movq_cfi rsi, RSI+8-RBP
 -      movq_cfi rdx, RDX+8-RBP
 -      movq_cfi rcx, RCX+8-RBP
 -      movq_cfi rax, RAX+8-RBP
 -      movq_cfi  r8,  R8+8-RBP
 -      movq_cfi  r9,  R9+8-RBP
 -      movq_cfi r10, R10+8-RBP
 -      movq_cfi r11, R11+8-RBP
 -
 -      leaq -RBP+8(%rsp),%rdi  /* arg1 for handler */
 -      movq_cfi rbp, 8         /* push %rbp */
 -      leaq 8(%rsp), %rbp              /* mov %rsp, %ebp */
 +      /* start from rbp in pt_regs and jump over */
 +      movq_cfi rdi, RDI-RBP
 +      movq_cfi rsi, RSI-RBP
 +      movq_cfi rdx, RDX-RBP
 +      movq_cfi rcx, RCX-RBP
 +      movq_cfi rax, RAX-RBP
 +      movq_cfi  r8,  R8-RBP
 +      movq_cfi  r9,  R9-RBP
 +      movq_cfi r10, R10-RBP
 +      movq_cfi r11, R11-RBP
 +
 +      /* Save rbp so that we can unwind from get_irq_regs() */
 +      movq_cfi rbp, 0
 +
 +      /* Save previous stack value */
 +      movq %rsp, %rsi
 +
 +      leaq -RBP(%rsp),%rdi    /* arg1 for handler */
        testl $3, CS(%rdi)
        je 1f
        SWAPGS
         */
  1:    incl PER_CPU_VAR(irq_count)
        jne 2f
 -      popq_cfi %rax                   /* move return address... */
        mov PER_CPU_VAR(irq_stack_ptr),%rsp
        EMPTY_FRAME 0
 -      pushq_cfi %rbp                  /* backlink for unwinder */
 -      pushq_cfi %rax                  /* ... to the new stack */
 -      /*
 -       * We entered an interrupt context - irqs are off:
 -       */
 -2:    TRACE_IRQS_OFF
 -      ret
 -      CFI_ENDPROC
 -END(save_args)
 -      .popsection
 +
 +2:    /* Store previous stack value */
 +      pushq %rsi
 +      /* We entered an interrupt context - irqs are off: */
 +      TRACE_IRQS_OFF
 +      .endm
  
  ENTRY(save_rest)
        PARTIAL_FRAME 1 REST_SKIP+8
@@@ -467,7 -473,7 +467,7 @@@ ENTRY(system_call_after_swapgs
         * and short:
         */
        ENABLE_INTERRUPTS(CLBR_NONE)
-       SAVE_ARGS 8,1
+       SAVE_ARGS 8,0
        movq  %rax,ORIG_RAX-ARGOFFSET(%rsp)
        movq  %rcx,RIP-ARGOFFSET(%rsp)
        CFI_REL_OFFSET rip,RIP-ARGOFFSET
@@@ -502,7 -508,7 +502,7 @@@ sysret_check
        TRACE_IRQS_ON
        movq RIP-ARGOFFSET(%rsp),%rcx
        CFI_REGISTER    rip,rcx
-       RESTORE_ARGS 0,-ARG_SKIP,1
+       RESTORE_ARGS 1,-ARG_SKIP,0
        /*CFI_REGISTER  rflags,r11*/
        movq    PER_CPU_VAR(old_rsp), %rsp
        USERGS_SYSRET64
@@@ -785,7 -791,7 +785,7 @@@ END(interrupt
        /* reserve pt_regs for scratch regs and rbp */
        subq $ORIG_RAX-RBP, %rsp
        CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP
 -      call save_args
 +      SAVE_ARGS_IRQ
        PARTIAL_FRAME 0
        call \func
        .endm
@@@ -808,14 -814,15 +808,14 @@@ ret_from_intr
        DISABLE_INTERRUPTS(CLBR_NONE)
        TRACE_IRQS_OFF
        decl PER_CPU_VAR(irq_count)
 -      leaveq
  
 -      CFI_RESTORE             rbp
 +      /* Restore saved previous stack */
 +      popq %rsi
 +      leaq 16(%rsi), %rsp
 +
        CFI_DEF_CFA_REGISTER    rsp
 -      CFI_ADJUST_CFA_OFFSET   -8
 +      CFI_ADJUST_CFA_OFFSET   -16
  
 -      /* we did not save rbx, restore only from ARGOFFSET */
 -      addq $8, %rsp
 -      CFI_ADJUST_CFA_OFFSET   -8
  exit_intr:
        GET_THREAD_INFO(%rcx)
        testl $3,CS-ARGOFFSET(%rsp)
@@@ -851,7 -858,7 +851,7 @@@ retint_restore_args:       /* return to kerne
         */
        TRACE_IRQS_IRETQ
  restore_args:
-       RESTORE_ARGS 0,8,0
+       RESTORE_ARGS 1,8,1
  
  irq_return:
        INTERRUPT_RETURN
diff --combined arch/x86/lib/Makefile
@@@ -18,8 -18,10 +18,10 @@@ obj-$(CONFIG_SMP) += msr-smp.o cache-sm
  
  lib-y := delay.o
  lib-y += thunk_$(BITS).o
 -lib-y += usercopy_$(BITS).o getuser.o putuser.o
 +lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o
  lib-y += memcpy_$(BITS).o
+ lib-$(CONFIG_SMP) += rwlock.o
+ lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
  lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o
  
  obj-y += msr.o msr-reg.o msr-reg-export.o
@@@ -29,7 -31,7 +31,7 @@@ ifeq ($(CONFIG_X86_32),y
          lib-y += atomic64_cx8_32.o
          lib-y += checksum_32.o
          lib-y += strstr_32.o
-         lib-y += semaphore_32.o string_32.o
+         lib-y += string_32.o
          lib-y += cmpxchg.o
  ifneq ($(CONFIG_X86_CMPXCHG64),y)
          lib-y += cmpxchg8b_emu.o atomic64_386_32.o
@@@ -40,7 -42,6 +42,6 @@@ els
          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 += memmove_64.o memset_64.o
-         lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o
-       lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem_64.o
+         lib-y += copy_user_64.o copy_user_nocache_64.o
        lib-y += cmpxchg16b_emu.o
  endif