return __sync_bool_compare_and_swap(lock, old, new);
 }
 
+#ifndef CONFIG_SMP
+static inline bool arch_vcpu_is_preempted(int cpu) { return false; }
+#else
+bool arch_vcpu_is_preempted(int cpu);
+#endif
+
+#define vcpu_is_preempted arch_vcpu_is_preempted
+
 /*
  * Simple spin lock operations.  There are two variants, one clears IRQ's
  * on the local processor, one does not.
 
        return -1;
 }
 
-int smp_vcpu_scheduled(int cpu)
+bool arch_vcpu_is_preempted(int cpu)
 {
-       return pcpu_running(pcpu_devices + cpu);
+       if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu))
+               return false;
+       if (pcpu_running(pcpu_devices + cpu))
+               return false;
+       return true;
 }
+EXPORT_SYMBOL(arch_vcpu_is_preempted);
 
 void smp_yield_cpu(int cpu)
 {
 
        asm(".insn rsy,0xeb0000000022,%0,0,%1" : : "d" (old), "Q" (*lock));
 }
 
-static inline int cpu_is_preempted(int cpu)
-{
-       if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu))
-               return 0;
-       if (smp_vcpu_scheduled(cpu))
-               return 0;
-       return 1;
-}
-
 void arch_spin_lock_wait(arch_spinlock_t *lp)
 {
        unsigned int cpu = SPINLOCK_LOCKVAL;
                        continue;
                }
                /* First iteration: check if the lock owner is running. */
-               if (first_diag && cpu_is_preempted(~owner)) {
+               if (first_diag && arch_vcpu_is_preempted(~owner)) {
                        smp_yield_cpu(~owner);
                        first_diag = 0;
                        continue;
                 * yield the CPU unconditionally. For LPAR rely on the
                 * sense running status.
                 */
-               if (!MACHINE_IS_LPAR || cpu_is_preempted(~owner)) {
+               if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(~owner)) {
                        smp_yield_cpu(~owner);
                        first_diag = 0;
                }
                        continue;
                }
                /* Check if the lock owner is running. */
-               if (first_diag && cpu_is_preempted(~owner)) {
+               if (first_diag && arch_vcpu_is_preempted(~owner)) {
                        smp_yield_cpu(~owner);
                        first_diag = 0;
                        continue;
                 * yield the CPU unconditionally. For LPAR rely on the
                 * sense running status.
                 */
-               if (!MACHINE_IS_LPAR || cpu_is_preempted(~owner)) {
+               if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(~owner)) {
                        smp_yield_cpu(~owner);
                        first_diag = 0;
                }
        owner = 0;
        while (1) {
                if (count-- <= 0) {
-                       if (owner && cpu_is_preempted(~owner))
+                       if (owner && arch_vcpu_is_preempted(~owner))
                                smp_yield_cpu(~owner);
                        count = spin_retry;
                }
        owner = 0;
        while (1) {
                if (count-- <= 0) {
-                       if (owner && cpu_is_preempted(~owner))
+                       if (owner && arch_vcpu_is_preempted(~owner))
                                smp_yield_cpu(~owner);
                        count = spin_retry;
                }
        owner = 0;
        while (1) {
                if (count-- <= 0) {
-                       if (owner && cpu_is_preempted(~owner))
+                       if (owner && arch_vcpu_is_preempted(~owner))
                                smp_yield_cpu(~owner);
                        count = spin_retry;
                }
 {
        if (!cpu)
                return;
-       if (MACHINE_IS_LPAR && !cpu_is_preempted(~cpu))
+       if (MACHINE_IS_LPAR && !arch_vcpu_is_preempted(~cpu))
                return;
        smp_yield_cpu(~cpu);
 }