Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Add missing barriers to curlwp_bind and curlwp_bindx
details: https://anonhg.NetBSD.org/src/rev/b3da3eafdde9
branches: trunk
changeset: 829875:b3da3eafdde9
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Feb 16 07:11:50 2018 +0000
description:
Add missing barriers to curlwp_bind and curlwp_bindx
The barriers prevent the instruction of setting/clearing the LP_BOUND flag
from reordering over where we want to prevent LWP migrations.
Note that the fix doesn't mean that there was a race condition. For now the API
is used only for psref and the combination use of them doesn't need the
barriers(*).
(*) https://mail-index.netbsd.org/tech-kern/2018/02/15/msg023101.html
Pointed out by Mateusz Guzik
diffstat:
sys/sys/lwp.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r dfe8a94d2b07 -r b3da3eafdde9 sys/sys/lwp.h
--- a/sys/sys/lwp.h Fri Feb 16 07:05:21 2018 +0000
+++ b/sys/sys/lwp.h Fri Feb 16 07:11:50 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lwp.h,v 1.177 2018/01/14 16:43:03 maxv Exp $ */
+/* $NetBSD: lwp.h,v 1.178 2018/02/16 07:11:50 ozaki-r Exp $ */
/*
* Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -536,6 +536,7 @@
bound = curlwp->l_pflag & LP_BOUND;
curlwp->l_pflag |= LP_BOUND;
+ __insn_barrier();
return bound;
}
@@ -545,6 +546,7 @@
{
KASSERT(curlwp->l_pflag & LP_BOUND);
+ __insn_barrier();
curlwp->l_pflag ^= bound ^ LP_BOUND;
}
Home |
Main Index |
Thread Index |
Old Index