linux/kernel/locking
mazhenhua 7a7b5f89d9 ANDROID: locking/rwsem: only clean RWSEM_FLAG_HANDOFF when already set
sem->count will be negative after writer is killed
if flag RWSEM_FLAG_HANDOFF is not set, we shouldn't clean again

            CPU2                                 CPU4
    task A[reader]                         task B[writer]
    down_read_killable[locked]
    sem->count=0x100

                                           down_write_killable
                                           sem->count=0x102[wlist not empty]
    up_read
    count=0x2
                                           sig kill received
    down_read_killable
    sem->count=0x102[wlist not empty]

                                           goto branch out_nolock:
                                           list_del(&waiter.list);
                                           wait list is empty
                                           sem->count-RWSEM_FLAG_HANDOFF
                                           sem->count=0xFE
                                           list_empty(&sem->wait_list) is TRUE
                                           sem->count andnot RWSEM_FLAG_WAITERS
                                           sem->count=0xFC
    up_read
    sem->count-=0x100
    sem->count=0xFFFFFFFFFFFFFFFC
    DEBUG_RWSEMS_WARN_ON(tmp < 0, sem);

Bug: 204595609
Link: https://lore.kernel.org/all/a630a9aa-8c66-31c9-21a0-3d30bde2c9df@redhat.com/T/
Signed-off-by: mazhenhua <mazhenhua@xiaomi.com>
Change-Id: Ife64c179335d74768a3d68e402c72d10148f3e7e
2021-11-16 18:07:21 +00:00
..
lock_events_list.h
lock_events.c
lock_events.h
lockdep_internals.h lockdep: Fix usage_traceoverflow 2020-10-09 08:53:08 +02:00
lockdep_proc.c
lockdep_states.h
lockdep.c locking/lockdep: Mark local_lock_t 2021-09-15 09:50:41 +02:00
locktorture.c locktorture: Make function torture_percpu_rwsem_init() static 2020-08-24 18:45:32 -07:00
Makefile
mcs_spinlock.h
mutex-debug.c locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal 2021-05-26 12:06:50 +02:00
mutex-debug.h locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal 2021-05-26 12:06:50 +02:00
mutex.c This is the 5.10.65 stable release 2021-09-15 14:16:47 +02:00
mutex.h locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal 2021-05-26 12:06:50 +02:00
osq_lock.c
percpu-rwsem.c locking/percpu-rwsem: Use this_cpu_{inc,dec}() for read_count 2020-09-16 16:26:56 +02:00
qrwlock.c locking/qrwlock: Fix ordering in queued_write_lock_slowpath() 2021-04-28 13:40:00 +02:00
qspinlock_paravirt.h
qspinlock_stat.h
qspinlock.c
rtmutex_common.h rtmutex: Remove unused argument from rt_mutex_proxy_unlock() 2021-01-30 13:55:17 +01:00
rtmutex-debug.c
rtmutex-debug.h
rtmutex.c ANDROID: vendor_hooks: set debugging data when rt_mutex is working 2021-05-07 00:12:54 +00:00
rtmutex.h
rwsem.c ANDROID: locking/rwsem: only clean RWSEM_FLAG_HANDOFF when already set 2021-11-16 18:07:21 +00:00
rwsem.h
semaphore.c
spinlock_debug.c
spinlock.c
test-ww_mutex.c