-
Notifications
You must be signed in to change notification settings - Fork 127
Migrate test_xsk.sh in test_progs #8820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
bastien-curutchet
wants to merge
18
commits into
kernel-patches:bpf-next_base
from
bastien-curutchet:b4/xsk
Closed
Migrate test_xsk.sh in test_progs #8820
bastien-curutchet
wants to merge
18
commits into
kernel-patches:bpf-next_base
from
bastien-curutchet:b4/xsk
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi all, This patch series continues the work to migrate the script tests into prog_tests. The test_xsk.sh script tests lots of AF_XDP use cases. The tests it uses are defined in xksxceiver.c. As this script is used to test real hardware, the goal here is to keep it as is and only integrate the tests on veth peers into the test_progs framework. Three tests are flaky on s390 so they won't be integrated to test_progs. PATCH 2 extracts test_xsk[.c/.h] from xskxceiver[.c/.h] to make the tests available to test_progs. PATCH 3 to 6 fix small issues in the current test PATCH 1 / 7 / 8 abstract the log behaviour. It allows to keep kselftest in test_xsk.sh without conflicting with test_progs's framework. PATCH 9 to 14 handle all errors to release resources instead of calling exit() when any error occurs. PATCH 15 isolates the flaky tests PATCH 16 integrate the non-flaky tests to the test_progs framework # Describe the purpose of this series. The information you put here # will be used by the project maintainer to make a decision whether # your patches should be reviewed, and in what priority order. Please be # very detailed and link to any relevant discussions or sites that the # maintainer can review to better understand your proposed changes. If you # only have a single patch in your series, the contents of the cover # letter will be appended to the "under-the-cut" portion of the patch. # Lines starting with # will be removed from the cover letter. You can # use them to add notes or reminders to yourself. If you want to use # markdown headers in your cover letter, start the line with ">#". # You can add trailers to the cover letter. Any email addresses found in # these trailers will be added to the addresses specified/generated # during the b4 send stage. You can also run "b4 prep --auto-to-cc" to # auto-populate the To: and Cc: trailers based on the code being # modified. To: Björn Töpel <[email protected]> To: Magnus Karlsson <[email protected]> To: Maciej Fijalkowski <[email protected]> To: Jonathan Lemon <[email protected]> To: Alexei Starovoitov <[email protected]> To: Daniel Borkmann <[email protected]> To: Andrii Nakryiko <[email protected]> To: Martin KaFai Lau <[email protected]> To: Eduard Zingerman <[email protected]> To: Song Liu <[email protected]> To: Yonghong Song <[email protected]> To: John Fastabend <[email protected]> To: KP Singh <[email protected]> To: Stanislav Fomichev <[email protected]> To: Hao Luo <[email protected]> To: Jiri Olsa <[email protected]> To: Mykola Lysenko <[email protected]> To: Shuah Khan <[email protected]> To: David S. Miller <[email protected]> To: Jakub Kicinski <[email protected]> To: Jesper Dangaard Brouer <[email protected]> Cc: Thomas Petazzoni <[email protected]> Cc: Alexis Lothore <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]> --- Changes in v2: - Re-order patches to split xkxceiver sooner. - Fix the bug reported by Maciej (PATCH 14). - Fix verbose mode in test_xsk.sh - Link to v1: https://lore.kernel.org/r/[email protected] --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 2, "change-id": "20250218-xsk-0cf90e975d14", "prefixes": [ "bpf-next" ], "history": { "v1": [ "[email protected]" ] } } }
The print_verbose macro calls ksft_print_msg(). It isn't convenient if you want to use the xksxceiver.h header without using kselftest. Define a xsk_verbose function that is called by the print_verbose macro. It is then up to the print_verbose caller to instantiate the verbose behaviour. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
AF_XDP features are tested by the test_xsk.sh script but not by the test_progs framework. The tests used by the script are defined in xksxceiver.c which can't be integrated in the test_progs framework as is. Extract these test definitions from xskxceiver{.c/.h} to put them in new test_xsk{.c/.h} files. Keep the main() function and its unshared dependencies in xksxceiver to avoid impacting the test_xsk.sh script which is often used to test real hardware. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
bitmap is used before being initialized. Initialize it to zero before using it. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Some tests introduce memory leaks by not freeing all the pkt_stream objects they're creating. Fix these memory leaks. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
The clean-up done at the end of a test in __testapp_validate_traffic() isn't wrapped in a function. It isn't convenient if we want to use it somewhere else in the code. Wrap the clean-up in two new functions : the first deletes the sockets, the second releases the umem. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
testapp_validate_traffic() doesn't release the sockets and the umem created by the threads if the test isn't currently in its last step. Thus, if the swap_xsk_resources() fails before the last step, the created resources aren't cleaned up. Clean the sockets and the umem in case of swap_xsk_resources() failure. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
test_xsk depends on kselftests. It prevents from integrating it into the test_progs framework. Wrap the ksft_*() calls behind macros to ease the future integration into test_progs. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
test_xsk uses the kselftest framework for its logs. This isn't compatible with the test_progs framework. Create xks_{log/verbose/skip/fail} functions to handle logs. This way, each test_xsk 'user' can define its own logging behaviour. Define the functions in xskxceiver.c. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
init_iface() doesn't have any return value while it can fail. In case of failure it calls exit_on_error() which will terminate the test immediately. Add a return value to init_iface() so errors can be handled more smoothly. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
xsk_reattach_xdp calls exit_on_error() on failures. This exits the program immediately and can lead to memory leaks. Add a return value to the functions handling XDP attachments to handle errors more smoothly. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
exit_on_error() is called when gettimeofday() fails. This exits the program immediately and can lead to memory leaks. Return TEST_FAILURE instead of calling exit_on_error(). Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
TX and RX workers can fail in many places. These failures trigger a call to exit_on_error() which exits the program immediately and can lead to memory leak. Add return value to functions that can fail. Handle failures more smoothly through report_failure(). Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
…ails __testapp_validate_traffic() calls exit_on_error() on failures. This exits the program immediately and can lead to memory leaks. Return TEST_FAILURE instead of calling exit_on_error(). Release the resource of the 1st thread if a failure happens between its creation and the creation of the second thread. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
If any allocation in the pkt_stream_*() helpers fail, exit_on_error() is called. This terminates the program immediately and can lead to memory leaks. Return NULL in case of allocation failure. Return TEST_FAILURE when something goes wrong in the packet generation. Clean up the resources if a failure happens between two steps of a test. Move exit_with_error() definition to xskxceiver.c as it isn't used anymore by test_xsk.c Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Some tests are flaky (especially on s390). So they don't fit in the CI. Remove flaky tests from the tests table so they won't be run by the CI in upcoming patch. Create a flaky_tests table to hold them. Use the flaky table in xskxceiver.c so the tests remain available for HW in test_xsk.sh. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
test_xsk.c isn't part of the test_progs framework. Integrate the tests defined by test_xsk.c into the test_progs framework through a new file : prog_tests/xsk.c. ZeroCopy mode isn't tested in it as veth peers don't support it. Move test_xsk{.c/.h} to prog_tests/. Add the find_bit library to test_progs sources in the Makefile as it is is used by test_xsk.c Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
a041a61
to
b2666a3
Compare
Automatically cleaning up stale PR; feel free to reopen if needed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.