From patchwork Thu May 4 06:59:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1776730 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=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M9dz424H; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QBl6v0KKKz213r for ; Thu, 4 May 2023 16:59:33 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BD09F83AF2; Thu, 4 May 2023 06:59:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org BD09F83AF2 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M9dz424H X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3cWUkzbfMBBh; Thu, 4 May 2023 06:59:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 938B581DF3; Thu, 4 May 2023 06:59:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 938B581DF3 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5DA2AC0037; Thu, 4 May 2023 06:59:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 254ABC002A for ; Thu, 4 May 2023 06:59:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id EC183409A7 for ; Thu, 4 May 2023 06:59:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EC183409A7 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M9dz424H X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fRak5Wi4zSl6 for ; Thu, 4 May 2023 06:59:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BA5F64094C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id BA5F64094C for ; Thu, 4 May 2023 06:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683183564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Eu3Ln+59JxXU2ieiS7Sf0xxSt43shqClxPYF4TCi1EI=; b=M9dz424HNWzL4NtyJotZf0BacL0DSW62iBVmVzB9rASsWcFKDYz0SrT4ymhbysajpu1kJf DMsDNTn70orusqBqc2Mxt21U7oLWl6cawHbVh7w4fZb52SsMrspSk5to3yZ9YyXYoo9cof FxgUlSlmJCnExYaOufnnNrKg4Zxsm/8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-97-A0wu9-APO3-OSMTnfd7sYQ-1; Thu, 04 May 2023 02:59:22 -0400 X-MC-Unique: A0wu9-APO3-OSMTnfd7sYQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9BDB6280BC45 for ; Thu, 4 May 2023 06:59:22 +0000 (UTC) Received: from amusil.. (unknown [10.34.131.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A700C15BAD; Thu, 4 May 2023 06:59:22 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Thu, 4 May 2023 08:59:21 +0200 Message-Id: <20230504065921.28651-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] system-tests: Try to load modules only if they weren't loaded before X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When the system is busy with multiple test running concurrently the modprobe might fail with "Device or resource busy", which will fail the whole test. Instead of always trying to load the module check if it's already loaded. Also replace the AT_CHECK with OVS_WAIT_UNTIL which should reduce the chance of failing on initial contention. Signed-off-by: Ales Musil --- tests/system-common-macros.at | 13 ------------ tests/system-kmod-macros.at | 39 +++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at index e6f204cc1..c6ba7fb4f 100644 --- a/tests/system-common-macros.at +++ b/tests/system-common-macros.at @@ -330,19 +330,6 @@ m4_define([OVS_CHECK_CT_CLEAR], m4_define([OVS_CHECK_CT_ZERO_SNAT], [AT_SKIP_IF([! grep -q "Datapath supports ct_zero_snat" ovs-vswitchd.log])]) -# LOAD_MODULE([name]) -# -# Tries to load specified kernel module and removes it after -# if it wasn't loaded before this call. -# -m4_define([LOAD_MODULE], - [if ! lsmod | grep -q $1; then - on_exit 'modprobe -q -r $1' - fi - AT_CHECK([modprobe $1]) - ] -) - # OVN_TEST_IPV6_PREFIX_DELEGATION() m4_define([OVN_TEST_IPV6_PREFIX_DELEGATION], [ diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at index 787a59c97..df1b2147f 100644 --- a/tests/system-kmod-macros.at +++ b/tests/system-kmod-macros.at @@ -1,3 +1,30 @@ +# LOAD_MODULE([name]) +# +# Tries to load specified kernel module and removes it after +# if it wasn't loaded before this call. +# +m4_define([LOAD_MODULE], + [if ! lsmod | grep -q $1; then + OVS_WAIT_UNTIL([modprobe $1]) + on_exit 'modprobe -q -r $1' + fi + ] +) + +# TRY_LOAD_MODULE([name]) +# +# Tries to load specified kernel module, it won't fail +# if modprobe didn't succeed, and removes it after +# if it wasn't loaded before this call. +# +m4_define([TRY_LOAD_MODULE], + [if ! lsmod | grep -q $1; then + modprobe $1 || echo "Module $1 not loaded." + on_exit 'modprobe -q -r $1' + fi + ] +) + # _ADD_BR([name]) # # Expands into the proper ovs-vsctl commands to create a bridge with the @@ -16,12 +43,9 @@ m4_define([_ADD_BR], [[add-br $1 -- set Bridge $1 protocols=OpenFlow10,OpenFlow1 # Best-effort loading of all available vport modules is performed. # m4_define([OVS_TRAFFIC_VSWITCHD_START], - [AT_CHECK([modprobe openvswitch]) - on_exit 'modprobe -r openvswitch' + [LOAD_MODULE([openvswitch]) m4_foreach([mod], [[vport_geneve], [vport_gre], [vport_lisp], [vport_stt], [vport_vxlan]], - [modprobe -q mod || echo "Module mod not loaded." - on_exit 'modprobe -q -r mod' - ]) + [TRY_LOAD_MODULE([mod])]) on_exit 'ovs-dpctl del-dp ovs-system' on_exit 'ovs-appctl dpctl/flush-conntrack' _OVS_VSWITCHD_START([]) @@ -60,10 +84,7 @@ m4_define([CONFIGURE_VETH_OFFLOADS], # m4_define([CHECK_CONNTRACK], m4_foreach([mod], [[nf_conntrack_ipv4], [nf_conntrack_ipv6], [nf_nat_ftp], - [nf_nat_tftp]], - [modprobe mod || echo "Module mod not loaded." - on_exit 'modprobe -r mod' - ]) + [nf_nat_tftp]], [TRY_LOAD_MODULE([mod])]) sysctl -w net.netfilter.nf_conntrack_helper=0 on_exit 'ovstest test-netlink-conntrack flush' )