Skip to content

datapath/loader: Add new complexity tests for verifier#40367

Merged
dylandreimerink merged 4 commits intomainfrom
pr/dylandreimerink/new-complexity-tests
Jul 16, 2025
Merged

datapath/loader: Add new complexity tests for verifier#40367
dylandreimerink merged 4 commits intomainfrom
pr/dylandreimerink/new-complexity-tests

Conversation

@dylandreimerink
Copy link
Copy Markdown
Member

@dylandreimerink dylandreimerink commented Jul 4, 2025

This PR introduces a new test runner for the BPF verifier complexity tests. This new runner still uses the existing files to get all of the build permutations to be ran, in addition it also allows for multiple permutations of load-time config to be tried for each build permutation.

The new runner also has a number of other improvements. First, we new reuse code from the loader to invoke the compiler in the exact same way we do in the cilium agent at runtime.

Second, we now run the tests in parallel, all build permutations and load-time configurations are run in parallel, which should speed up the test suite significantly.

Third, we tell the verifier to not spit out the entire verifier log, just the stats. This increases the speed of verification and lowers memory usage. When a load fails, we enable detailed verifier logs and re-attempt to gather the full log in such cases. On load failure, this full verifier log is emitted as test artifact along with the object file that failed to load. The --full-log flag can be used to force the full log to be emitted for all loads, even when successful. In case we want to do analysis of the successful logs.

Last, we enable additional stats gathering in the verifier, giving us the stack depth (amount of bytes of stack used by a program) and verifier verification time in microseconds (more accurate than time the full syscall takes). All stats collected are always emitted in a test artifact as a JSON file, which should be easy to query with jq or similar tools.

Fixes: #39143

Improved capabilities of verifier complexity tests

@dylandreimerink dylandreimerink added area/loader Impacts the loading of BPF programs into the kernel. area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. area/CI-improvement Topic or proposal to improve the Continuous Integration workflow dont-merge/preview-only Only for preview or testing, don't merge it. release-note/ci This PR makes changes to the CI. labels Jul 4, 2025
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch 2 times, most recently from 7fe7bc7 to b5287e4 Compare July 4, 2025 12:08
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from b5287e4 to baab150 Compare July 4, 2025 12:25
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from baab150 to 040e8bb Compare July 4, 2025 12:46
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from 040e8bb to 7ab236b Compare July 4, 2025 12:58
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from 7ab236b to 16ade69 Compare July 4, 2025 13:13
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from 16ade69 to ed636f4 Compare July 4, 2025 14:05
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from ed636f4 to 3d910cf Compare July 7, 2025 09:34
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

1 similar comment
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from d50b767 to d23eb05 Compare July 7, 2025 10:33
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from d23eb05 to a1ab085 Compare July 7, 2025 10:42
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from a1ab085 to 326171e Compare July 7, 2025 11:22
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from 326171e to c1d4d37 Compare July 7, 2025 11:47
@dylandreimerink
Copy link
Copy Markdown
Member Author

/ci-verifier

@dylandreimerink dylandreimerink added this pull request to the merge queue Jul 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 15, 2025
@dylandreimerink dylandreimerink added this pull request to the merge queue Jul 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 15, 2025
There are some differences in the flags used by the makefile and the
loader package when invoking the compiler. This commit ensures that the
flags used by the makefile and the loader package match.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
This commit introduces a new test runner for the BPF verifier
complexity tests. This new runner still uses the existing files to get
all of the build permutations to be ran, in addition it also allows
for multiple permutations of load-time config to be tried for each
build permutation.

The new runner also has a number of other improvements. First, we
new reuse code from the loader to invoke the compiler in the exact
same way we do in the cilium agent at runtime.

Second, we now run the tests in parallel, all build permutations and
load-time configurations are run in parallel, which should speed up the
test suite significantly.

Third, we tell the verifier to not spit out the entire verifier log,
just the stats. This increases the speed of verification and lowers
memory usage. When a load fails, we enable detailed verifier logs
and re-attempt to gather the full log in such cases. On load failure,
this full verifier log is emitted as test artifact along with the
object file that failed to load. The `--full-log` flag can be used
to force the full log to be emitted for all loads, even when successful.
In case we want to do analysis of the successful logs.

Last, we enable additional stats gathering in the verifier, giving us
the stack depth (amount of bytes of stack used by a program) and
verifier verification time in microseconds (more accurate than
time the full syscall takes).
All stats collected are always emitted in a test artifact as a JSON
file, which should be easy to query with jq or similar tools.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
In v1.18 we changed the minimum supported kernel version to v5.10.
For a while we still were testing RHEL 8.6 against v5.4, but that is
no longer the case since #40390.

So we can remove the compile permutations for v5.4.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
Now that we have a new complexity test runner that lives in the
loader package we can delete the old one.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
@dylandreimerink dylandreimerink force-pushed the pr/dylandreimerink/new-complexity-tests branch from c07ff12 to 48ce612 Compare July 15, 2025 14:57
@dylandreimerink
Copy link
Copy Markdown
Member Author

/test

@dylandreimerink dylandreimerink added this pull request to the merge queue Jul 16, 2025
Merged via the queue into main with commit 3baa506 Jul 16, 2025
362 of 366 checks passed
@dylandreimerink dylandreimerink deleted the pr/dylandreimerink/new-complexity-tests branch July 16, 2025 13:26
dylandreimerink added a commit that referenced this pull request Sep 26, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Sep 26, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Sep 26, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Sep 29, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Oct 1, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Nov 19, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Nov 19, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Nov 19, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
dylandreimerink added a commit that referenced this pull request Nov 21, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
github-merge-queue bot pushed a commit that referenced this pull request Nov 24, 2025
Since #40367 the verifier complexity test has gained the ability to
output JSON files with all the results. So far these were emitted as
artifacts per kernel.

This commit expends the JSON files by adding the kernel version which
produced the results. This allows us to merge all results together
into one big JSON file. The workflow is modified to download all
separate artifacts and to merge them into one big JSON file which is
then uploaded as an artifact. This will allow us to collect tests
results from scheduled runs to track complexity over time.

This commit also changes the workflow to run the complexity tests
twice when triggered on a PR. The first run is on the base/merge branch
and then on the HEAD of the PR branch. The merged results of both
are then compared by a new tool `complexity-diff` which outputs
the diff in a separate JSON file as well as outputting a markdown
summary.

The summary states the most significant changes in complexity and
stack depth as result of the current PR. It also states the 15 largest
programs in terms of complexity and stack depth.

For every "program" the summary lists the permutation with the smallest
number "min" and the largest number "max". Though results for all
permutations are available in the JSON files.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
@cilium-release-bot cilium-release-bot bot moved this to Released in cilium v1.19.0 Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/CI-improvement Topic or proposal to improve the Continuous Integration workflow area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. area/loader Impacts the loading of BPF programs into the kernel. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/ci This PR makes changes to the CI.

Projects

No open projects
Status: Released

Development

Successfully merging this pull request may close these issues.

Set runtime configuration in verifier tests

6 participants