From patchwork Wed Sep 23 17:11:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venugopal Iyer X-Patchwork-Id: 1369972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nvidia.com header.i=@nvidia.com header.a=rsa-sha256 header.s=n1 header.b=guDh82Dz; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BxPnf6Cdxz9sTC for ; Thu, 24 Sep 2020 03:10:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 577BA8614A; Wed, 23 Sep 2020 17:10:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CYoF7fhLr6n9; Wed, 23 Sep 2020 17:10:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 92B8484AD2; Wed, 23 Sep 2020 17:10:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 68C07C0859; Wed, 23 Sep 2020 17:10:22 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id F27B1C0051 for ; Wed, 23 Sep 2020 17:10:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DFACB868C3 for ; Wed, 23 Sep 2020 17:10:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XuOMxyOoJV4K for ; Wed, 23 Sep 2020 17:10:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by whitealder.osuosl.org (Postfix) with ESMTPS id 2777784468 for ; Wed, 23 Sep 2020 17:10:20 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 23 Sep 2020 10:10:06 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 23 Sep 2020 17:10:19 +0000 Received: from nviyer-1.nvidia.com (10.124.1.5) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Wed, 23 Sep 2020 17:10:19 +0000 From: To: Date: Wed, 23 Sep 2020 10:11:08 -0700 Message-ID: <20200923171108.8620-1-venugopali@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1600881006; bh=VyMq3BZyE7nSDTwgPwKaPK8BPUKlmy2IMoO0UTUxpIs=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:X-NVConfidentiality: MIME-Version:Content-Type; b=guDh82Dz94iczN4p/0wJepeUwvkyKshr0nOJQRfmkEEiE8yUJtl2VOzMz9Q9kc8Ol bnd7HiyCrelwBzpOD+P1Vm/hlsB/Uzl0lujDMo78F/yTD6o6FxNgcMx+KTDULU8+uN eZZi2zao/mCGpYDruOVB+wSWM9C+UPh0ulTndHPe1lEJa4KqfLzUg+mF8Lvk2Z0bWl RDOCxCLdQYovnt2/NIWBjb/aqgNRyZmCr3GzAEWt755QBo9DO3aQLDjkIqm9K3/c1Q qF9fWja9qFKqdTry4vmrZhEPTeBTwbuWmcjXHau1cTKeaKHu3TDNd3IY2bbxj/LMbi mGLTLHAE9xafA== Cc: venugopali@nvidia.com Subject: [ovs-dev] [PATCH ovn 1/1] ovn-controller: Check for tunnel change in multi-vtep case is incorrect 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" From: venu iyer Prior to multi-vtep, there was one tunnel for each type, since there was only one encap-ip. So, the check in chassis_tunnels_changed(): sset_count(encap_type_set) != encap_type_count worked. However, with multiple IPs per tunnel type, the above check won't work. So, once multiple encap-ips are configured, ovn-controller will always keep updating the encap list in the SB (due to the above check); this causes a lot of unnecessary churn, including recomputing the flows etc. which will put ovn-controller in overdrive thereby consuming lot of CPU cycles (see almost 100%). Verified ovn-controller cpu utilization with the fix (and also that SB doesn't keep constantly updating). make check didn't show any additional failures. Signed-off-by: venu iyer (venugopali@nvidia.com) --- controller/chassis.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/controller/chassis.c b/controller/chassis.c index a365188e8..a6dfb92df 100644 --- a/controller/chassis.c +++ b/controller/chassis.c @@ -415,14 +415,15 @@ chassis_tunnels_changed(const struct sset *encap_type_set, const char *encap_csum, const struct sbrec_chassis *chassis_rec) { - size_t encap_type_count = 0; + struct sset chassis_rec_encap_type_set; + sset_init(&chassis_rec_encap_type_set); for (size_t i = 0; i < chassis_rec->n_encaps; i++) { if (!sset_contains(encap_type_set, chassis_rec->encaps[i]->type)) { return true; } - encap_type_count++; + sset_add(&chassis_rec_encap_type_set, chassis_rec->encaps[i]->type); if (!sset_contains(encap_ip_set, chassis_rec->encaps[i]->ip)) { return true; @@ -441,7 +442,8 @@ chassis_tunnels_changed(const struct sset *encap_type_set, return true; } - if (sset_count(encap_type_set) != encap_type_count) { + if (sset_count(encap_type_set) != + sset_count(&chassis_rec_encap_type_set)) { return true; }