Commit graph

32 commits

Author SHA1 Message Date
Warner Losh fdafd315ad sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:00 -07:00
Kristof Provost ab393e9548 netlink: move NETLINK define to opt_global.h
Move the NETLINK define into opt_global.h so we can rely on it being
set correctly, without having to remember to include opt_netlink.h.
This ensures that the NETLINK define is correctly set. If not we
may end up with unloadable modules, due to missing symbols (such as
nlmsg_get_group_writer).

PR:		274306
Reviewed by:	imp, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42179
2023-10-13 09:23:47 +02:00
Warner Losh 031beb4e23 sys: Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:58 -06:00
Warner Losh 685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh 71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Alexander V. Chernikov 0eb0d23335 ktest: make ktest work with Netlink loaded as a module.
MFC after:	2 weeks
2023-06-13 06:04:14 +00:00
Warner Losh 4d846d260e 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
2023-05-12 10:44:03 -06:00
Alexander V. Chernikov f656a96020 tests: make ktest build on ppc.
MFC after:	2 weeks
2023-04-17 13:47:07 +00:00
Alexander V. Chernikov 3e5d0784b9 Testing: add framework for the kernel unit tests.
This changes intends to reduce the bar to the kernel unit-testing by
 introducing a new kernel-testing framework ("ktest") based on Netlink,
 loadable test modules and python test suite integration.

This framework provides the following features:
* Integration to the FreeBSD test suite
* Automatic test discovery
* Automatic test module loading
* Minimal boiler-plate code in both kernel and userland
* Passing any metadata to the test
* Convenient environment pre-setup using python testing framework
* Streaming messages from the kernel to the userland
* Running tests in the dedicated taskqueues
* Skipping or parametrizing tests

Differential Revision: https://reviews.freebsd.org/D39385
MFC after:	2 weeks
2023-04-14 15:47:55 +00:00
Alexander V. Chernikov cbfba56c45 routing: add IPv6 fib validation procedure.
Allow consistency validation of the inet6 fib based on rib data.
Validation can be kicked off by loading test_lookup module and
 running sysctl net.route.test.run_inet6_scan=1

MFC after:	1 week
2021-08-16 23:04:01 +00:00
Alexander V. Chernikov 4a77a9b649 routing: Use process fib instead of fib 0 when conducting tests.
* Allow to do validation/performance tests by using process
 fib instead of default fib 0.
* Print all validation errors instead of just the first one.

MFC after:	1 week
2021-08-15 22:10:14 +00:00
Marko Zec b6f8436b09 tests: Revise FIB lookups per second benchmarking routines
Fix a bug in the LPM SEQ benchmark (missing break inside a switch block)
by restructuring the test loop, while introducing additional two
synthetic test options:

ANN: scan only the address space announced in current RIB
REP: repeat lookups over several keys in a sliding window scheme

The total of eight combinations of test options are now available
through dedicated sysctl hooks.

Differential Revision:	<https://reviews.freebsd.org/D30311>
Reviewed by:	melifaro
MFC after:	3 days
2021-06-17 08:49:09 +02:00
Marko Zec a43104ebe7 Revise FIB lookups per second benchmarking routines.
Add a LPS benchmark variant which introduces artificial dependencies
between successive lookups. While here, instead of writing the results
from the lookups to a huge array, add them to an accumulator, in a more
lightweight attempt at preventing the CPU's OOO machinery from
discarding the lookup results if they would be completely unused.

net.route.test.run_lps_rnd measures LPS throughput with independent
uniformly random keys

net.route.test.run_lps_seq measures LPS throughput with uniformly
random keys with artificial interdependencies
Reviewed by:	melifaro
MFC after:	7 days
Differential Revision: https://reviews.freebsd.org/D30096
2021-05-05 12:28:17 +02:00
Alexander V. Chernikov b8598e2ff6 Add IPv4 fib lookup performance tests with uniform keys.
Submitted by:	zec
MFC after:	1 week
2021-03-30 14:32:28 +01:00
Alexander V. Chernikov 74935ce881 Enable running fib tests inside vnet jail. 2021-01-17 20:32:26 +00:00
Alexander V. Chernikov 0433870efe Add fib lookup testing module.
This module intended to measure performance of routing lookups.

Uses a list of IP addresses specified by sysctl one-by-one.
Performance testing is triggered by changing sysctl OID with a number of lookups to execute.
Lookups are done by the chunks of 10K routes, entering/exiting epoch on
 chunk granularity to amortise cost.

