urcu:stable-0.11

Last commit made on 2022-01-05
Get this branch:
git clone -b stable-0.11 https://git.launchpad.net/urcu

Branch merges

Branch information

Name:
stable-0.11
Repository:
lp:urcu

Recent commits

ffc6113... by Mathieu Desnoyers

Version 0.11.4

Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: Ia6c8ec40b503ce8c1bbcc378fcea19085f4683b4

4713a2a... by Michael Jeanson <email address hidden>

fix: add missing pkgconfig file for memb flavour lib

We ship a pkg-config file for each urcu flavour library except the
latest introduced 'memb'.

Change-Id: If222949941d968f63b07616776440931657aa6db
Signed-off-by: Michael Jeanson <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

7ca7fe9... by Simon Marchi <email address hidden>

Make temporary variable in _rcu_dereference non-const

When building the lttng-tools project with Ubuntu's gcc 11, I get the
following error:

      CC agent.lo
    In file included from /tmp/lttng/include/urcu/arch.h:25,
                     from /tmp/lttng/include/urcu/uatomic.h:23,
                     from /home/simark/src/lttng-tools/src/bin/lttng-sessiond/agent.c:11:
    /home/simark/src/lttng-tools/src/bin/lttng-sessiond/agent.c: In function ‘agent_update’:
    /tmp/lttng/include/urcu/static/pointer.h:96:33: error: argument 2 of ‘__atomic_load’ discards ‘const’ qualifier [-Werror=incompatible-pointer-types]
       96 | __atomic_load(&(p), &_________p1, __ATOMIC_CONSUME); \
          | ^~~~~~~~~~~~~
    /tmp/lttng/include/urcu/compiler.h:69:70: note: in definition of macro ‘caa_container_of’
       69 | const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \
          | ^~~
    /tmp/lttng/include/urcu/rculist.h:87:20: note: in expansion of macro ‘cds_list_entry’
       87 | for (pos = cds_list_entry(rcu_dereference((head)->next), __typeof__(*(pos)), member); \
          | ^~~~~~~~~~~~~~
    /tmp/lttng/include/urcu/pointer.h:47:33: note: in expansion of macro ‘_rcu_dereference’
       47 | #define rcu_dereference _rcu_dereference
          | ^~~~~~~~~~~~~~~~
    /tmp/lttng/include/urcu/rculist.h:87:35: note: in expansion of macro ‘rcu_dereference’
       87 | for (pos = cds_list_entry(rcu_dereference((head)->next), __typeof__(*(pos)), member); \
          | ^~~~~~~~~~~~~~~
    /home/simark/src/lttng-tools/src/bin/lttng-sessiond/agent.c:1551:9: note: in expansion of macro ‘cds_list_for_each_entry_rcu’
     1551 | cds_list_for_each_entry_rcu(ctx, &agt->app_ctx_list, list_node) {
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~

This is because the pointer passed to _rcu_dereference is const (the
pointer itself is const, IIUC, not necessarily the data it points to),
so the temporary _________p1 is also declared as const. We therefore
can't pass a non-const pointer to it to a function that modifies it.

I applied the trick found here [1] with success to get rid of the
constness of the variable. With this change, lttng-tools compiles
successfully with gcc 11.

There may be other spots in the headers where this would be needed, but
it is hard to spot them. I think we would need to write some test file
that pass const pointers to all macros of the API and see if they
compile.

[1] https://stackoverflow.com/a/18067745

Signed-off-by: Simon Marchi <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: Ib43efa7674ecea99cec1c3fffae86829b44a97e5

f41d90c... by Mathieu Desnoyers

Fix: x86 and s390: uatomic __hp() macro C++ support

C++ does not allow defining types in cast. Therefore, define the types
with typedef and use them in the __hp() macro.

Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: I92af62924f78dc6c5f7420a6376731212fbc5a20

dcae1b0... by Mathieu Desnoyers

Fix: x86 and s390: uatomic __hp() macro clang support

The __hp macro should receive contant size arguments to support clang,
which does not implement VLA support.

Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: Ifa3d5b5b7921f54849e0f331bef8f07c059b998f

03155c0... by Mathieu Desnoyers

Fix: x86 and s390 uatomic: __hp() macro warning with gcc 11

The __hp() macro used in the x86 and s390 uatomic code generates the
following warning with gcc-11:

In file included from ../include/urcu/uatomic.h:27,
                 from ../include/urcu/static/wfcqueue.h:35,
                 from ../include/urcu/wfcqueue.h:133,
                 from workqueue.c:39:
workqueue.c: In function ‘workqueue_thread’:
../include/urcu/uatomic/x86.h:155:17: warning: array subscript ‘struct __uatomic_dummy[0]’ is partly outside array bounds of ‘struct cds_wfcq_tail[1]’ [-Warray-bounds]
  155 | __asm__ __volatile__(
      | ^~~~~~~
workqueue.c:184:38: note: while referencing ‘cbs_tmp_tail’
  184 | struct cds_wfcq_tail cbs_tmp_tail;
      | ^~~~~~~~~~~~

The (previously undocumented) reason for this macro is to allow passing the
"void *" parameter as "m" or "+m" operand to the inline assembly. That
motivation was explained in commit 53b8ed6836363 ("s390 uatomic arch fix").

The out of bound access is detected by gcc because struct
__uatomic_dummy's length is quite large: an array of 10 unsigned long,
which is larger than the size pointed to by the void pointer.

So rather than using a fixed-size type, cast to a structure containing
an array of characters of a size matching the @addr input argument.

While we are at it and digging out git archeology, properly document the
__hp() macro for posterity.

Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: I785e30661efe48be1806664a1a14fd3c9fdb0a32

bff8f20... by Mathieu Desnoyers

Document known ABI issue in README.md

Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: Ic4bc9273eb63e051eb1da122bee4f99a8eefafd3

034a3ba... by Michael Jeanson <email address hidden>

fix: clock_gettime on macOs

Newer version of macOs have an implementation of clock_gettime() that
requires additionnal setup, move the platform specific code first so it
is always used.

Change-Id: I12fcdeff6c0ae59bc1a13f4e2cd7f4ebcedfc253
Signed-off-by: Michael Jeanson <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>

06a7a69... by Mathieu Desnoyers

Fix: rculist header: use parenthesis around macro parameters

The coding style followed across liburcu is to use parenthesis around
macro parameters when it would otherwise lead to unexpected results due
to priority of operators. Fix rculist.h to follow this coding style.

Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: Idcc85eef31bb8c11766e834554bfab8b6ed35864

191eafa... by Mathieu Desnoyers

Fix: rcuhlist header: use parenthesis around macro parameters

The coding style followed across liburcu is to use parenthesis around
macro parameters when it would otherwise lead to unexpected results due
to priority of operators. Fix rcuhlist.h to follow this coding style.

Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: I2f7988e96ce495d68960c5f1036aa6953d3ff53b