From patchwork Thu Jul 10 22:52:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 2109761 X-Patchwork-Delegate: amusil@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4bdlqz1kJ6z1xrk for ; Fri, 11 Jul 2025 18:53:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6DC9881206; Fri, 11 Jul 2025 08:54:00 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Yq7wK12h7zXR; Fri, 11 Jul 2025 08:53:59 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3E64380DD9 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3E64380DD9; Fri, 11 Jul 2025 08:53:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 18F9FC0012; Fri, 11 Jul 2025 08:53:59 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 892C9C0011 for ; Fri, 11 Jul 2025 08:53:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 67D04400B8 for ; Fri, 11 Jul 2025 08:53:57 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SoQxXr1LB8p3 for ; Fri, 11 Jul 2025 08:53:56 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.218.67; helo=mail-ej1-f67.google.com; envelope-from=i.maximets.ovn@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 4917440151 Authentication-Results: smtp2.osuosl.org; dmarc=none (p=none dis=none) header.from=ovn.org DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4917440151 Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by smtp2.osuosl.org (Postfix) with ESMTPS id 4917440151 for ; Fri, 11 Jul 2025 08:53:56 +0000 (UTC) Received: by mail-ej1-f67.google.com with SMTP id a640c23a62f3a-ae0b2ead33cso338226266b.0 for ; Fri, 11 Jul 2025 01:53:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752224034; x=1752828834; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gT32wXVYZR/c1Jj344IR8SLt0oPCoWL70QJ7+qI6R54=; b=Y9CwJPnRvA32DUzb9ZSMPmHpf84TkFNkanzsKRcRPOOBDjvyJTJLFiBNEPxuUAEMsV o7Rw6RD9rv4aDjoRqudCwrPJ2+k/ezwLwy3EY4SULxr34rV9GR773ZVU7Q2eYuBYfO6w 4N6sA6wynJ9X/za07s/CbCam1O+YZwDJYUFrfCKN3TGf+kGgmGf46TFb/C7L4jA1Er3S 5R1s3HncNjpNUG98+qddv/sOI0ha1gNc5hsYl02HN/azhTm3INXk6yjkpjczSWthCExb 7o40c+/ZSi4G7tZfmiujxIAUBeYeXhuxn5MB6z5Zfepk+VRvwpyqOL5tTBlFQqqRc8QB MxOg== X-Gm-Message-State: AOJu0YwMGRDkreGdTk0LzJ9VsVSJtzdTYeqt59Qpj2/HZPn8zkgvEHsY 7fQquZby1sCHfLpoieUH/PPL4kzghEO/Mo+7+/PPMkbLxRftmMjg8bBm5X9jN8Q6 X-Gm-Gg: ASbGncu8ynaNsWH4mjLQOqB+AMyE7RHTGq8AA83dNdLKtt2brBXt0UcHPJusL/nBibU YTGJ/hYyuwJXnmeLm9YpfM6KwivCx9q7m/XH0H0v9UatyVx186EuNe4UjaXqTb9NnxzAdFhfdCP +S+7SHjwBmVGe/EvGDETILkPslU83y5+KkIGXS8VW77m96JaMDNj1vsVUHF4wqf7DjAGM5oTsxt 8IHOAftPNXA4yjmPGtvTMxU+h9wg/TsJweOoeupxvo3P0PJJt8m1DZuYpZK0NIUy61XjjL1w7Oz vJYBtZL94Las3hRhnOJSXkX1aAQ+i63pQLpGnDvfbFqRkCJoQV5wLEMpPJ71h0JNuqnx4CNLE1m JdOEjwdBtoO3i7iomLWaU66AwXfGIk5/XxgOkmLrjmfsNmFNH3UIdeHVYBg== X-Google-Smtp-Source: AGHT+IG+Bsm3ZWe1NPOuI6x0daxwcjLTQ5pSQY/2TzLiQPK25mihC678prXZ3HWeW1c81aEBqcgjcg== X-Received: by 2002:a17:906:6a1d:b0:ae3:6038:ad6f with SMTP id a640c23a62f3a-ae6e227b995mr751499766b.3.1752224033777; Fri, 11 Jul 2025 01:53:53 -0700 (PDT) Received: from im-t490s.redhat.com (37-48-10-116.nat.epc.tmcz.cz. [37.48.10.116]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-611c95232d8sm1932782a12.18.2025.07.11.01.53.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jul 2025 01:53:53 -0700 (PDT) From: Ilya Maximets To: ovs-dev@openvswitch.org Cc: Dumitru Ceara , Ilya Maximets Date: Fri, 11 Jul 2025 10:52:53 +0200 Message-ID: <20250711085349.3718464-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] tests: Add support for running system tests under retis. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Retis is very useful for debugging our system tests or debugging kernel issues through our system tests. This change adds a convenient way to run any kernel system test with the retis capture on the background. E.g.: make check-kernel OVS_TEST_WITH_RETIS=yes TESTSUITEFLAGS='168 -d' Retis 1.5 is required, since we're using ifdump profile, and it also will mount debugfs for us in case of running in a different namespace. It should be available in $PATH. In addition to just capturing the retis.data, we're also running the capture with --print to print all the events as they appear, and producing the sorted output in the end. This makes it easier to work across systems with different versions of retis and saves time for running the sort manually. The raw data is still available for advanced processing, if needed. Not specifying any particular collector, capturing everything that's enabled by default. OVS tracking is turned on by default. Since OVS tracking is used, it's required to start retis after the kernel datapath is created, otherwise it will fail to obtain the map of upcall PIDs. That's why we need to start it after the bridge is created. This also makes it necessary to build the OVS submodule with --enable-usdt-probes flag, otherwise retis may refuse to start when it can't find any probes in the running ovs-vswitchd. Only adding support for kernel test suite for now. For userspace test suites it may also be useful at some point, but currently that requires running without --ovs-track and isn't too important. Startup of the retis capture adds significant amount of time to each test, so not running it by default. This change is ported from the corresponding OVS change: https://github.com/openvswitch/ovs/commit/22732c0e6770597031d1eb0a61ec922ea296c8b1 The environment variable name starts with OVS_ for that reason. But we already have the OVS_PAUSE_TEST, so just following the pattern. The DAEMONIZE() macro is changed to use 'on_exit' instead of appending commands directly to the 'cleanup' file. That ensures the correct ordering between stopping the daemon and running the 'retis sort', as 'on_exit' ensures that cleanup commands are executed in the reverse order. This makes the macro similar to OVS_DAEMONIZE in the OVS repo. In the future, a similar change can be made in the NETNS_DAEMONIZE() as well to ensure the proper ordering, but it's not necessary for now. Link: https://github.com/retis-org/retis Signed-off-by: Ilya Maximets --- Documentation/topics/testing.rst | 24 ++++++++++++++++++++++++ NEWS | 3 +++ tests/system-common-macros.at | 17 ++++++++++++++--- tests/system-kmod-macros.at | 3 +++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Documentation/topics/testing.rst b/Documentation/topics/testing.rst index d85dc50c6..cc928ef64 100644 --- a/Documentation/topics/testing.rst +++ b/Documentation/topics/testing.rst @@ -220,6 +220,30 @@ All the features documented under `Unit Tests`_ are available for the datapath testsuites, except that the datapath testsuites do not support running tests in parallel. +It is also possible to run `retis`_ capture along with the `check-kernel` tests +by setting `OVS_TEST_WITH_RETIS` environment variable to 'yes'. This can be +useful for debugging the test cases. For example, the following command can be +used to run the test 168 under `retis`:: + + $ make check-kernel OVS_TEST_WITH_RETIS=yes TESTSUITEFLAGS='168 -d' + +After the test is completed, the following data will be available in the test +directory: + +* `retis.err` - standard error stream of the `retis collect`. +* `retis.log` - standard output of the `retis collect`, contains all captured + events in the order they appeared. +* `retis.data` - raw events collected by retis, `retis sort` or other commands + can be used on this file for further analysis. +* `retis.sorted` - text file containing the output of `retis sort` executed on + the `retis.data`, for convenience. + +Requires retis version 1.5 or newer. And this also requires OVS submodule to +be built with `--enable-usdt-probes`. + +.. _retis: https://github.com/retis-org/retis + + Performance testing ~~~~~~~~~~~~~~~~~~~ diff --git a/NEWS b/NEWS index 8fa0c3f26..365134d61 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,9 @@ Post v25.03.0 - Added a new ACL option "--all" to "acl-list" command. When set, "acl-list" command will also list port groups ACLs associated with each port of the target logical switch. + - Added support for running tests from the 'check-kernel' system test target + under retis by setting OVS_TEST_WITH_RETIS=yes. See the 'Testing' section + of the documentation for more details. OVN v25.03.0 - 07 Mar 2025 -------------------------- diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at index 93979ff62..a49776f38 100644 --- a/tests/system-common-macros.at +++ b/tests/system-common-macros.at @@ -244,9 +244,20 @@ m4_define([FORMAT_CT], # m4_define([DAEMONIZE], [$1 & echo $! > $2 - echo "kill \`cat $2\`" >> cleanup - ] -) + on_exit "kill \`cat $2\`" + ]) + +# RETIS_CHECK_AND_RUN() +# +# Start retis to track all the traffic passing through OVS. +m4_define([RETIS_CHECK_AND_RUN], + [if test "$OVS_TEST_WITH_RETIS" = yes && retis --version > /dev/null; then + on_exit 'retis sort --utc retis.data > retis.sorted' + DAEMONIZE([retis -p ifdump collect --utc --allow-system-changes \ + --ovs-track --out --print 2>retis.err 1>retis.log], + [retis.pid]) + OVS_WAIT_UNTIL([grep -q 'loaded' retis.err]) + fi]) # NETNS_DAEMONIZE([namespace], [command], [pidfile]) # diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at index 41a8b7914..1ada0077e 100644 --- a/tests/system-kmod-macros.at +++ b/tests/system-kmod-macros.at @@ -30,6 +30,9 @@ m4_define([OVS_TRAFFIC_VSWITCHD_START], if test OVN_MONITOR_ALL = yes; then ovs-vsctl set open . external_ids:ovn-monitor-all=true fi + + dnl Start retis capture if requested. + RETIS_CHECK_AND_RUN() ]) # OVS_TRAFFIC_VSWITCHD_STOP([ALLOWLIST], [extra_cmds])