Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,35 @@ Before submitting a new test target, verify both of these:

1. A normal product build without `--enable-tests` does not build the test.
2. A build configured with `--enable-tests` builds and runs the selected suite.

## RCU fork queue regression

`test-rcu-fork-queue` runs on POSIX hosts with `--enable-tests`, including
non-KZT and non-LATX configurations. It covers empty forks, callbacks that
queue another callback, and forks with concurrently published callbacks still
queued. A blocking callback pauses the consumer outside the grace-period lock,
so the ordinary atfork lock path can proceed. The blocker itself has already
been dequeued and is outside the queue-preservation contract.

LATX/KZT configurations also register `test-rcu-fork-queue-held-reader`, which
holds a reader across fork and covers lazy and deferred child startup. This
scenario depends on KZT's atfork path not waiting for the parent's grace period.
Both cases check each callback marked published after `call_rcu1()` returns:
after the child drains, every published callback in its snapshot must have run
exactly once. A publisher remains active during the forks, and the parent still
checks all 512 callbacks. Child drains run one at a time and the test is
scheduled before other suite entries because QEMU user-mode can strand a
post-fork worker startup when several emulated threaded-fork workloads compete;
this scheduling does not relax the per-callback assertions.

Run the common case explicitly (the binary is not part of the default build):

```sh
meson test -C build64-tests test-rcu-fork-queue --print-errorlogs
```

With LATX/KZT enabled, also run:

```sh
meson test -C build64-tests test-rcu-fork-queue-held-reader --print-errorlogs
```
19 changes: 19 additions & 0 deletions tests/unit/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,25 @@ test(
suite: 'lat-pr-fast',
)

if 'CONFIG_POSIX' in config_host
test_rcu_fork_queue = executable(
'test-rcu-fork-queue',
files('test-rcu-fork-queue.c') + genh,
include_directories: include_directories('../..'),
dependencies: [glib, qemuutil],
build_by_default: false,
)
# QEMU user-mode can strand post-fork worker startup after several emulated
# tests have competed. Run this fork/thread stress test first and isolated.
test('test-rcu-fork-queue', test_rcu_fork_queue,
suite: 'lat-pr-fast', timeout: 45, is_parallel: false, priority: 100)
if 'CONFIG_LATX' in config_host and 'CONFIG_LATX_KZT' in config_host
test('test-rcu-fork-queue-held-reader', test_rcu_fork_queue,
args: ['--held-reader'], suite: 'lat-pr-fast', timeout: 45,
is_parallel: false, priority: 100)
endif
endif

if 'CONFIG_LATX' in config_host
test_x11_async_handler = executable(
'test-x11-async-handler',
Expand Down
Loading