Commit graph

7047 commits

Author SHA1 Message Date
Matthijs Mekking
e5841856f8 Add release note and change for cds-digest-type 2023-02-28 09:37:37 +01:00
Tony Finch
4b5ec07bb7 Refactor qp-trie to use QSBR
The first working multi-threaded qp-trie was stuck with an unpleasant
trade-off:

  * Use `isc_rwlock`, which has acceptable write performance, but
    terrible read scalability because the qp-trie made all accesses
    through a single lock.

  * Use `liburcu`, which has great read scalability, but terrible
    write performance, because I was relying on `rcu_synchronize()`
    which is rather slow. And `liburcu` is LGPL.

To get the best of both worlds, we need our own scalable read side,
which we now have with `isc_qsbr`. And we need to modify the write
side so that it is not blocked by readers.

Better write performance requires an async cleanup function like
`call_rcu()`, instead of the blocking `rcu_synchronize()`. (There
is no blocking cleanup in `isc_qsbr`, because I have concluded
that it would be an attractive nuisance.)

Until now, all my multithreading qp-trie designs have been based
around two versions, read-only and mutable. This is too few to
work with asynchronous cleanup. The bare minimum (as in epoch
based reclamation) is three, but it makes more sense to support an
arbitrary number. Doing multi-version support "properly" makes
fewer assumptions about how safe memory reclamation works, and it
makes snapshots and rollbacks simpler.

To avoid making the memory management even more complicated, I
have introduced a new kind of "packed reader node" to anchor the
root of a version of the trie. This is simpler because it re-uses
the existing chunk lifetime logic - see the discussion under
"packed reader nodes" in `qp_p.h`.

I have also made the chunk lifetime logic simpler. The idea of a
"generation" is gone; instead, chunks are either mutable or
immutable. And the QSBR phase number is used to indicate when a
chunk can be reclaimed.