Example:
make -C sys/modules/test/fib_lookup unload load
for i in `cat ~/ip4.txt`; do sysctl net.route.test.add_inet_addr=$i; done
for i in `cat ~/ip6.txt`; do sysctl net.route.test.add_inet6_addr=$i; done

sysctl net.route.test.run_inet=10000000

dmesg | tail

Dec 13 23:24:05 current kernel: 10000000 packets in 417240173 nanoseconds, 23967011 pps
Dec 13 23:24:06 current kernel: run: 10000000 packets vnet 0xfffff80003073f00
Dec 13 23:24:07 current kernel: 10000000 packets in 423086254 nanoseconds, 23635842 pps

Differential Revision: https://reviews.freebsd.org/D27604
2021-01-09 13:20:30 +00:00
Hans Petter Selasky 72d849c761 Add small tool to invoke kernel test framework tests.
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-09-02 09:20:40 +00:00
Hans Petter Selasky b1acfb2401 Fix build of epoch_test module.
While at it add missing epoch_free() call.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-09-02 09:17:29 +00:00
Pawel Biernacki 7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
Warner Losh 52467047aa Regularize the Netflix copyright
Use recent best practices for Copyright form at the top of
the license:
1. Remove all the All Rights Reserved clauses on our stuff. Where we
   piggybacked others, use a separate line to make things clear.
2. Use "Netflix, Inc." everywhere.
3. Use a single line for the copyright for grep friendliness.
4. Use date ranges in all places for our stuff.

Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files)
2019-02-04 21:28:25 +00:00
Matt Macy 471826c25f epoch_test: fix compile
- update to new interface

Reported by:	manu
2018-07-15 00:31:17 +00:00
Matt Macy 70398c2f86 epoch(9): Make epochs non-preemptible by default
There are risks associated with waiting on a preemptible epoch section.
Change the name to make them not be the default and document the issue
under CAVEATS.

Reported by:	markj
2018-05-18 17:29:43 +00:00
Matt Macy 5e68a3dfe3 epoch: add non-preemptible "critical" variant
adds:
- epoch_enter_critical() - can be called inside a different epoch,
  starts a section that will acquire any MTX_DEF mutexes or do
  anything that might sleep.
- epoch_exit_critical() - corresponding exit call
- epoch_wait_critical() - wait variant that is guaranteed that any
  threads in a section are running.
- epoch_global_critical - an epoch_wait_critical safe epoch instance

Requested by:   markj
Approved by:	sbruno
2018-05-18 01:52:51 +00:00
Matt Macy ef7f29d8e6 Test priority handling in epoch test.
- Double the number of test threads to mp_ncpu*2
- Give each thread a different scheduling priority
2018-05-11 04:47:05 +00:00
Matt Macy 06bf2a6aef Add simple preempt safe epoch API
Read locking is over used in the kernel to guarantee liveness. This API makes
it easy to provide livenes guarantees without atomics.

Includes epoch_test kernel module to stress test the API.

Documentation will follow initial use case.

Test case and improvements to preemption handling in response to discussion
with mjg@

Reviewed by:	imp@, shurd@
Approved by:	sbruno@
2018-05-10 17:55:24 +00:00
Enji Cooper 704816dd28 style(9): sort headers
MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-05-09 05:08:47 +00:00
Enji Cooper 55c61f2a2a style(9): sort headers and remove duplicates
MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-05-09 04:54:29 +00:00
Randall Stewart 6541c039b9 Style 9 changes.
MFC after:	1 Month
2015-11-12 10:31:14 +00:00
Konstantin Belousov e72a4bdeb2 Fix UP build. 2015-11-12 09:20:10 +00:00
Bryan Drewery b3932817a4 Remove redundant declaration for sysctl kern.
This is trying to fix the GCC build.

MFC after:	1 month
X-MFC-With:	r290663
2015-11-11 16:24:52 +00:00
Bryan Drewery 5d811cd568 Use a proper prototype.
This was a failure in the GCC build.

MFC after:	1 month
X-MFC-With:	r290663
2015-11-11 16:23:07 +00:00
Randall Stewart f52e50aef4 Add a kernel test framework. The callout_test is a demonstration and will only
work with the upcoming async-drain functionality. Tests can be added
to the tests directory and then the framework can be used to launch
those tests.

MFC after:	1 month
Sponsored by:	Netflix Inc.
Differential Revision:	https://reviews.freebsd.org/D1755
2015-11-10 14:14:41 +00:00