Print this page
OS-7753 THREAD_KPRI_RELEASE does nothing of the sort
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

*** 19,32 **** * CDDL HEADER END */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - #if defined(lint) #include <sys/types.h> #include <sys/thread.h> #include <sys/cpuvar.h> #else /* lint */ --- 19,31 ---- * CDDL HEADER END */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019 Joyent, Inc. */ #if defined(lint) #include <sys/types.h> #include <sys/thread.h> #include <sys/cpuvar.h> #else /* lint */
*** 500,513 **** .align 16 ENTRY(rw_enter) cmp %o1, RW_WRITER ! entering as writer? be,a,pn %icc, 2f ! if so, go do it ... or THREAD_REG, RW_WRITE_LOCKED, %o5 ! delay: %o5 = owner - ld [THREAD_REG + T_KPRI_REQ], %o3 ! begin THREAD_KPRI_REQUEST() ldn [%o0], %o4 ! %o4 = old lock value - inc %o3 ! bump kpri - st %o3, [THREAD_REG + T_KPRI_REQ] ! store new kpri 1: andcc %o4, RW_WRITE_CLAIMED, %g0 ! write-locked or write-wanted? bz,pt %xcc, 3f ! if so, prepare to block add %o4, RW_READ_LOCK, %o5 ! delay: increment hold count sethi %hi(rw_enter_sleep), %o2 ! load up jump --- 499,509 ----
*** 550,568 **** membar #LoadStore|#StoreStore ! membar_exit() subcc %o4, RW_READ_LOCK, %o5 ! %o5 = new lock value if reader bnz,pn %xcc, 2f ! single reader, no waiters? clr %o1 1: - ld [THREAD_REG + T_KPRI_REQ], %g1 ! begin THREAD_KPRI_RELEASE() srl %o4, RW_HOLD_COUNT_SHIFT, %o3 ! %o3 = hold count (lockstat) casx [%o0], %o4, %o5 ! try to drop lock cmp %o4, %o5 ! did we succeed? bne,pn %xcc, rw_exit_wakeup ! if not, go to C ! dec %g1 ! delay: drop kpri .rw_read_exit_lockstat_patch_point: retl ! st %g1, [THREAD_REG + T_KPRI_REQ] ! delay: store new kpri 2: andcc %o4, RW_WRITE_LOCKED, %g0 ! are we a writer? bnz,a,pt %xcc, 3f or THREAD_REG, RW_WRITE_LOCKED, %o4 ! delay: %o4 = owner cmp %o5, RW_READ_LOCK ! would lock still be held? --- 546,563 ---- membar #LoadStore|#StoreStore ! membar_exit() subcc %o4, RW_READ_LOCK, %o5 ! %o5 = new lock value if reader bnz,pn %xcc, 2f ! single reader, no waiters? clr %o1 1: srl %o4, RW_HOLD_COUNT_SHIFT, %o3 ! %o3 = hold count (lockstat) casx [%o0], %o4, %o5 ! try to drop lock cmp %o4, %o5 ! did we succeed? bne,pn %xcc, rw_exit_wakeup ! if not, go to C ! nop ! delay: do nothing .rw_read_exit_lockstat_patch_point: retl ! nop ! delay: do nothing 2: andcc %o4, RW_WRITE_LOCKED, %g0 ! are we a writer? bnz,a,pt %xcc, 3f or THREAD_REG, RW_WRITE_LOCKED, %o4 ! delay: %o4 = owner cmp %o5, RW_READ_LOCK ! would lock still be held?