Mark Andrews
5f6ab3512e
Silence TSAN warning on spins in isc_rwlock_lock
...
WARNING: ThreadSanitizer: data race
Write of size 4 at 0x000000000001 by thread T1:
#0 isc_rwlock_lock lib/isc/rwlock.c:720:2
#1 findnodeintree lib/dns/rbtdb.c:3060:2
#2 findnsec3node lib/dns/rbtdb.c:3164:10
#3 dns_db_findnsec3node lib/dns/db.c:528:10
#4 diff_apply lib/dns/diff.c:318:5
#5 dns_diff_applysilently lib/dns/diff.c:463:10
#6 signname bin/dnssec/./dnssec-signzone.c:1118:11
#7 sign bin/dnssec/./dnssec-signzone.c:1599:2
#8 dispatch lib/isc/task.c:1157:7
#9 run lib/isc/task.c:1331:2
Previous read of size 4 at 0x000000000001 by thread T2:
#0 isc_rwlock_lock lib/isc/rwlock.c:704:25
#1 addrdataset lib/dns/rbtdb.c:6853:2
#2 dns_db_addrdataset lib/dns/db.c:783:10
#3 diff_apply lib/dns/diff.c:370:14
#4 dns_diff_applysilently lib/dns/diff.c:463:10
#5 signname bin/dnssec/./dnssec-signzone.c:1118:11
#6 sign bin/dnssec/./dnssec-signzone.c:1599:2
#7 dispatch lib/isc/task.c:1157:7
#8 run lib/isc/task.c:1331:2
2020-12-10 06:31:19 +00:00
Evan Hunt
400171aee8
update all copyright headers to eliminate the typo
2020-09-14 17:00:40 -07:00
Ondřej Surý and Ondřej Surý
f71a8d1120
Convert all atomic operations in isc_rwlock to sequentially-consistent ordering
...
The memory ordering in the rwlock was all wrong, I am copying excerpts
from the https://en.cppreference.com/w/c/atomic/memory_order#Relaxed_ordering
for the convenience of the reader:
Relaxed ordering
Atomic operations tagged memory_order_relaxed are not synchronization
operations; they do not impose an order among concurrent memory
accesses. They only guarantee atomicity and modification order
consistency.
Sequentially-consistent ordering
Atomic operations tagged memory_order_seq_cst not only order memory
the same way as release/acquire ordering (everything that
happened-before a store in one thread becomes a visible side effect in
the thread that did a load), but also establish a single total
modification order of all atomic operations that are so tagged.
Which basically means that we had no or weak synchronization between
threads using the same variables in the rwlock structure. There should
not be a significant performance drop because the critical sections were
already protected by:
while(1) {
if (relaxed_atomic_operation) {
break;
}
LOCK(lock);
if (!relaxed_atomic_operation) {
WAIT(sem, lock);
}
UNLOCK(lock)l
}
I would add one more thing to "Don't do your own crypto, folks.":
- Also don't do your own locking, folks.
As part of this commit, I have also cleaned up the #ifdef spaghetti,
and fixed the isc_atomic API usage.
2020-02-11 21:20:14 +01:00
Ondřej Surý and Ondřej Surý
542517b194
Make isc_rwlock.c thread-safe
...
The ThreadSanitizer found several possible data races in our rwlock
implementation. This commit convert .spins and .write_granted fields
to atomic.
(cherry picked from commit 1da0994ea4 )
2020-02-11 20:05:51 +01:00
Mark Andrews
939f2fa2f5
formally discard return value
2020-01-13 05:07:13 +00:00
Ondřej Surý
1084b40b44
Replace custom isc_boolean_t with C standard bool type
...
(cherry picked from commit 994e656977 )
(cherry picked from commit 884929400c )
2018-08-10 15:20:57 +02:00
Ondřej Surý
aaa76dc654
Replace custom isc_u?intNN_t types with C99 u?intNN_t types
...
(cherry picked from commit cb6a185c69 )
(cherry picked from commit d61e6a3111 )
2018-08-10 15:20:57 +02:00
Ondřej Surý
188526f41c
Remove $Id markers, Principal Author and Reviewed tags from the full source tree
...
(cherry picked from commit 55a10b7acd )
2018-05-11 14:25:15 +02:00
Evan Hunt
8b205089b7
update file headers to remove copyright years
2018-03-14 16:40:20 -07:00
Mukund Sivaraman
16f43564c6
Backport performance work to 9.11 ( #45637 )
2017-12-06 10:35:21 +05:30
Mukund Sivaraman
dc0d95a23d
Use stdint.h only when stdatomic.h is in use (stdint.h isn't available everywhere)
...
(cherry picked from commit fb9712f639 )
2017-09-22 15:15:34 +05:30
Mark Andrews
d037e4dbbe
#include <stdint.h>
2017-09-21 14:20:53 +10:00
Mark Andrews
c0d6d4e2f2
atomic_compare_exchange_strong_explicit's second argument should not be atomic_*
2017-09-21 13:41:43 +10:00
Tinderbox User
8688e7005a
update copyright notice / whitespace
2017-09-19 23:47:50 +00:00
Mukund Sivaraman
9905606390
Use C11's stdatomic.h instead of isc_atomic where available
...
(cherry picked from commit 404c9b1c53 )
2017-09-19 15:49:21 +05:30
Mark Andrews
0c27b3fe77
4401. [misc] Change LICENSE to MPL 2.0.
2016-06-27 14:56:38 +10:00
Tinderbox User
a63461cc4b
update copyright notice / whitespace
2016-03-23 23:45:22 +00:00
Evan Hunt
bca79675ee
[master] fix x64 NOP, silence set but not used warning
2016-03-23 12:34:56 -07:00
Evan Hunt
cf24cbd837
[master] adaptive RW locks
...
3440. [performance] Implement adaptive read-write locks, reducing the
overhead of locks that are only held briefly.
[RT #37329 ]
2016-03-22 17:59:21 -07:00
Francis Dupont
3759f10fc5
added print.h includes, updated copyrights
2015-05-23 14:21:51 +02:00
Tinderbox User
5fa46bc916
update copyright notice
2012-03-10 23:45:53 +00:00
Mark Andrews
28a8f5b0de
set $Id$
2012-03-08 00:21:15 +11:00
Automatic Updater
c1aef54e14
update copyright notice
2011-03-12 04:59:49 +00:00
Mark Andrews
0874abad14
3069. [cleanup] Silence warnings messages from clang static analysis.
...
[RT #20256 ]
2011-03-11 06:11:27 +00:00
Automatic Updater
9a14f870dd
update copyright notice
2009-01-18 23:48:14 +00:00
Francis Dupont
a05abc1767
spelling
2009-01-18 00:50:21 +00:00
Automatic Updater
70e5a7403f
update copyright notice
2007-06-19 23:47:24 +00:00
Automatic Updater
ec5347e2c7
update copyright notice
2007-06-18 23:47:57 +00:00
Mark Andrews
18d0b5e54b
1900. [port] freebsd: pthread_mutex_init can fail if it runs out
...
of memory. [RT #14995 ]
2005-07-12 01:00:20 +00:00
Tatuya JINMEI 神明達哉
5597be9bb8
1813. [func] Restructured the data locking framework using
...
architecture dependent atomic operations (when
available), improving response performance on
multi-processor machines significantly.
x86, x86_64, alpha, and sparc64 are currently
supported.
(RT #13505 )
2005-06-04 05:32:50 +00:00
Rob Austein
ab023a6556
1851. [doc] Doxygen comment markup. [RT #11398 ]
2005-04-27 04:57:32 +00:00
Mark Andrews
b7b6b01a0d
update copyright
2005-03-16 00:55:19 +00:00
Mark Andrews
7d9b632906
1828. [bug] isc_rwlock_init() failed to properly cleanup if it
...
encountered a error. [RT #13549 ]
2005-03-15 02:03:11 +00:00
Mark Andrews
dafcb997e3
update copyright notice
2004-03-05 05:14:21 +00:00
Mark Andrews
ce08911be8
typo
2003-07-23 03:18:56 +00:00
Mark Andrews
17a14e451d
1492. [cleanup] Preserve rwlock quota context when upgrading /
...
downgrading. [RT #5599 ]
2003-07-21 01:14:18 +00:00
Mark Andrews
163547c0c0
1461. [bug] Remove deadlock from rbtdb code. [RT #5999 ]
2003-04-17 01:56:35 +00:00
David Lawrence
1bd5b8aac6
use ISC_MAGIC to define magic number
2001-04-17 14:36:45 +00:00
David Lawrence
79ed194592
sigh. always test recompile things even after a minor change. after deciding
...
to _not_ much with the lock tracing/printing facility for the last change,
i forgot to also add the new result variable back into the stack
declarations, where i had correctly put it the first time.
2001-04-17 13:42:32 +00:00
David Lawrence
8e60ba90e0
unlock the mutex when non-blocking locking is attempted and the lock is busy.
2001-04-17 04:07:38 +00:00
Bob Halley
c6237585d8
Fix some typos in the non-threaded version of isc_rwlock_trylock() that
...
were preventing compilation.
2001-03-08 19:52:13 +00:00
David Lawrence
a82fd2c01b
added non-blocking locking, isc_rwlock_trylock()
2001-03-08 00:55:15 +00:00
Andreas Gustafsson
91f74728a7
UNUSED()
2001-02-07 20:03:23 +00:00
Brian Wellington
499b34cea0
copyright update
2001-01-09 22:01:04 +00:00
David Lawrence
9cd6d409b7
first pass at using isc_msgcat_get for message strings in libisc
2000-12-06 00:30:32 +00:00
Brian Wellington
3c7f352550
single-threaded versions.
2000-08-29 00:33:36 +00:00
Brian Wellington
a44038277a
MOre calls to DESTROYLOCK
2000-08-26 01:31:56 +00:00
Brian Wellington
f5ad7569cb
#include <stddef.h>
2000-08-24 23:26:13 +00:00
Brian Wellington
3cab47dbea
A read lock could incorrectly be granted in some cases.
2000-08-24 19:06:38 +00:00
Andreas Gustafsson
249b19d917
print lock address and thread ID in rwlock trace messages
2000-08-24 17:06:31 +00:00