missing _raw_write_trylock
PATCH 1/1 missing _raw_write_trylock
Please help me reviewing the code, because inline assembly bug is always tricky and miserable.
Jun
include/asm-mips/spinlock.h renamed from include/asm-mips/spinlock.h.orig +24 -0
@@ -167,4 +167,28 @@ : "memory"); } +static inline int _raw_write_trylock (rwlock_t *rw) +{ +unsigned int tmp; +int ret; + + __asm__ __volatile__( +".set\tnoreorder\t\t\t# _raw_write_trylock\n" +"li\t%2, 0\n\t" +"1:\tll\t%1, %3\n\t" +"bnez\t%1, 2f\n\t" +"lui\t%1, 0x8000\n\t" +"sc\t%1, %0\n\t" +"beqz\t%1, 1b\n\t" +"sync\n\t" +"li\t%2, 1\n\t" +".set\treorder\n" +"2:" + :"=m" (rw->lock),"=&r" (tmp),"=&r" (ret) + :"m" (rw->lock) + :"memory" ); + +return ret; +} +#endif /* _ASM_SPINLOCK_H */
Quoted 3 lines · Jun Sun
Please help me reviewing the code, because inline assembly bug is always tricky and miserable.
Are you going to do a non-LLSC, or are we no longer concerned about those?
-Steve
Quoted 7 lines · Steven J. Hill
Quoted 3 lines · Jun Sun
Please help me reviewing the code, because inline assembly bug is always tricky and miserable.
Are you going to do a non-LLSC, or are we no longer concerned about those?
For SMP machines we assume LLSC are present. This function and its friends for SMP only.
Jun
Quoted 6 lines · Jun Sun
Quoted 3 lines
Are you going to do a non-LLSC, or are we no longer concerned about those?
For SMP machines we assume LLSC are present. This function and its friends for SMP only.
doesn't CONFIG_PREEMPT (*shudder*) need it is aswell?
CONFIG_SMP and CONFIG_PREEMPT at the same time, as it's inkernel/sched.c.
chris
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Jun Sun
Quoted 3 lines
Are you going to do a non-LLSC, or are we no longer concerned about those?
For SMP machines we assume LLSC are present. This function and its friends for SMP only.
doesn't
CONFIG_PREEMPT(*shudder*) need it is aswell?