最近在linux-4.14版本内核上做ltp测试,其中pthread_rwlock_unlock_3-1用例测试不通过,然后我又在各种其他linux系统上做测试,都没有通过。
Test failed: reader did not get the lock when writer1 release the lock
[root@aarch64 ]#
[root@aarch64 ]# ./31
current->pid==================762
main: write lock
main: create writer1, with priority: 3
current->pid==================763
writer1: attempt write lock
[ 19.909236] [futex]:cmd=0
[ 19.922086] [futex_wait]:uaddr=0x4122ec,val=0x0,flags=0x0,q=432536544,hb=0x1d9a9880
[ 19.930751] [futex_wait]:cur->comm=31[763], prio=96,normal=96,static=120,rt=3
main: create reader, with priority: 3
current->pid==================764
reader: attempt read lock
[ 23.939710] [futex]:cmd=0
[ 23.940431] [futex_wait]:uaddr=0x4122e8,val=0x0,flags=0x0,q=432421856,hb=0x1d9a5800
[ 23.941358] [futex_wait]:cur->comm=31[764], prio=96,normal=96,static=120,rt=3
main: create writer2, with priority: 1
current->pid==================765
writer2: attempt write lock
[ 26.955703] [futex]:cmd=0
[ 26.957442] [futex_wait]:uaddr=0x4122ec,val=0x0,flags=0x0,q=432438240,hb=0x1d9a9880
[ 26.962222] [futex_wait]:cur->comm=31[765], prio=98,normal=98,static=120,rt=1
main: release write lock
[ 30.971308] [futex]:cmd=1
[ 30.977258] [futex_wake]:cur->comm=31[762], prio=95,normal=95,static=120,rt=4,nr_wake=1
[ 30.981579] futex_wake 1534: pi_state=0,rt_waiter=0
[ 30.985314] futex_wake 1540: this->bitset=-1,bitset=-1
[ 30.993699] [mark_wake_futex]:this->comm=31[763], prio=96,normal=96,static=120,rt=3
[ 30.999326] [futex_wait]:cur->comm=31[763], prio=96,normal=96,static=120,rt=3
writer1: acquired write lock
[ 32.003246] [futex]:cmd=0
[ 32.006304] [futex_wait]:uaddr=0x7a5c32d0,val=0x2fb,flags=0x1,q=432520160,hb=0x1d9ad300
[ 32.016090] [futex_wait]:cur->comm=31[762], prio=95,normal=95,static=120,rt=4
writer1: unlock write lock
[ 32.026474] [futex]:cmd=1
[ 32.032413] [futex_wake]:cur->comm=31[763], prio=96,normal=96,static=120,rt=3,nr_wake=1
[ 32.037957] futex_wake 1534: pi_state=0,rt_waiter=0
[ 32.043483] futex_wake 1540: this->bitset=-1,bitset=-1
[ 32.049854] [mark_wake_futex]:this->comm=31[765], prio=98,normal=98,static=120,rt=1
[ 32.057541] [futex_wait]:cur->comm=31[765], prio=98,normal=98,static=120,rt=1
writer2: acquired writer lock
[ 32.097924] [futex]:cmd=1
[ 32.115272] [futex]:cmd=1
[ 32.117555] [futex_wake]:cur->comm=31[763], prio=96,normal=96,static=120,rt=3,nr_wake=1
[ 32.120352] futex_wake 1534: pi_state=0,rt_waiter=0
[ 32.122273] futex_wake 1540: this->bitset=-1,bitset=-1
[ 32.127844] [mark_wake_futex]:this->comm=31[762], prio=95,normal=95,static=120,rt=4
[ 32.130623] [futex_wait]:cur->comm=31[762], prio=95,normal=95,static=120,rt=4
Test failed: reader did not get the lock when writer1 release the lock
[ 36.176507] [futex_wait]:cur->comm=31[764], prio=96,normal=96,static=120,rt=3
[ 36.180772] [futex]:cmd=1
[ 36.185278] [futex]:cmd=1
[root@aarch64 ]#