Pull up following revision(s) (requested by riastradh in ticket #1861):
sys/kern/kern_rwlock.c: revision 1.68 (patch) rwlock(9): Fix membars. rw_downgrade must be a release operation, and rw_tryupgrade must be an acquire operation. membar_producer is not enough -- need to use membar_release and membar_acquire. Discussed on tech-kern: https://mail-index.netbsd.org/tech-kern/2023/02/22/msg028726.html
This commit is contained in:
parent
dd81d3bc18
commit
c67cd7ca05
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_rwlock.c,v 1.46.6.3 2023/07/31 14:42:45 martin Exp $ */
|
||||
/* $NetBSD: kern_rwlock.c,v 1.46.6.4 2023/07/31 14:49:37 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.46.6.3 2023/07/31 14:42:45 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.46.6.4 2023/07/31 14:49:37 martin Exp $");
|
||||
|
||||
#define __RWLOCK_PRIVATE
|
||||
|
||||
|
@ -592,8 +592,7 @@ rw_downgrade(krwlock_t *rw)
|
|||
__USE(curthread);
|
||||
#endif
|
||||
|
||||
|
||||
membar_producer();
|
||||
membar_exit();
|
||||
owner = rw->rw_owner;
|
||||
if ((owner & RW_HAS_WAITERS) == 0) {
|
||||
/*
|
||||
|
@ -689,7 +688,7 @@ rw_tryupgrade(krwlock_t *rw)
|
|||
newown = curthread | RW_WRITE_LOCKED | (owner & ~RW_THREAD);
|
||||
next = rw_cas(rw, owner, newown);
|
||||
if (__predict_true(next == owner)) {
|
||||
membar_producer();
|
||||
membar_enter(); /* XXX membar_acquire */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue