History log of /freebsd/tests/sys/netmap/ctrl-api-test.c (Results 1 – 18 of 18)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.5.0
# ecb3a7d4 06-Mar-2025 John Baldwin <jhb@FreeBSD.org>

netmap: Disable a buggy and unsafe test (sync_kloop_conflict)

This test starts two threads to verify that two concurrent threads
cannot enter the kernel loop on the same netmap context. The test
ev

netmap: Disable a buggy and unsafe test (sync_kloop_conflict)

This test starts two threads to verify that two concurrent threads
cannot enter the kernel loop on the same netmap context. The test
even has a comment about a potential race condition where the first
thread enters the loop and is stopped before the second thread tries
to enter the loop. It claims it is fixed by the use of a semaphore.
Unfortunately, the semaphore doesn't close the race.

In the CI setup for CHERI, we run the testsuite once a week against
various architectures using single CPU QEMU instances. Across
multiple recent runs of the plain "aarch64" test the job ran for an
entire day before QEMU was killed by a timeout. The last messages
logged were from this test:

734.881045 [1182] generic_netmap_attach Emulated adapter for tap3312 created (prev was NULL)
734.882340 [ 321] generic_netmap_register Emulated adapter for tap3312 activated
734.882675 [2224] netmap_csb_validate csb_init for kring tap3312 RX0: head 0, cur 0, hwcur 0, hwtail 0
734.883042 [2224] netmap_csb_validate csb_init for kring tap3312 TX0: head 0, cur 0, hwcur 0, hwtail 1023
734.915397 [ 820] netmap_sync_kloop kloop busy_wait 1, direct_tx 0, direct_rx 0, na_could_sleep 0
736.901945 [ 820] netmap_sync_kloop kloop busy_wait 1, direct_tx 0, direct_rx 0, na_could_sleep 0

From the timestamps, the synchronous kloop was entered twice 2 seconds
apart. This corresponds to the 2 second timeout on the semaphore in
the test. What appears to have happened is that th1 started and
entered the kernel where it spun in an endless busy loop. This
starves th2 so it _never_ runs. Once the semaphore times out, th1 is
preempted to run the main thread which invokes the ioctl to stop the
busy loop. th1 then exits the loop and returns to userland to exit.
Only after this point does th2 actually run and execute the ioctl to
enter the kernel. Since th1 has already exited, th2 doesn't error and
enters its own happy spin loop. The main thread hangs forever in
pthread_join, and the process is unkillable (the busy loop in the
kernel doesn't check for any pending signals so kill -9 is ignored and
ineffective).

I don't see a way to fix this test, so I've just disabled it. There
is no good way to ensurce concurrency on a single CPU system when one
thread wants to sit in a spin loop. Someone should fix the netmap
kloop to respond to kill -9 in which case kyua could perhaps at least
timeout the individual test process and kill it.

Reviewed by: vmaffione
Obtained from: CheriBSD
Sponsored by: AFRL, DARPA
Differential Revision: https://reviews.freebsd.org/D49220

show more ...


Revision tags: release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0
# ee5804da 29-Dec-2023 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: fix unit tests

After ad874544d9f018bf8eef4053b5ca7b856c4674cb, interface name
validation has been removed, resulting in two unit tests failures.
Drop the failing tests since they no longer a

netmap: fix unit tests

After ad874544d9f018bf8eef4053b5ca7b856c4674cb, interface name
validation has been removed, resulting in two unit tests failures.
Drop the failing tests since they no longer apply.

Reported by: markj

show more ...


Revision tags: release/14.0.0
# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


Revision tags: release/13.2.0
# e2a431a0 22-Mar-2023 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: fix copyin/copyout of nmreq options list

The previous code unsuccesfully attempted to report a precise error for
each option in the user list. Moreover, commit 253b2ec199b broke some
ctrl-ap

netmap: fix copyin/copyout of nmreq options list

The previous code unsuccesfully attempted to report a precise error for
each option in the user list. Moreover, commit 253b2ec199b broke some
ctrl-api-test (see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260547).

With this patch we bail out as soon as an unrecoverable error is detected and
we properly check for copy boundaries. EOPNOTSUPP no longer immediately
returns an error, so that any other option in the list may be examined
by the caller code and a precise report of the (un)supported options can
be returned to the user.

With this patch, all ctrl-api-test unit tests pass again.