Instead of the `shared_base` flag (which was basically a one-bit
reference count, with a two version limit) the base array now has a
refcount, which replaces the confusing ad-hoc lifetime logic with
something more familiar and systematic.
2023-02-27 13:47:55 +00:00
Aram Sargsyan
4c22aae748 Add a CHANGES placeholder for [GL #3900] 2023-02-27 13:10:22 +00:00
Aram Sargsyan
46b1c558ce Add a CHANGES note for [GL #3777] 2023-02-27 10:06:32 +00:00
Aram Sargsyan
cb1cd67bea
Add CHANGES and release notes for [GL #3881] 2023-02-24 17:06:18 +01:00
Aram Sargsyan
c76cc58803
Add a CHANGES note for [GL !7571] 2023-02-24 15:07:14 +01:00
Aram Sargsyan
c29299aa15
Add a CHANGES note for [GL !7570] 2023-02-24 15:00:44 +01:00
Tony Finch
330ff06d4a Move irs_resconf into libdns and remove libirs
`libirs` used to be a reference implementation of `getaddrinfo` and
related modern resolver APIs. It was stripped down in BIND 9.18
leaving only the `irs_resconf` module, which parses
`/etc/resolv.conf`. I have kept its include path and namespace prefix,
so it remains a little fragment of libirs now embedded in libdns.
2023-02-24 09:38:59 +00:00
Evan Hunt
55f00de18e CHANGES for [GL #3886] 2023-02-24 08:30:33 +00:00
Tony Finch
9b7aa536ba QSBR: safe memory reclamation for lock-free data structures
This "quiescent state based reclamation" module provides support for
the qp-trie module in dns/qp. It is a replacement for liburcu, written
without reference to the urcu source code, and in fact it works in a
significantly different way.

A few specifics of BIND make this variant of QSBR somewhat simpler:

  * We can require that wait-free access to a qp-trie only happens in
    an isc_loop callback. The loop provides a natural quiescent state,
    after the callbacks are done, when no qp-trie access occurs.

  * We can dispense with any API like rcu_synchronize(). In practice,
    it takes far too long to wait for a grace period to elapse for each
    write to a data structure.

  * We use the idea of "phases" (aka epochs or eras) from EBR to
    reduce the amount of bookkeeping needed to track memory that is no
    longer needed, knowing that the qp-trie does most of that work
    already.

I considered hazard pointers for safe memory reclamation. They have
more read-side overhead (updating the hazard pointers) and it wasn't
clear to me how to nicely schedule the cleanup work. Another
alternative, epoch-based reclamation, is designed for fine-grained
lock-free updates, so it needs some rethinking to work well with the
heavily read-biased design of the qp-trie. QSBR has the fastest read
side of the basic SMR algorithms (with no barriers), and fits well
into a libuv loop. More recent hybrid SMR algorithms do not appear to
have enough benefits to justify the extra complexity.
2023-02-23 15:57:53 +00:00
Tony Finch
36e56923ce Simple lock-free stack in <isc/stack.h>
Add a singly-linked stack that supports lock-free prepend and drain (to
empty the list and clean up its elements).  Intended for use with QSBR
to collect objects that need safe memory reclamation, or any other user
that works with adding objects to the stack and then draining them in
one go like various work queues.

In <isc/atomic.h>, add an `atomic_ptr()` macro to make type
declarations a little less abominable, and clean up a duplicate
definition of `atomic_compare_exchange_strong_acq_rel()`
2023-02-22 16:13:37 +00:00
Evan Hunt
dee4939299 CHANGES for [GL #3882] 2023-02-21 10:13:34 -08:00
Tony Finch
8bb5f37fd4 Add CHANGES and release note
[cleanup]	Move bind9_getaddresses() to isc_getaddresses()
		and remove the now empty libbind9.
2023-02-21 13:12:26 +00:00
Aram Sargsyan
b086374b1d Add a CHANGES note for [GL #3880] 2023-02-21 08:23:59 +00:00
Tony Finch
dcb54af220 Move bind9/check to isccfg/check
Since it is part of the configuration machinery
2023-02-17 12:13:37 +00:00
Evan Hunt
e49350721f
CHANGES for [GL #3797] 2023-02-17 07:18:25 +01:00
Michal Nowak
3203d6c549 BIND 9.19.10
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEIz+ZTe/bbr1Q+/5RJKPoRjruXlYFAmPc6LIACgkQJKPoRjru
 XlY2sxAApR7URjCmNfNmNim0WZcM44gNZbhyVQZ7EwrVYz9VELeJEu9EcLEkVzi2
 KQwkB7ClSee/or0fT5i9P2rNu8aZFbZutjePqpoXffBJ+nZVDBltbxt3XJti3J14
 P3EW8qqFDv2g1Fgf603231HLEVBss2knEk3mzsbFlvqdiTPbcWkb30EolMkXDgAt
 adY8nekGd0ginQ2mIKSoKUkww7fvjP0H4NsUQj9H/ymLEuSgO4zsCpKb+3Aat6ea
 8oji0H4NJq581jGUUj6Sx4Q8uWpvv9e0flKl0DQ7YT18zn2Dtmp+1eOku06Ejb7h
 6O0QYcJmjIohTXY7i/8LK2In8wrGupuq3S/eK1NwGIgHURuaL7e3A6OX9ypv75eA
 iRoFi4PqYJmYilSjUvc7gPym2Pvh0/O0Uz/9pw1hfbdczGHLvZxx5t0yZJ85ULq2
 dFz0Y5BEmJ0CfjbXjObqZvHbA0faPKHnKcEAd1xnvo4YKPsr9gpzh8DR/Q8Feo0T
 OCDRgaHs+nBIyaYdmh5C9zsiyNy4sNw6yWJkc2HOC6sbPi9qNHwjUtYS+goB7uoz
 KkCbIHJMFCa9NgHGf8lM8kI5aPtQcnOb0adDV1JXx8E3lqriciMa/EpDuRa74NXU
 J6JdjBKEKsyBXCbn3sVDMbmhKAUZ3MD/J4ZKxTOSuwLOXDufyCw=
 =FtbQ
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEIz+ZTe/bbr1Q+/5RJKPoRjruXlYFAmPuI9AACgkQJKPoRjru
 Xlay2g//a4Ll54GOKI8dLlzrirdh83wWxLcDrpbY1vQ1msLPEqbsdhSXB3IkLhX+
 lmz8qIDEF+jq8s3rkgea37vw3BGZqvktVdn+CWA2zzDR0rzcztfr3TZI1Q6rCdSX
 guJE6iVcwzsk4FgD1srd4oThEDLOYpTZHCb+LvL0jeHrFCvzLwWdmIYmEytpEiU+
 QnOSY/3hyuNYz8LQfzoxK/STUalxBqfOpMDdTTZcg00lIIvrFhccjXmRODDQjrT9
 w5xgzWEK3YC+IYh7YmRTOOIWXwkcvDV1aSLtK6YR9HJlEewSXT1joGOrstIoR6Q1
 XkYmMajXR0A+sEoFV9L3Tc1eI4NF6Qa7LD95q4oeTbmN2hfGLp0NV8a6ebJjDn8w
 PRaY5DbLK+wAXjvVhh0I7WamP6/RNz8jFnVmgZKDpZ2zqyeN/Umep6MyX1OFpCho
 fbVArEMfKfFthEaJ1JwD7oDivOh2t+yPycJGbDsXJA++mP4kkJ7elnrOs9qu42mG
 m//FNVFbc1lS1GounwF4/cCRauFZrnbSX1LOGP30Wj+0hPFSr9T4Ie+VgO5U6FlI
 HuG1LabeEWPCkOcmT6cuVQ207e4U/IvN6z6h8hSEzjfqmLjxbS5Q4hyzZNeHr4Tw
 BxOVoAdXAmH841JsSRDkgpbRDGdu3l2qy1v6Prg050mjp8Z4AVk=
 =2S8g
 -----END PGP SIGNATURE-----

Merge tag 'v9_19_10'

BIND 9.19.10
2023-02-16 13:38:33 +01:00
Tony Finch
9892ac791c Add CHANGES note
[cleanup]	Several nugatory headers have been removed from libisc
2023-02-15 16:44:47 +00:00
Tony Finch
b0893ae09a Explain <isc/strerr.h> a little more
The purpose of the `strerror_r()` wrapper was not obvious.
2023-02-15 16:44:09 +00:00
Tony Finch
75f7a85a39 Deprecate <isc/deprecated.h>
We refactor more freely these days.
2023-02-15 15:36:20 +00:00
Ondřej Surý
459db4462f
Add CHANGES note for [GL #1609] 2023-02-15 09:30:21 +01:00
Mark Andrews
55a6b15087 Add CHANGES note for [GL !7417] 2023-02-15 18:55:18 +11:00
Tony Finch
436b76bb17 Improve the spinloop pause / yield hint
Unfortunately, C still lacks a standard function for pause (x86,
sparc) or yeild (arm) instructions, for use in spin lock or CAS loops.
BIND has its own based on vendor intrinsics or inline asm.

Previously, it was buried in the `isc_rwlock` implementation. This
commit renames `isc_rwlock_pause()` to `isc_pause()` and moves
it into <isc/pause.h>.

This commit also fixes the configure script so that it detects ARM
yield support on systems that identify as `aarch*` instead of `arm*`.

On 64-bit ARM systems we now use the ISB (instruction synchronization
barrier) instruction in preference to yield. The ISB instruction
pauses the CPU for longer, several nanoseconds, which is more like the
x86 pause instruction. There are more details in a Rust pull request,
which also refers to MySQL making the same change:
https://github.com/rust-lang/rust/pull/84725
2023-02-14 17:13:24 +00:00
Aram Sargsyan
a5927f1151 Add a CHANGES note for [GL #3866] 2023-02-14 09:13:18 +00:00
Mark Andrews
2928f21733 Add CHANGES note for [GL #3662] 2023-02-14 10:10:39 +11:00
Ondřej Surý
6fa48c963e Add CHANGES and release note for [GL #3840] 2023-02-09 15:04:52 +01:00
Tony Finch
174e56a251 Fix CHANGES numbering
Oops, I broke it
2023-02-09 13:41:04 +00:00
Tony Finch
9721fa2153 Reduce the size of rdatasetheader_t by 16 bytes
Re-order the fields to avoid padding, and change the type of
`heap_index` to `uint16_t` to match `dns_rbtnode_t->locknum`.
2023-02-09 09:07:30 +00:00
Mark Andrews
ae26fcb8f5 Add CHANGES note for [GL #3831] 2023-02-09 08:35:27 +11:00
Ondřej Surý
72cfca9b3b
Add CHANGES and release notes for [GL #3729] 2023-02-08 21:33:23 +01:00
Aram Sargsyan
2a1f937536 Add a CHANGES note for [GL #3839] 2023-02-07 10:41:21 +00:00
Evan Hunt
4f50854e7a CHANGES for [GL #3790] 2023-02-06 15:04:24 -08:00
Evan Hunt
c144fd2871 CHANGES for [GL #3850] 2023-02-06 14:39:43 -08:00
Tony Finch
50ab648f8a Remove unused support for fromwire(DNS_NAME_DOWNCASE)
Most of this change is fixing dns_rdata_fromwire() so
it does not propagate the unused options variable.
2023-02-06 13:26:36 +00:00
Tony Finch
c70bb3deb5 Remove some remnants of bitstring labels
* rbt node chains were sized to allow for bitstring labels, so they
  had 256 levels; but in the absence of bistrings, 128 is enough.

* dns_byaddr_createptrname() had a redundant options argument,
  and a very outdated doc comment.

* A number of comments referred to bitstring labels in a way that is
  no longer helpful. (A few informative comments remain.)
2023-02-06 13:22:30 +00:00
Tony Finch
ff63b53ff4 Add isc_time_monotonic()
This is to simplify measurements of how long things take.
2023-02-06 12:14:51 +00:00
Tony Finch
b8e71f9580 Fix ISC_MEM_ZERO on allocators with malloc_usable_size()
ISC_MEM_ZERO requires great care to use when the space returned by
the allocator is larger than the requested space, and when memory is
reallocated. You must ensure that _every_ call to allocate or
reallocate a particular block of memory uses ISC_MEM_ZERO, to ensure
that the extra space is zeroed as expected. (When ISC_MEMFLAG_FILL
is set, the extra space will definitely be non-zero.)

When BIND is built without jemalloc, ISC_MEM_ZERO is implemented in
`jemalloc_shim.h`. This had a bug on systems that have malloc_size()
or malloc_usable_size(): memory was only zeroed up to the requested
size, not the allocated size. When an oversized allocation was
returned, and subsequently reallocated larger, memory between the
original requested size and the original allocated size could
contain unexpected nonzero junk. The realloc call does not know the
original requested size and only zeroes from the original allocated
size onwards.

After this change, `jemalloc_shim.h` always zeroes up to the
allocated size, not the requested size.
2023-02-06 11:21:12 +00:00
Michal Nowak
ba798c7c69
Add a CHANGES marker 2023-02-03 11:55:36 +01:00
Michał Kępień
493eadd1ae Add CHANGES entry for GL #3827 2023-02-01 11:22:59 +01:00
Mark Andrews
13e0dfbae2 Add CHANGES for [GL #3828] 2023-02-01 00:35:11 +11:00
Mark Andrews
fda7858e74 Add CHANGES for [GL #3830] 2023-01-31 23:52:19 +11:00
Mark Andrews
1d258e2fb8 Add CHANGES for [GL #3829] 2023-01-30 22:26:50 +00:00
Matthijs Mekking
38ffe5acf3 Add CHANGES for #3822 2023-01-27 15:07:26 +00:00
Michał Kępień
4e934bae0b BIND 9.19.9
-----BEGIN PGP SIGNATURE-----
 
 iQJDBAABCgAtFiEENKwGS3ftSQfs1TU17QVz/8hFYQUFAmPAfwYPHG1pY2hhbEBp
 c2Mub3JnAAoJEO0Fc//IRWEFpmAP/23tasuol54W1dxnjGoQ7NYDV89ywQiWplyn
 syPs+iESFb3I9SlAHHhRGM0IREuDxjuexFdrIJOfZqokg36qPj+z81LRlRuRuetc
 HigGzpt2CDP41rVMsxzW3vyh2a3fTrjBKYT4tnDlsdnbwJOfFG4N/hdB7jqDPWut
 u1Itf/lD8iHhsISgFqvtKiQqc6XFwwzVAeSPH6pHnmngt16imVoQiddnw1RYn0vB
 EPcqhVvSeYS1AGWprnHpaWt8bru460iZwet+QKlxNxW6p4mOXGr6jQWqhZ+6ORDr
 Vo/a3+5Di+tNn89GJSbehLi5UQbvrcMR8WiQ54WP/k0PPTgoqMRC4PerLsNU8Vzq
 y1k18n8DMsuro92cNAdJk3gXuXYgGNF2sk9JtqwmiDo1/6G3afKfDiVKjiK1CxK0
 1CMKD+mPHCWB/H5U50oL1z89OCZDVUBUDT0YIrCBBrTIitzyXyAFkh+sjbRbdzww
 kg1GdZ4ODaydcWYH7r3RCHWDX6nkwADqGRk0SYvrJTFL2Hu150mwuxZj/5UZcmsz
 of6qh5b9yZrDrnBHgoqknnepuxiORFF7l3kk63fA13WG6S1m6h2ZONoVLw0J67dx
 mnAo0nlnWKi+TEl/CHiHcMZbeVhE/jrHAMPIcQQphKbCeQT1NPFSU2FQxa+dpix+
 V+y8x6Qb
 =TTpT
 -----END PGP SIGNATURE-----

Merge tag 'v9_19_9'

BIND 9.19.9
2023-01-25 21:16:00 +01:00
Ondřej Surý
122737ace6 Add CHANGES and release note for [GL #3718] 2023-01-24 17:57:16 +00:00
Aram Sargsyan
73e9390715 Add CHANGES and release notes for [GL #3726] 2023-01-20 14:45:30 +00:00
Mark Andrews
e706fb81ca Add CHANGES note for [GL #3800] 2023-01-20 11:06:08 +11:00
Mark Andrews
5c471c5d2c Add CHANGES for [GL #3799] 2023-01-19 23:52:37 +11:00
Aram Sargsyan
5a1707aa8d Add a CHANGES note for [GL #3808] 2023-01-19 10:24:36 +00:00
Matthijs Mekking
dbbacd910f Add CHANGES and release note for GL #3783
News worthy.
2023-01-19 10:19:43 +00:00