lp:~lttng/urcu/trunk

Created by Ubuntu LTTng and last modified
Get this branch:
bzr branch lp:~lttng/urcu/trunk

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Ubuntu LTTng
Project:
Userspace RCU
Status:
Development

Import details

Import Status: Reviewed

This branch is an import of the HEAD branch of the Git repository at git://git.lttng.org/userspace-rcu.git.

The next import is scheduled to run .

Last successful import was .

Import started on juju-1e3bde-prod-lp-code-import-13 and finished taking 15 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-15 and finished taking 10 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-13 and finished taking 10 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-15 and finished taking 10 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-13 and finished taking 20 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-15 and finished taking 10 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-13 and finished taking 10 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-13 and finished taking 10 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-13 and finished taking 10 seconds — see the log
Import started on juju-1e3bde-prod-lp-code-import-15 and finished taking 10 seconds — see the log

Recent revisions

1414. By Gavin Ray <email address hidden>

rculfhash: Include rculfhash-internal.h from local directory

Use double quotes rather than angle brackets to include this local
header file. This fixes build scenarios where the liburcu build is used
from cmake.

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

1413. By Mathieu Desnoyers

Remove "Darwin" from "should also work on list"

MacOS is already covered in the "tested on" list, and standalone Darwin
is relatively niche (http://www.puredarwin.org/).

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

1412. By Mathieu Desnoyers

Merge branch 'adah1972-improve-md'

Change-Id: I7904f3cee368428a21fdd84d07c395e232f5cfdb

1411. By Eric Wong

Fix: Always check pthread_create for failures

pthread_create may fail with EAGAIN (which is no fault of the
programmer), so don't allow the check to be compiled out.

Signed-off-by: Eric Wong <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: Ia2695ea6953b589ac8ab8b444fb668daee06a614

1410. By Mathieu Desnoyers

Disable signals in URCU background threads

Applications using signalfd depend on signals being blocked in all
threads of the process, otherwise threads with unblocked signals
can receive them and starve the signalfd.

While some threads in URCU do block signals (e.g. workqueue
worker for rculfhash), the call_rcu, defer_rcu, and rculfhash
partition_resize_helper threads do not.

Always block all signals before creating threads, and only unblock
SIGRCU when registering a urcu-signal thread. Restore the SIGRCU
signal to its pre-registration blocked state on unregistration.

For rculfhash, cds_lfht_worker_init can be removed, because its only
effect is to block all signals except SIGRCU. Blocking all signals is
already done by the workqueue code, and unbloking SIGRCU is now done by
the urcu signal flavor thread regisration.

Co-developed-by: Eric Wong <email address hidden>
Signed-off-by: Eric Wong <email address hidden>
Signed-off-by: Mathieu Desnoyers <email address hidden>
Change-Id: If78346b15bdc287417b992a8963098c6ea0dc7d2

1409. By Mathieu Desnoyers

Fix: futex.h: include headers outside extern C

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

1408. By Mathieu Desnoyers

Fix: add missing unused attribute to _rcu_dereference

Reproduced with gcc-8, gcc-10, gcc-11 in O2:

14:39:19 In file included from ../../include/urcu/pointer.h:39,
14:39:19 from ../../include/urcu-pointer.h:1,
14:39:19 from ../../include/urcu/rcuhlist.h:30,
14:39:19 from ../../include/urcu/cds.h:28,
14:39:19 from test_build.c:30:
14:39:19 test_build.c: In function ‘test_build_rcu_dereference’:
14:39:19 ../../include/urcu/static/pointer.h:102:55: warning: variable ‘_________p0’ set but not used [-Wunused-but-set-variable]
14:39:19 102 | __typeof__(p) _________p0 = { 0 }; \
14:39:19 | ^~~~~~~~~~~
14:39:19 ../../include/urcu/pointer.h:47:33: note: in expansion of macro ‘_rcu_dereference’
14:39:19 47 | #define rcu_dereference _rcu_dereference
14:39:19 | ^~~~~~~~~~~~~~~~
14:39:19 test_build.c:133:9: note: in expansion of macro ‘rcu_dereference’
14:39:19 133 | rcu_dereference(opaque_const);
14:39:19 | ^~~~~~~~~~~~~~~
14:39:19 mv -f .deps/test_urcu_multiflavor_single_unit_dynlink_cxx-test_urcu_multiflavor_single_unit_cxx.Tpo .deps/test_urcu_multiflavor_single_unit_dynlink_cxx-test_urcu_multiflavor_single_unit_cxx.Po
14:39:19 ../../include/urcu/static/pointer.h:102:55: warning: variable ‘_________p0’ set but not used [-Wunused-but-set-variable]
14:39:19 102 | __typeof__(p) _________p0 = { 0 }; \
14:39:19 | ^~~~~~~~~~~
14:39:19 ../../include/urcu/pointer.h:47:33: note: in expansion of macro ‘_rcu_dereference’
14:39:19 47 | #define rcu_dereference _rcu_dereference
14:39:19 | ^~~~~~~~~~~~~~~~
14:39:19 test_build.c:135:9: note: in expansion of macro ‘rcu_dereference’
14:39:19 135 | rcu_dereference(clear_const);
14:39:19 | ^~~~~~~~~~~~~~~

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

1407. By Simon Marchi <email address hidden>

Fix: change method used by _rcu_dereference to strip type constness

Commit 1e41ec3b07e4 ("Make temporary variable in _rcu_dereference
non-const") used the trick to add 0 to the pointer passed as a parameter
to the macro to get rid of its constness, should it be const (with the
end goal of avoiding compiler warnings). This is problematic (as shown
in [1]) if it is a pointer to an opaque type though, as the compiler
cannot perform pointer arithmetic on such a pointer (even though it
wouldn't really need to here, as we add 0).

Change it to use another trick to strip away the constness, that
shouldn't hit this problem. It was found in the same stackoverflow post
as the original trick [2]. It consists of using a statement expression
like so:

    __typeof__(({ const int foo; foo; }))

The statement expression yields a value of type `int`. Statement
expressions are extensions to the C language, but we already use them
here.

The test_build* binaries now need to be linked against the urcu library,
otherwise they would be missing the rcu_dereference_sym symbol.

[1] https://lists.lttng.org/pipermail/lttng-dev/2022-August/030247.html
[2] https://stackoverflow.com/a/54016713

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

1406. By Simon Marchi <email address hidden>

Fix: remove type constness in URCU_FORCE_CAST's C++ version

The test added by the following patch wouldn't compile, when built
without _LGPL_SOURCE:

      CXX test_build_dynlink_cxx-test_build_cxx.o
    In file included from ../../include/urcu/arch.h:25,
                     from /home/simark/src/urcu/tests/unit/test_build.c:28,
                     from /home/simark/src/urcu/tests/unit/test_build_cxx.cpp:3:
    /home/simark/src/urcu/tests/unit/test_build.c: In function ‘void test_build_rcu_dereference()’:
    /home/simark/src/urcu/include/urcu/compiler.h:85:42: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
       85 | #define URCU_FORCE_CAST(type, arg) (reinterpret_cast<type>(arg))
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/simark/src/urcu/include/urcu/pointer.h:71:49: note: in expansion of macro ‘URCU_FORCE_CAST’
       71 | __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p), \
          | ^~~~~~~~~~~~~~~
    /home/simark/src/urcu/tests/unit/test_build.c:133:9: note: in expansion of macro ‘rcu_dereference’
      133 | rcu_dereference(opaque_const);
          | ^~~~~~~~~~~~~~~

The compiler complains that we do a cast to a const type, equivalent to:

  reinterpret_cast<const int>(arg)

... and that the const is meaningless in this context.

Use std::remove_cv to strip away any const or volatile qualifiers from
the type (using a volatile type would result in the same warning).

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

1405. By Simon Marchi <email address hidden>

Move extern "C" down in include/urcu/urcu-bp.h

A following patch adds a <type_traits> include in
urcu/compiler.h. However, compiler.h gets included by urcu/pointer.h,
which gets included by urcu/urcu-bp.h inside an extern "C" scope.
Including the C++ header file <type_traits> inside an extern "C" scope
doesn't work:

    In file included from /home/simark/src/urcu/include/urcu/compiler.h:25,
                     from /home/simark/src/urcu/include/urcu/pointer.h:29,
                     from /home/simark/src/urcu/include/urcu/urcu-bp.h:58,
                     from /home/simark/src/urcu/include/urcu-bp.h:2,
                     from /home/simark/src/urcu/tests/unit/test_urcu_multiflavor-bp.c:28,
                     from /home/simark/src/urcu/tests/unit/test_urcu_multiflavor-bp_cxx.cpp:3:
    /usr/include/c++/12.1.1/type_traits:44:3: error: template with C linkage
       44 | template<typename _Tp>
          | ^~~~~~~~
    /home/simark/src/urcu/include/urcu/urcu-bp.h:41:1: note: ‘extern "C"’ linkage started here
       41 | extern "C" {
          | ^~~~~~~~~~

Move the extern "C" in urcu-bp.h down, so that the includes are not
inside it. Each header file is responsible to use extern "C" where
relevant, and we should avoid including files inside such a scope.

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

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
This branch contains Public information 
Everyone can see this information.

Subscribers