android_kernel_xiaomi_sm8350/arch/m32r/kernel
Hirokazu Takata 91f4ab056d [PATCH] m32r: Fix sys_tas() syscall
This patch fixes a deadlock problem of the m32r SMP kernel.

In the m32r kernel, sys_tas() system call is provided as a test-and-set
function for userspace, for backward compatibility.

In some multi-threading application program, deadlocks were rarely caused
at sys_tas() funcion.  Such a deadlock was caused due to a collision of
__pthread_lock() and __pthread_unlock() operations.

The "tas" syscall is repeatedly called by pthread_mutex_lock() to get a
lock, while a lock variable's value is not 0.  On the other hand,
pthead_mutex_unlock() sets the lock variable to 0 for unlocking.

In the previous implementation of sys_tas() routine, there was a
possibility that a unlock operation was ignored in the following case:

- Assume a lock variable (*addr) was equal to 1 before sys_tas() execution.
- __pthread_unlock() operation is executed by the other processor
  and the lock variable (*addr) is set to 0, between a read operation
  ("oldval = *addr;") and the following write operation ("*addr = 1;")
  during a execution of sys_tas().

In this case, the following write operation ("*addr = 1;") overwrites the
__pthread_unlock() result, and sys_tas() fails to get a lock in the next
turn and after that.

According to the attatched patch, sys_tas() returns 0 value in the next
turn and deadlocks never happen.

Signed-off-by: Hitoshi Yamamoto <Yamamoto.Hitoshi@ap.MitsubishiElectric.co.jp>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-28 14:42:24 -08:00
..
align.c
asm-offsets.c kbuild: frv,m32r,sparc64 introduce fake asm-offsets.h file 2005-09-09 22:47:53 +02:00
entry.S [PATCH] m32r: remove unused instructions 2005-10-30 17:37:15 -08:00
head.S
init_task.c
io_m32700ut.c [PATCH] m32r: SMC91x driver update 2005-10-30 17:37:16 -08:00
io_mappi2.c [PATCH] m32r: SMC91x driver update 2005-10-30 17:37:16 -08:00
io_mappi3.c [PATCH] m32r: SMC91x driver update 2005-10-30 17:37:16 -08:00
io_mappi.c [PATCH] m32r: NONCACHE_OFFSET in _port2addr 2005-10-30 17:37:16 -08:00
io_oaks32r.c [PATCH] m32r: NONCACHE_OFFSET in _port2addr 2005-10-30 17:37:16 -08:00
io_opsput.c [PATCH] m32r: SMC91x driver update 2005-10-30 17:37:16 -08:00
io_usrv.c [PATCH] m32r: NONCACHE_OFFSET in _port2addr 2005-10-30 17:37:16 -08:00
irq.c
m32r_ksyms.c
Makefile
module.c
process.c [PATCH] sched: disable preempt in idle tasks 2005-11-09 07:56:33 -08:00
ptrace.c [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
semaphore.c
setup_m32700ut.c Create platform_device.h to contain all the platform device details. 2005-10-29 19:07:23 +01:00
setup_mappi2.c Create platform_device.h to contain all the platform device details. 2005-10-29 19:07:23 +01:00
setup_mappi3.c Create platform_device.h to contain all the platform device details. 2005-10-29 19:07:23 +01:00
setup_mappi.c Create platform_device.h to contain all the platform device details. 2005-10-29 19:07:23 +01:00
setup_oaks32r.c
setup_opsput.c Create platform_device.h to contain all the platform device details. 2005-10-29 19:07:23 +01:00
setup_usrv.c
setup.c [PATCH] m32r: fix #if warnings 2005-10-30 17:37:15 -08:00
signal.c
smp.c [PATCH] m32r: Fix smp.c for preempt kernel 2005-10-14 17:10:12 -07:00
smpboot.c [PATCH] sched: disable preempt in idle tasks 2005-11-09 07:56:33 -08:00
sys_m32r.c [PATCH] m32r: Fix sys_tas() syscall 2005-11-28 14:42:24 -08:00
time.c [PATCH] jiffies_64 cleanup 2005-10-30 17:37:25 -08:00
traps.c [PATCH] m32r: trap handler code for illegal traps 2005-10-11 09:46:54 -07:00
vmlinux.lds.S