Add cmm_emit_legacy_smp_mb() Some public APIs stipulate implicit memory barriers on operations. These were coherent with the memory model used at that time. However, with the migration to a memory model closer to the C11 memory model, these memory barriers are not strictly emitted by the atomic operations in the new memory model. Therefore, introducing the `--disable-legacy-mb' configuration option. By default, liburcu is configured to emit these legacy memory barriers, thus keeping backward compatibility at the expense of slower performances. However, users can opt-out by disabling the legacy memory barriers. This options is publicly exported in the system configuration header file and can be overrode manually on a compilation unit basis by defining `CONFIG_RCU_EMIT_LEGACY_MB' before including any liburcu files. The usage of this macro requires to re-write atomic operations in term of the CMM memory model. This is done for the queue and stack APIs. Change-Id: Ia5ce3b3d8cd1955556ce96fa4408a63aa098a1a6 Signed-off-by: Olivier Dion <odion@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Public headers: use SPDX identifiers The SPDX identifiers [1] are a legally binding shorthand, which can be used instead of the full boiler plate text. This is another step towards implementing the full REUSE spec [2] to help with copyright and licensing audits and compliance. This will reduce a lot a manual work required for the licensing audit required in Debian on each update. For files that lacked copyright and licensing information, I used the following guidelines. Use the author from the git history and the main project license 'LGPL-2.1-or-later'. [1] https://spdx.org/ids-how [2] https://reuse.software/tutorial/ Change-Id: I31928c81be4821cca29b905d8a0a06de9bd0e1ec Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add `urcu_posix_assert()` as `assert()` replacement This macro acts like the regular `assert()` macro unless NDEBUG is defined in which case it consumes the expression and becomes a no-op. This consumption trick (see `_urcu_use_expression()` macro) prevents the compiler from warning about unused variables even when assert() are removed by the NDEBUG define. This macro is also used for the existing `urcu_assert_debug()` macro. The implementation of `_urcu_use_expression()` is inspired by the Babeltrace 2 approach. See `BT_USE_EXPR()` macro and documentation in Babeltrace commit [1]: commit 1778c2a4134647150b199b2b57130817144446b0 Author: Philippe Proulx <eeppeliteloop@gmail.com> Date: Tue Apr 21 11:15:42 2020 -0400 lib: assign a unique ID to each pre/postcond. and report it on failure All assertion macros are moved to the new urcu/assert.h file. Link: https://github.com/efficios/babeltrace/commit/1778c2a4134647150b199b2b57130817144446b0 [1] Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: If60ce2d3f45ea8f5ec1dbb92fb43f83fd9f8102b
cleanup: explicitly mark unused parameters (-Wunused-parameter) Add the 'unused' attribute to function parameters that are unused to allow turning on -Wunused-parameter and distinguish unused parameters that are actual errors. Change-Id: Ie585e37f9d38718543a31aee2e7ab3428cdfd0a5 Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
wfcqueue: allow defining CDS_WFCQ_WAIT_SLEEP to override `poll' Users may want to use alternative sleeping behavior instead of `poll'. Make CDS_WFCQ_WAIT_SLEEP a macro which may be defined before including wfcqueue.h. This alternative behavior could include logging, performing low-priority cleanup work, sleeping a shorter/longer interval or any combination of that. This will also make integration into glibc easier, as `poll' linkage causes conformance test failures even when relegated to an impossible code path: https://public-inbox.org/libc-alpha/20180801092626.jrwyrojfye4avcis@whir/ Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup: Re-organise source dir Re-organise the sources, add a top level "src" and "include" dir and move relevant files. Disable autotools automated includes and define them manually. This fixes problems with collision of header names with system headers. Include the autoconf config.h in the default includes and remove it where it's explicitely included. Remove _GNU_SOURCE defines since it's detected at configure for platforms that requires it and added to the config.h. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>