Print this page
11909 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) || defined(__lint)
#include <sys/types.h>
#include <sys/thread.h>
#include <sys/cpuvar.h>
#include <vm/page.h>
--- 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) || defined(__lint)
#include <sys/types.h>
#include <sys/thread.h>
#include <sys/cpuvar.h>
#include <vm/page.h>
*** 916,929 ****
#else /* __lint */
#if defined(__amd64)
ENTRY(rw_enter)
- movq %gs:CPU_THREAD, %rdx /* rdx = thread ptr */
cmpl $RW_WRITER, %esi
je .rw_write_enter
- incl T_KPRI_REQ(%rdx) /* THREAD_KPRI_REQUEST() */
movq (%rdi), %rax /* rax = old rw_wwwh value */
testl $RW_WRITE_LOCKED|RW_WRITE_WANTED, %eax
jnz rw_enter_sleep
leaq RW_READ_LOCK(%rax), %rdx /* rdx = new rw_wwwh value */
lock
--- 915,926 ----
*** 935,944 ****
--- 932,942 ----
movq %rdi, %rsi /* rsi = lock ptr */
movl $LS_RW_ENTER_ACQUIRE, %edi
movl $RW_READER, %edx
jmp lockstat_wrapper_arg
.rw_write_enter:
+ movq %gs:CPU_THREAD, %rdx
orq $RW_WRITE_LOCKED, %rdx /* rdx = write-locked value */
xorl %eax, %eax /* rax = unheld value */
lock
cmpxchgq %rdx, (%rdi) /* try to grab write lock */
jnz rw_enter_sleep
*** 970,983 ****
xorl %edx, %edx /* rdx = new value (unheld) */
.rw_read_exit:
lock
cmpxchgq %rdx, (%rdi) /* try to drop read lock */
jnz rw_exit_wakeup
- movq %gs:CPU_THREAD, %rcx /* rcx = thread ptr */
- decl T_KPRI_REQ(%rcx) /* THREAD_KPRI_RELEASE() */
.rw_read_exit_lockstat_patch_point:
ret
movq %rdi, %rsi /* rsi = lock ptr */
movl $LS_RW_EXIT_RELEASE, %edi
movl $RW_READER, %edx
jmp lockstat_wrapper_arg
.rw_not_single_reader:
--- 968,980 ----
xorl %edx, %edx /* rdx = new value (unheld) */
.rw_read_exit:
lock
cmpxchgq %rdx, (%rdi) /* try to drop read lock */
jnz rw_exit_wakeup
.rw_read_exit_lockstat_patch_point:
ret
+ movq %gs:CPU_THREAD, %rcx /* rcx = thread ptr */
movq %rdi, %rsi /* rsi = lock ptr */
movl $LS_RW_EXIT_RELEASE, %edi
movl $RW_READER, %edx
jmp lockstat_wrapper_arg
.rw_not_single_reader:
*** 1004,1018 ****
SET_SIZE(rw_exit)
#else
ENTRY(rw_enter)
- movl %gs:CPU_THREAD, %edx /* edx = thread ptr */
movl 4(%esp), %ecx /* ecx = lock ptr */
cmpl $RW_WRITER, 8(%esp)
je .rw_write_enter
- incl T_KPRI_REQ(%edx) /* THREAD_KPRI_REQUEST() */
movl (%ecx), %eax /* eax = old rw_wwwh value */
testl $RW_WRITE_LOCKED|RW_WRITE_WANTED, %eax
jnz rw_enter_sleep
leal RW_READ_LOCK(%eax), %edx /* edx = new rw_wwwh value */
lock
--- 1001,1013 ----
*** 1023,1032 ****
--- 1018,1028 ----
movl %gs:CPU_THREAD, %edx /* edx = thread ptr */
movl $LS_RW_ENTER_ACQUIRE, %eax
pushl $RW_READER
jmp lockstat_wrapper_arg
.rw_write_enter:
+ movl %gs:CPU_THREAD, %edx
orl $RW_WRITE_LOCKED, %edx /* edx = write-locked value */
xorl %eax, %eax /* eax = unheld value */
lock
cmpxchgl %edx, (%ecx) /* try to grab write lock */
jnz rw_enter_sleep
*** 1058,1069 ****
xorl %edx, %edx /* edx = new value (unheld) */
.rw_read_exit:
lock
cmpxchgl %edx, (%ecx) /* try to drop read lock */
jnz rw_exit_wakeup
- movl %gs:CPU_THREAD, %edx /* edx = thread ptr */
- decl T_KPRI_REQ(%edx) /* THREAD_KPRI_RELEASE() */
.rw_read_exit_lockstat_patch_point:
ret
movl $LS_RW_EXIT_RELEASE, %eax
pushl $RW_READER
jmp lockstat_wrapper_arg
--- 1054,1063 ----