PR: 260547
Submitted by: giuseppe.lettieri@unipi.it
Reviewed by: vmaffione
MFC after: 14 days

show more ...


# f4db3905 05-Dec-2022 John Baldwin <jhb@FreeBSD.org>

netmap tests: Reset ctx->nmctx to NULL in nmreq_parsing.

This avoids leaking a pointer to the on-stack test_nmctx which
triggers a -Wdangling-pointer warning from GCC.

Reviewed by: imp, emaste
Diff

netmap tests: Reset ctx->nmctx to NULL in nmreq_parsing.

This avoids leaking a pointer to the on-stack test_nmctx which
triggers a -Wdangling-pointer warning from GCC.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37536

show more ...


Revision tags: release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0
# 36d6e657 02-Apr-2021 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: update unit tests with libnetmap tests


# 45c67e8f 02-Apr-2021 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: several typo fixes

No functional changes intended.


Revision tags: release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0
# 7648bc9f 13-May-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @347527

Sponsored by: The FreeBSD Foundation


# 4f6858e8 13-Apr-2019 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: add test cases for multiple host rings

Extend the netmap unit tests with new test cases for the multiple-host-rings
feature introduced by r345269.

MFC after: 1 week


# c9c9de93 09-Apr-2019 Enji Cooper <ngie@FreeBSD.org>

Polish netmap(4) testcases a bit

1. Not all kernels have netmap(4) support. Check for netmap(4) support before
attempting to run the tests via the `PLAIN_REQUIRE_KERNEL_MODULE(..)` macro.
2. Libr

Polish netmap(4) testcases a bit

1. Not all kernels have netmap(4) support. Check for netmap(4) support before
attempting to run the tests via the `PLAIN_REQUIRE_KERNEL_MODULE(..)` macro.
2. Libraries shouldn't be added to LDFLAGS; they should be added to LIBADD
instead. This allows the build system to evaluate dependencies for sanity.
3. Sort some of the Makefile variables per bsd.README.

1., in particular, will resolve failures when running this testcase on kernels
lacking netmap(4) support, e.g., the i386 GENERIC kernels on ^/stable/11 and
^/stable/12.

PR: 237129
Reviewed by: vmaffione
Approved by: emaste (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19864

show more ...


# 415e34c4 29-Mar-2019 Alan Somers <asomers@FreeBSD.org>

MFHead@r345677


# 7d757b71 28-Mar-2019 Olivier Cochard <olivier@FreeBSD.org>

Skip this test if if_tap module is not available

PR: 236842
Approved by: asomers
MFC after: 1 month
Sponsored by: Netflix


# f9856d08 21-Mar-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @345353


# 5e874d26 20-Mar-2019 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: update unit tests

Revision r345269 introduced changes that triggered a regression on netmap
unit tests (tests/sys/netmap/ctrl-api-test.c).
This change updates the unit tests to remove the re

netmap: update unit tests

Revision r345269 introduced changes that triggered a regression on netmap
unit tests (tests/sys/netmap/ctrl-api-test.c).
This change updates the unit tests to remove the regression.

Reported by: lwhsu
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19639

show more ...


# 08f34ad9 03-Jan-2019 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: unit tests: fix issues found by coverity scan

Reported by: asomers
MFC after: 1 week
Sponsored by: Sunny Valley Networks


# 5854d718 31-Dec-2018 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: fix warnings on unit tests

Fix some printf() format string warnings raised for ctrl-api-test.c
on some architectures.

MFC after: 1 week
Sponsored by: Sunny Valley Networks


# 2a8682a8 31-Dec-2018 Vincenzo Maffione <vmaffione@FreeBSD.org>

netmap: add suite of unit tests

Import the unit tests from upstream (https://github.com/luigirizzo/netmap
ba02539859d46d33), and make them ready for use with Kyua.
There are currently 38 regression

netmap: add suite of unit tests

Import the unit tests from upstream (https://github.com/luigirizzo/netmap
ba02539859d46d33), and make them ready for use with Kyua.
There are currently 38 regression tests, which test the kernel control ABI
exposed by netmap to userspace applications:

1: test for port info get
2-5: tests for basic port registration
6-9: tests for VALE
10-11: tests for getting netmap allocator info
12-15: tests for netmap pipes
16: test on polling mode
17-18: tests on options
19-27: tests for sync-kloop subsystem
28-39: tests for null ports
31-38: tests for the legacy NIOCREGIF registers

Reviewed by: ngie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18490

show more ...