linux/arch/tile/lib
Chris Metcalf 3c5ead52ed arch/tile: fix deadlock bugs in rwlock implementation
The first issue fixed in this patch is that pending rwlock write locks
could lock out new readers; this could cause a deadlock if a read lock was
held on cpu 1, a write lock was then attempted on cpu 2 and was pending,
and cpu 1 was interrupted and attempted to re-acquire a read lock.
The write lock code was modified to not lock out new readers.

The second issue fixed is that there was a narrow race window where a tns
instruction had been issued (setting the lock value to "1") and the store
instruction to reset the lock value correctly had not yet been issued.
In this case, if an interrupt occurred and the same cpu then tried to
manipulate the lock, it would find the lock value set to "1" and spin
forever, assuming some other cpu was partway through updating it.  The fix
is to enforce an interrupt critical section around the tns/store pair.

In addition, this change now arranges to always validate that after
a readlock we have not wrapped around the count of readers, which
is only eight bits.

Since these changes make the rwlock "fast path" code heavier weight,
I decided to move all the rwlock code all out of line, leaving only the
conventional spinlock code with fastpath inlines.  Since the read_lock
and read_trylock implementations ended up very similar, I just expressed
read_lock in terms of read_trylock.

As part of this change I also eliminate support for the now-obsolete
tns_atomic mode.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
2011-03-10 16:10:41 -05:00
..
atomic_32.c arch/tile: fix some comments and whitespace 2011-03-10 13:14:03 -05:00
atomic_asm_32.S arch/tile: fix some comments and whitespace 2011-03-10 13:14:03 -05:00
cacheflush.c arch/tile: enhance existing finv_buffer_remote() routine 2011-03-01 16:21:06 -05:00
checksum.c arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
cpumask.c arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
delay.c arch/tile: fix __ndelay etc to work better 2011-03-01 16:20:04 -05:00
exports.c arch/tile: export some additional module symbols 2011-03-01 16:21:12 -05:00
Makefile arch/tile: use extended assembly to inline __mb_incoherent() 2011-03-01 16:20:54 -05:00
memchr_32.c arch/tile: fix memchr() not to dereference memory for zero length 2010-11-24 13:57:42 -05:00
memcpy_32.S arch/tile: minor whitespace/naming changes for string support files 2010-10-15 15:38:54 -04:00
memcpy_tile64.c arch/tile: support 4KB page size as well as 64KB 2011-03-10 13:17:53 -05:00
memmove.c arch/tile: minor whitespace/naming changes for string support files 2010-10-15 15:38:54 -04:00
memset_32.c arch/tile: minor whitespace/naming changes for string support files 2010-10-15 15:38:54 -04:00
spinlock_32.c arch/tile: fix deadlock bugs in rwlock implementation 2011-03-10 16:10:41 -05:00
spinlock_common.h arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
strchr_32.c arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00
strlen_32.c arch/tile: minor whitespace/naming changes for string support files 2010-10-15 15:38:54 -04:00
uaccess.c arch/tile: Miscellaneous cleanup changes. 2010-07-06 13:41:51 -04:00
usercopy_32.S arch/tile: core support for Tilera 32-bit chips. 2010-06-04 17:11:18 -04:00