{
unsigned long caller, val;
int stuck = INIT_STUCK;
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
int shown = 0;
GET_CALLER(caller);
lock->owner_cpu = cpu;
current->thread.smp_lock_count++;
current->thread.smp_lock_pc = ((unsigned int)caller);
+
+ put_cpu();
}
int _spin_trylock(spinlock_t *lock)
{
unsigned long val, caller;
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
GET_CALLER(caller);
__asm__ __volatile__("ldstub [%1], %0"
current->thread.smp_lock_count++;
current->thread.smp_lock_pc = ((unsigned int)caller);
}
+
+ put_cpu();
+
return val == 0;
}
{
unsigned long caller, val;
int stuck = INIT_STUCK;
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
int shown = 0;
GET_CALLER(caller);
rw->reader_pc[cpu] = ((unsigned int)caller);
current->thread.smp_lock_count++;
current->thread.smp_lock_pc = ((unsigned int)caller);
+
+ put_cpu();
}
void _do_read_unlock (rwlock_t *rw, char *str)
{
unsigned long caller, val;
int stuck = INIT_STUCK;
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
int shown = 0;
GET_CALLER(caller);
}
goto runlock_again;
}
+
+ put_cpu();
}
void _do_write_lock (rwlock_t *rw, char *str)
{
unsigned long caller, val;
int stuck = INIT_STUCK;
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
int shown = 0;
GET_CALLER(caller);
rw->writer_cpu = cpu;
current->thread.smp_lock_count++;
current->thread.smp_lock_pc = ((unsigned int)caller);
+
+ put_cpu();
}
void _do_write_unlock(rwlock_t *rw)
int _do_write_trylock (rwlock_t *rw, char *str)
{
unsigned long caller, val;
- int cpu = smp_processor_id();
+ int cpu = get_cpu();
GET_CALLER(caller);
: "0" (&(rw->lock))
: "g3", "g5", "g7", "memory");
- if (val)
+ if (val) {
+ put_cpu();
return 0;
+ }
if ((rw->lock & ((1UL<<63)-1UL)) != 0UL) {
/* Readers still around, drop the write
: "r" (&(rw->lock))
: "g3", "g5", "g7", "cc", "memory");
+ put_cpu();
+
return 0;
}
current->thread.smp_lock_count++;
current->thread.smp_lock_pc = ((unsigned int)caller);
+ put_cpu();
+
return 1;
}