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,14 +19,13 @@
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2019 Joyent, Inc.
*/
-#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>
@@ -916,14 +915,12 @@
#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
@@ -935,10 +932,11 @@
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,14 +968,13 @@
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 %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,15 +1001,13 @@
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
@@ -1023,10 +1018,11 @@
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,12 +1054,10 @@
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