From patchwork Fri Feb 2 09:32:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 1894414 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=EYuy6b5G; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=EYuy6b5G; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TR9YB1KmZz23g7 for ; Fri, 2 Feb 2024 20:32:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E89C38467D; Fri, 2 Feb 2024 09:32:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E89C38467D Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=EYuy6b5G; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=EYuy6b5G 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 gpvxpP5hL4vf; Fri, 2 Feb 2024 09:32:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id C622B8462F; Fri, 2 Feb 2024 09:32:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C622B8462F Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 88EFEC0072; Fri, 2 Feb 2024 09:32:37 +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 E8269C0037 for ; Fri, 2 Feb 2024 09:32:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 997B042E8D for ; Fri, 2 Feb 2024 09:32:35 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 997B042E8D Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=EYuy6b5G; dkim=pass (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=EYuy6b5G 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 Y8Z4D2Qkqvu1 for ; Fri, 2 Feb 2024 09:32:34 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::600]) by smtp4.osuosl.org (Postfix) with ESMTPS id BE18F42E60 for ; Fri, 2 Feb 2024 09:32:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BE18F42E60 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=kv2GSqQb6Qxu1Q9+KfviEhmGpIGeD49roakfuCke+7Q7I5Utlo4AUYkq/r4jQtVBZN26uE6VpZwKbCri1k4tHYxeI3vReSrRORtclvkJe0ZzNFpWdkLyHZUeNZ1EqkWpX+hwyi4ocHcct07KlS2l/ik/qLI4qg18SziK4RRVCI0quamf9NF9R4wc4jxwGpG/wPdkEupQizhxW16O6255LYBUWdA/Dc7GBgkjVYtjV81YTgTevo//z5aupaW2w6CfEgzk0sY6nDTG6+QXQUF1xbXYt6K85VSQG8ztWn8Z9UjvnNSHBmFy5II7d+ppFQg0Xv8waQeftTr+2DBjtlLutA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6zL1zOTFAhrO7eSuzOTcuBPjXKCeoTOBsd1zm6Jt2ks=; b=nU4P59PCjq05GRK4xditmMV4JEkSuFmR9eMAvPzojop++Y0e+b+/hEYjMvLIvZWc7xSBg4FJJ2cz9afJk0TYYiss2gQMFsfjWg/XJbsMu24QLEy0/7rhQw7LEPLo6Z1VXnAhXALEYkDvo87cvWWD+Hf1PVlaMXCyoGSoJsGijilO5iwyMc5YkD25GdWyJTdJwRopfFPTN6xjypnB4yLAWamKdi1xcj+9qZFcQRWfHpw1e8ft2UOFmwOslCxE9/JssXnyO1jIqKazPBqJ4tuBwjO/eELA3XubhDbMsTrywgELQpPW5aBkX8edP+vJUVts5sz8fkPMM408zWWS4UqUNQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 52.169.0.179) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=mail.schwarz; dmarc=pass (p=reject sp=none pct=100) action=none header.from=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=mail.schwarz] dkim=[1,1,header.d=mail.schwarz] dmarc=[1,1,header.from=mail.schwarz]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6zL1zOTFAhrO7eSuzOTcuBPjXKCeoTOBsd1zm6Jt2ks=; b=EYuy6b5G3gj0oGyFLBFp7X9P5oucntMEHxQE+VlI9duB/UYEUX/pIiu4Eqfm8PColXfpoamgsx3+D1lNKPIEyapse5MzQs1kkJEwUvOdd/Mx10h4m2QoMzRk3dtenaOSCU5wlIYpXxba5LZPNs05Ujb+XcPwWnyVNbDbJ5IEe16vN5HBgP3ljq9b/NC1wTSxmy3o1p1Y4lGLzP5aeH4O4bUQRei9sH5gXJIfTHgCDq3IlUFIFVGr18htCKp2gubMVlyBQEPq85nCkEgBBcgevjO+YOjor53hA2fh/Tu5i79XFBFXEsuJQv/7e+F3j2phIxKbmLTyTRcc1hgNnc7j6Q== Received: from DU2PR04CA0054.eurprd04.prod.outlook.com (2603:10a6:10:234::29) by AS1PR10MB5508.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:473::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.30; Fri, 2 Feb 2024 09:32:29 +0000 Received: from DU6PEPF0000B61B.eurprd02.prod.outlook.com (2603:10a6:10:234:cafe::c1) by DU2PR04CA0054.outlook.office365.com (2603:10a6:10:234::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.30 via Frontend Transport; Fri, 2 Feb 2024 09:32:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 52.169.0.179) smtp.mailfrom=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz;dmarc=pass action=none header.from=mail.schwarz; Received-SPF: Pass (protection.outlook.com: domain of mail.schwarz designates 52.169.0.179 as permitted sender) receiver=protection.outlook.com; client-ip=52.169.0.179; helo=eu2.smtp.exclaimer.net; pr=C Received: from eu2.smtp.exclaimer.net (52.169.0.179) by DU6PEPF0000B61B.mail.protection.outlook.com (10.167.8.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.7249.19 via Frontend Transport; Fri, 2 Feb 2024 09:32:24 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (104.47.13.51) by eu2.smtp.exclaimer.net (52.169.0.179) with Exclaimer Signature Manager ESMTP Proxy eu2.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_ECDHE_WITH_AES256_SHA384); Fri, 2 Feb 2024 09:32:27 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 30905196 X-ExclaimerImprintLatency: 1530732 X-ExclaimerImprintAction: c03f95f027ba4d2c95d9d53d5d5551f4 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a97jm8m4uyWddAkGMSxE2VdeeKn29FQi0Mb/5z3VWHIJffVgEk0HVUKMMZme0KwtSlK7WY35fH0nqGbvWjYgsiijTw8baiMoxPFxTIqyGAzbrHaV+5P64PTKLLz9oEpkFy5Ner+rmHSjS6iomNT+V9+57LuVZiPX5liF5TBj8slt6l1YM1x3AI/eS0YS1dT7WZC29HJqR7JTDBVcH9WR5WQdcqSMrANznqTjktOgFeBpE4OM+31z3kpmXCviWL+pc6rgFjbm1WpT359ch6D9X5+WI9zeYjXK9em98SLlYx1Rw6A3iJOFXsCBO4p+QNvxazmAMmmRbT6eEAc9a3Z/UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6zL1zOTFAhrO7eSuzOTcuBPjXKCeoTOBsd1zm6Jt2ks=; b=Sr4MZj99I6KSx3HK92jq34Ho864kjBslPf6yzPzsGFGUYkOpwKIOQR6uekakU8xHRMeRGWpxC67R+gCYMo8e1/Rx91ViY61LeKY3Y7K6mbBSJQUMvwqiC3gbWo5upobvrBLICmUBjPuiWhW68oziOE7KtBqlTHlEXndkNDF0rpemjCamvkYutiuRMsT1xl2wwwz53X8j7B9GCqS4fI9tZ725W4EwL8/xOaY8c4tUO3wPAq54pBtdbvf+cWwckhNKYzSJ4tkHPjaMGbol7T0d3CUBuNNxRDRr97YnbgJ9xDaKaQEhlQ6KVn2+dul9lFFTIHO1yhpRdJc4Jhz+uucHBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mail.schwarz; dmarc=pass action=none header.from=mail.schwarz; dkim=pass header.d=mail.schwarz; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6zL1zOTFAhrO7eSuzOTcuBPjXKCeoTOBsd1zm6Jt2ks=; b=EYuy6b5G3gj0oGyFLBFp7X9P5oucntMEHxQE+VlI9duB/UYEUX/pIiu4Eqfm8PColXfpoamgsx3+D1lNKPIEyapse5MzQs1kkJEwUvOdd/Mx10h4m2QoMzRk3dtenaOSCU5wlIYpXxba5LZPNs05Ujb+XcPwWnyVNbDbJ5IEe16vN5HBgP3ljq9b/NC1wTSxmy3o1p1Y4lGLzP5aeH4O4bUQRei9sH5gXJIfTHgCDq3IlUFIFVGr18htCKp2gubMVlyBQEPq85nCkEgBBcgevjO+YOjor53hA2fh/Tu5i79XFBFXEsuJQv/7e+F3j2phIxKbmLTyTRcc1hgNnc7j6Q== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mail.schwarz; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DU0PR10MB7589.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:402::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.24; Fri, 2 Feb 2024 09:32:21 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::1d63:bb69:8522:de5b]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::1d63:bb69:8522:de5b%7]) with mapi id 15.20.7249.024; Fri, 2 Feb 2024 09:32:21 +0000 Date: Fri, 2 Feb 2024 10:32:19 +0100 To: dev@openvswitch.org Message-ID: Mail-Followup-To: dev@openvswitch.org, luca.czesla@mail.schwarz, max.lamprecht@mail.schwarz Content-Disposition: inline X-ClientProxiedBy: FR3P281CA0117.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::8) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DU0PR10MB7589:EE_|DU6PEPF0000B61B:EE_|AS1PR10MB5508:EE_ X-MS-Office365-Filtering-Correlation-Id: e54087f0-7d9f-47d6-98c2-08dc23d1df1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 5mcVdzgge5Z/PbIUad832HaClB5LYjcrJzOjbw3guXF3bj3iVlUbOF4AZGaqob3qfMpW2yOZ7XsTgwQFxImiggsT5IS27piCEQLhxLLaGcPKHDzbSdZ+PH6H7k+qy8+2qo8n0OJrcTND9NarWHnOEa8orSZWVIb3SCY8i6s7U1nX0JAlkgUkhThStynPQutLL7n0DWeDcL+C6lpryQ7h0KhxvJ6hBmofawsbO48GwWY6d6fxXgwyt1ouSnMY6nQnfzXJgFmCNMaVf4jupgZX9Z9zbyik26nxf2LkXXsnsdRO9h2Gd5JGVqLvMQvnnj8NShlzhV99j4mYUUnTTxPlJQGHckfcyWhGNX5DAUc8XWrw2oTSyBIq1rL1gRhSGlBdvvCO9wGqw2uX6IdLSpZTy+y6BkA+zWqbE91q3U9FRkIU/cV14869Hu/FTzZD4V2L0Llov0EdU9fF7b4vgX0MrZtjtdKLvR3siGJH+KlsLxrGL5TtDQoN1OB22tY8BTYsW+aLijlzGcqkjlG9sgp14j4l8Dg9h5ZCPyQNh90Vo8Y= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(396003)(376002)(346002)(366004)(136003)(39860400002)(230922051799003)(64100799003)(1800799012)(186009)(451199024)(66556008)(6916009)(6486002)(66476007)(966005)(66946007)(6512007)(316002)(478600001)(9686003)(8676002)(6506007)(8936002)(44832011)(4326008)(107886003)(2906002)(83380400001)(5660300002)(26005)(38100700002)(86362001)(41300700001)(82960400001)(66574015); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR10MB7589 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU6PEPF0000B61B.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 76422eb5-4593-4a2c-27c3-08dc23d1db02 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d8JhAD/FbHrATPXApmR54gaa9YQEaae03lpuR4zrpxYLq/S4NRGHH9LjRKV/Iu7MAI3ZQplwvdxMs957iFObKEr65Vs+stwe4yU3IOZmcneCGTnIj/Eu1LB/73pwUhSNshzoP6M+DP3EyXl+73mSM9ewNeRCHnQ23m51vmA9ZtaDAV92J+SSyTcS+Rj//owxIf7oR3dr9XupP784qHTOnUKahCV9O4ldY2RSBPJ5aPWKtrDut6lv2FaQ20xKb2n6QfjeaH1U0scQovVfM4q83O2vgAq2QYR1IvOPRAvZJ0T+/UX2MIWE6BgjBd9vklDxNm8r0XYyMDTu3kJ0KhvI5D/Y6Aqjr6FN05C79mOiruZDC+qhhFcBNeJ29D3lAt9GG56puo0bR2Q9F8XfG6WWym8euKsWUDZuSzqXUD54CAgF8waql8iOOnnpSaS3vZmP5Detd8p5QU9r8Vp31ttJma7jqqaPyhdkMP94eI3iuzLBrupmwTbYeyTsRol6ZwhMxAVy2TVO8gV9CFmgOwLLuXXNIY/SFX9xc1yAyj8+FN4qN1oAYl0KiWTH9+ZsViBPkoUF6kNeBbm5x8fMvvL0PcgLVUgM1xyaVFajhwkpQKx4JfMwn69kOfulkOOpoUgGknig3VfN8EsO/3yPkmNohJPsDtVi3aDRjHpkxv5rfvXiQ96Y3CncQdcmA6vb2a9iuxY2GLDZS1q1VLwDv4kLF5juQW/D/vXItNCjbT/eqLA= X-Forefront-Antispam-Report: CIP:52.169.0.179; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:eu2.smtp.exclaimer.net; PTR:eu2.smtp.exclaimer.net; CAT:NONE; SFS:(13230031)(4636009)(136003)(396003)(346002)(376002)(39860400002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(82310400011)(40470700004)(36840700001)(46966006)(41300700001)(47076005)(107886003)(83380400001)(26005)(66574015)(336012)(7636003)(7596003)(82960400001)(356005)(8936002)(70206006)(70586007)(8676002)(2906002)(4326008)(5660300002)(316002)(44832011)(36860700001)(6506007)(6916009)(82740400003)(86362001)(6512007)(9686003)(478600001)(6486002)(966005)(40460700003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: mail.schwarz X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2024 09:32:24.9544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e54087f0-7d9f-47d6-98c2-08dc23d1df1f X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d04f4717-5a6e-4b98-b3f9-6918e0385f4c; Ip=[52.169.0.179]; Helo=[eu2.smtp.exclaimer.net] X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000B61B.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR10MB5508 Subject: [ovs-dev] [PATCH v2] netlink-conntrack: Optimize flushing ct zone. 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: , X-Patchwork-Original-From: Felix Huettner via dev From: Felix Huettner Reply-To: Felix Huettner Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Previously the kernel did not provide a netlink interface to flush/list only conntrack entries matching a specific zone. With [1] it is now possible to flush and list conntrack entries filtered by zone. Older kernels not yet supporting this feature will ignore the filter. For the list request that means just returning all entries (which we can then filter in userspace as before). For the flush request that means deleting all conntrack entries. These significantly improves the performance of flushing conntrack zones when the conntrack table is large. Since flushing a conntrack zone is normally triggered via an openflow command it blocks the main ovs thread and thereby also blocks new flows from being applied. Using this new feature we can reduce the flushing time for zones by around 93%. In combination with OVN the creation of a Logical_Router (which causes the flushing of a ct zone) could block other operations, e.g. the failover of Logical_Routers (as they cause new flows to be created). This is visible from a user perspective as a ovn-controller that is idle (as it waits for vswitchd) and vswitchd reporting: "blocked 1000 ms waiting for main to quiesce" (potentially with ever increasing times). The following performance tests where run in a qemu vm with 500.000 conntrack entries distributed evenly over 500 ct zones using `ovstest test-netlink-conntrack flush zone=`. With this patch and kernel v6.8-rc2: ----------------------------------------------------------------------------------------------------------------------------------------------------- Min (s) Median (s) 90%ile (s) 99%ile (s) Max (s) Mean (s) Total (s) Count ----------------------------------------------------------------------------------------------------------------------------------------------------- flush zone with 1000 entries 0.260 0.319 0.335 0.348 0.362 0.320 80.02 250 flush zone with no entry 0.228 0.298 0.325 0.340 0.348 0.296 73.93 250 ----------------------------------------------------------------------------------------------------------------------------------------------------- With this patch and kernel v6.7.1: ----------------------------------------------------------------------------------------------------------------------------------------------------- Min (s) Median (s) 90%ile (s) 99%ile (s) Max (s) Mean (s) Total (s) Count ----------------------------------------------------------------------------------------------------------------------------------------------------- flush zone with 1000 entries 3.946 4.237 4.367 4.495 4.543 4.236 1058.992 250 flush zone with no entry 3.462 4.460 4.662 4.931 5.390 4.430 1107.479 250 ----------------------------------------------------------------------------------------------------------------------------------------------------- Without this patch and kernel v6.8-rc2: ----------------------------------------------------------------------------------------------------------------------------------------------------- Min (s) Median (s) 90%ile (s) 99%ile (s) Max (s) Mean (s) Total (s) Count ----------------------------------------------------------------------------------------------------------------------------------------------------- flush zone with 1000 entries 3.497 4.349 4.522 4.773 5.054 4.331 1082.802 250 flush zone with no entry 3.212 4.010 4.572 6.003 6.396 4.071 1017.838 250 ----------------------------------------------------------------------------------------------------------------------------------------------------- [1]: https://github.com/torvalds/linux/commit/eff3c558bb7e61c41b53e4c8130e514a5a4df9ba Co-Authored-By: Luca Czesla Signed-off-by: Luca Czesla Co-Authored-By: Max Lamprecht Signed-off-by: Max Lamprecht Signed-off-by: Felix Huettner --- v1->v2: - fixed wrong signed-off-by lib/netlink-conntrack.c | 57 +++++++++++++++++++++++++++++++++++++++-- tests/system-traffic.at | 8 ++++++ 2 files changed, 63 insertions(+), 2 deletions(-) base-commit: 1be7f896af85f2777f8147df207612339b4480c0 diff --git a/lib/netlink-conntrack.c b/lib/netlink-conntrack.c index 492bfcffb..1b050894d 100644 --- a/lib/netlink-conntrack.c +++ b/lib/netlink-conntrack.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "byte-order.h" #include "compiler.h" @@ -141,6 +142,9 @@ nl_ct_dump_start(struct nl_ct_dump_state **statep, const uint16_t *zone, nl_msg_put_nfgenmsg(&state->buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, NLM_F_REQUEST); + if (zone) { + nl_msg_put_be16(&state->buf, CTA_ZONE, htons(*zone)); + } nl_dump_start(&state->dump, NETLINK_NETFILTER, &state->buf); ofpbuf_clear(&state->buf); @@ -283,23 +287,72 @@ nl_ct_flush_zone(uint16_t flush_zone) return err; } #else + +static bool +netlink_flush_supports_zone(void) +{ + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; + static bool supported = false; + + if (ovsthread_once_start(&once)) { + struct utsname utsname; + int major, minor; + + if (uname(&utsname) == -1) { + VLOG_WARN("uname failed (%s)", ovs_strerror(errno)); + } else if (!ovs_scan(utsname.release, "%d.%d", &major, &minor)) { + VLOG_WARN("uname reported bad OS release (%s)", utsname.release); + } else if (major < 6 || (major == 6 && minor < 8)) { + VLOG_INFO("disabling conntrack flush by zone in Linux kernel %s", + utsname.release); + } else { + supported = true; + } + ovsthread_once_done(&once); + } + return supported; +} + int nl_ct_flush_zone(uint16_t flush_zone) { - /* Apparently, there's no netlink interface to flush a specific zone. + /* In older kernels, there was no netlink interface to flush a specific + * conntrack zone. * This code dumps every connection, checks the zone and eventually * delete the entry. + * In newer kernels there is the option to specifiy a zone for filtering + * during dumps. Older kernels ignore this option. We set it here in the + * hope we only get relevant entries back, but fall back to filtering here + * to keep compatibility. * - * This is race-prone, but it is better than using shell scripts. */ + * This is race-prone, but it is better than using shell scripts. + * + * Additionally newer kernels also support flushing a zone without listing + * it first. */ struct nl_dump dump; struct ofpbuf buf, reply, delete; + int err; + + if (netlink_flush_supports_zone()) { + ofpbuf_init(&buf, NL_DUMP_BUFSIZE); + + nl_msg_put_nfgenmsg(&buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, + IPCTNL_MSG_CT_DELETE, NLM_F_REQUEST); + nl_msg_put_be16(&buf, CTA_ZONE, htons(flush_zone)); + + err = nl_transact(NETLINK_NETFILTER, &buf, NULL); + ofpbuf_uninit(&buf); + + return err; + } ofpbuf_init(&buf, NL_DUMP_BUFSIZE); ofpbuf_init(&delete, NL_DUMP_BUFSIZE); nl_msg_put_nfgenmsg(&buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, NLM_F_REQUEST); + nl_msg_put_be16(&buf, CTA_ZONE, htons(flush_zone)); nl_dump_start(&dump, NETLINK_NETFILTER, &buf); ofpbuf_clear(&buf); diff --git a/tests/system-traffic.at b/tests/system-traffic.at index f363a778c..869728a1d 100644 --- a/tests/system-traffic.at +++ b/tests/system-traffic.at @@ -3214,6 +3214,14 @@ AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=,dport=),reply=(src=10.1.1.4,dst=10.1.1.3,sport=,dport=),zone=2,protoinfo=(state=) ]) +dnl flushing one zone should leave the others intact +AT_CHECK([ovs-appctl dpctl/flush-conntrack zone=2]) +AT_CHECK([ovs-appctl dpctl/dump-conntrack zone=1 | FORMAT_CT(10.1.1.2)], [0], [dnl +tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=,dport=),reply=(src=10.1.1.2,dst=10.1.1.1,sport=,dport=),zone=1,protoinfo=(state=) +]) +AT_CHECK([ovs-appctl dpctl/dump-conntrack zone=2 | FORMAT_CT(10.1.1.4)], [0], [dnl +]) + OVS_TRAFFIC_VSWITCHD_STOP AT_CLEANUP