]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branches 'core/signal' and 'x86/spinlocks' into x86/xen
authorIngo Molnar <mingo@elte.hu>
Sun, 12 Oct 2008 11:20:25 +0000 (13:20 +0200)
committerIngo Molnar <mingo@elte.hu>
Sun, 12 Oct 2008 11:20:25 +0000 (13:20 +0200)
Conflicts:
include/asm-x86/spinlock.h

1  2  3 
arch/x86/kernel/process_64.c
include/asm-x86/spinlock.h

index 18e63350d7d2aac2c475b2126c17f87060dc5a99,b6b508ea71106f414deed5d11a9f43bbc8f6eb02,2a8ccb9238b4719036aef70780b282e60f58acdd..ca80394ef5b80ebff3fb5fad35aec9d683a8b32c
@@@@ -86,12 -86,30 -86,30 +86,12 @@@@ void exit_idle(void
        __exit_idle();
   }
   
 --#ifdef CONFIG_HOTPLUG_CPU
 --DECLARE_PER_CPU(int, cpu_state);
 --
 --#include <linux/nmi.h>
 --/* We halt the CPU with physical CPU hotplug */
 --static inline void play_dead(void)
 --{
 --     idle_task_exit();
 --     c1e_remove_cpu(raw_smp_processor_id());
 --
 --     mb();
 --     /* Ack it */
 --     __get_cpu_var(cpu_state) = CPU_DEAD;
 --
 --     local_irq_disable();
 --     /* mask all interrupts, flush any and all caches, and halt */
 --     wbinvd_halt();
 --}
 --#else
 ++#ifndef CONFIG_SMP
   static inline void play_dead(void)
   {
        BUG();
   }
 --#endif /* CONFIG_HOTPLUG_CPU */
 ++#endif
   
   /*
    * The idle thread. There's no useful work to be
@@@@ -736,12 -754,12 -754,12 +736,12 @@@@ unsigned long get_wchan(struct task_str
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
        stack = (unsigned long)task_stack_page(p);
- -     if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE)
+ +     if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE)
                return 0;
        fp = *(u64 *)(p->thread.sp);
        do {
                if (fp < (unsigned long)stack ||
- -                 fp > (unsigned long)stack+THREAD_SIZE)
+ +                 fp >= (unsigned long)stack+THREAD_SIZE)
                        return 0;
                ip = *(u64 *)(fp+8);
                if (!in_sched_functions(ip))
index 8badab09146b732d0e2e3be48f618563f725de18,93adae338ac64625ab1c1ec63634edd8c3d8dcd3,b5a4551fd5652c619fc4d36f74e9685e3c7197d6..157ff7fab97aba964216472e6f67aac147e3b901
   
   #ifdef CONFIG_X86_32
   # define LOCK_PTR_REG "a"
++ # define REG_PTR_MODE "k"
   #else
   # define LOCK_PTR_REG "D"
++ # define REG_PTR_MODE "q"
   #endif
   
   #if defined(CONFIG_X86_32) && \
    * much between them in performance though, especially as locks are out of line.
    */
   #if (NR_CPUS < 256)
-- static inline int __ticket_spin_is_locked(raw_spinlock_t *lock)
-- {
--      int tmp = ACCESS_ONCE(lock->slock);
-- 
--      return (((tmp >> 8) & 0xff) != (tmp & 0xff));
-- }
-- 
-- static inline int __ticket_spin_is_contended(raw_spinlock_t *lock)
-- {
--      int tmp = ACCESS_ONCE(lock->slock);
-- 
--      return (((tmp >> 8) - tmp) & 0xff) > 1;
-- }
++ #define TICKET_SHIFT 8
   
   static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
   {
   
   static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
   {
--      int tmp;
--      short new;
++      int tmp, new;
   
--      asm volatile("movw %2,%w0\n\t"
++      asm volatile("movzwl %2, %0\n\t"
                     "cmpb %h0,%b0\n\t"
++                   "leal 0x100(%" REG_PTR_MODE "0), %1\n\t"
                     "jne 1f\n\t"
--                   "movw %w0,%w1\n\t"
--                   "incb %h1\n\t"
                     LOCK_PREFIX "cmpxchgw %w1,%2\n\t"
                     "1:"
                     "sete %b1\n\t"
                     "movzbl %b1,%0\n\t"
--                   : "=&a" (tmp), "=Q" (new), "+m" (lock->slock)
++                   : "=&a" (tmp), "=&q" (new), "+m" (lock->slock)
                     :
                     : "memory", "cc");
   
@@@@ -116,19 -116,19 -104,7 +104,7 @@@@ static __always_inline void __ticket_sp
                     : "memory", "cc");
   }
   #else
-- static inline int __ticket_spin_is_locked(raw_spinlock_t *lock)
-- {
--      int tmp = ACCESS_ONCE(lock->slock);
-- 
--      return (((tmp >> 16) & 0xffff) != (tmp & 0xffff));
-- }
-- 
-- static inline int __ticket_spin_is_contended(raw_spinlock_t *lock)
-- {
--      int tmp = ACCESS_ONCE(lock->slock);
-- 
--      return (((tmp >> 16) - tmp) & 0xffff) > 1;
-- }
++ #define TICKET_SHIFT 16
   
   static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
   {
                     /* don't need lfence here, because loads are in-order */
                     "jmp 1b\n"
                     "2:"
--                   : "+Q" (inc), "+m" (lock->slock), "=r" (tmp)
++                   : "+r" (inc), "+m" (lock->slock), "=&r" (tmp)
                     :
                     : "memory", "cc");
   }
@@@@ -160,13 -160,13 -136,13 +136,13 @@@@ static __always_inline int __ticket_spi
                     "movl %0,%1\n\t"
                     "roll $16, %0\n\t"
                     "cmpl %0,%1\n\t"
++                   "leal 0x00010000(%" REG_PTR_MODE "0), %1\n\t"
                     "jne 1f\n\t"
--                   "addl $0x00010000, %1\n\t"
                     LOCK_PREFIX "cmpxchgl %1,%2\n\t"
                     "1:"
                     "sete %b1\n\t"
                     "movzbl %b1,%0\n\t"
--                   : "=&a" (tmp), "=r" (new), "+m" (lock->slock)
++                   : "=&a" (tmp), "=&q" (new), "+m" (lock->slock)
                     :
                     : "memory", "cc");
   
@@@@ -182,6 -182,8 -158,22 +158,20 @@@@ static __always_inline void __ticket_sp
   }
   #endif
   
 - #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
++ static inline int __ticket_spin_is_locked(raw_spinlock_t *lock)
++ {
++      int tmp = ACCESS_ONCE(lock->slock);
++ 
++      return !!(((tmp >> TICKET_SHIFT) ^ tmp) & ((1 << TICKET_SHIFT) - 1));
++ }
++ 
++ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock)
++ {
++      int tmp = ACCESS_ONCE(lock->slock);
++ 
++      return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1;
++ }
+  
  -#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
  -
   #ifdef CONFIG_PARAVIRT
   /*
    * Define virtualization-friendly old-style lock byte lock, for use in
@@@@ -270,13 -272,6 -262,6 +260,13 @@@@ static __always_inline void __raw_spin_
   {
        __ticket_spin_unlock(lock);
   }
 ++
 ++static __always_inline void __raw_spin_lock_flags(raw_spinlock_t *lock,
 ++                                               unsigned long flags)
 ++{
 ++     __raw_spin_lock(lock);
 ++}
 ++
   #endif       /* CONFIG_PARAVIRT */
   
   static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)