From patchwork Wed Mar 20 05:41:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1913862 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::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4TzyCH6NfZz1yWy for ; Wed, 20 Mar 2024 16:42:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5B8E04019D; Wed, 20 Mar 2024 05:42:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vDEf-K0gWv_J; Wed, 20 Mar 2024 05:42:00 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5B28740146 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5B28740146; Wed, 20 Mar 2024 05:42:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2C1ABC0072; Wed, 20 Mar 2024 05:42:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id ACE4CC0037 for ; Wed, 20 Mar 2024 05:41:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 865A5606B8 for ; Wed, 20 Mar 2024 05:41:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jdzbacP9VYap for ; Wed, 20 Mar 2024 05:41:58 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=217.70.183.200; helo=relay7-d.mail.gandi.net; envelope-from=hzhou@ovn.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 8F1FD6068A Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=ovn.org DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8F1FD6068A Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8F1FD6068A for ; Wed, 20 Mar 2024 05:41:56 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id C1C7720002; Wed, 20 Mar 2024 05:41:53 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Tue, 19 Mar 2024 22:41:27 -0700 Message-Id: <20240320054127.979228-1-hzhou@ovn.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-GND-Sasl: hzhou@ovn.org Subject: [ovs-dev] [PATCH ovn] ovn-controller: Fix busy loop when ofctrl is disconnected. 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" ovn-controller runs at 100% cpu when OVS exits. This is because the ofctrl_run is not called while ofctrl_wait is always called in the main loop. Because of the missing ofctrl_run, it doesn't even detect that the ofctrl connection is disconnected. This patch fixes the issue by always giving a chance to run ofctrl_run as long as ofctrl_wait is called. Fixes: 1d6d953bf883 ("controller: Don't artificially limit group and meter IDs to 16bit.") Fixes: 94cbc59dc0f1 ("ovn-controller: Fix use of dangling pointers in I-P runtime_data.") Signed-off-by: Han Zhou Acked-by: Dumitru Ceara --- controller/ofctrl.c | 2 +- controller/ovn-controller.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/controller/ofctrl.c b/controller/ofctrl.c index f14cd79a8dbb..1a2d2be791eb 100644 --- a/controller/ofctrl.c +++ b/controller/ofctrl.c @@ -787,7 +787,7 @@ ofctrl_run(const struct ovsrec_bridge *br_int, rconn_run(swconn); - if (!rconn_is_connected(swconn)) { + if (!rconn_is_connected(swconn) || !pending_ct_zones) { return reconnected; } diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 1c9960c708bf..c9ff5967a2af 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -5736,10 +5736,11 @@ main(int argc, char *argv[]) } } - if (br_int && ovs_feature_set_discovered()) { + if (br_int) { ct_zones_data = engine_get_data(&en_ct_zones); - if (ct_zones_data && ofctrl_run(br_int, ovs_table, - &ct_zones_data->pending)) { + if (ofctrl_run(br_int, ovs_table, + ct_zones_data ? &ct_zones_data->pending + : NULL)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); @@ -5748,7 +5749,7 @@ main(int argc, char *argv[]) engine_set_force_recompute(true); } - if (chassis) { + if (chassis && ovs_feature_set_discovered()) { encaps_run(ovs_idl_txn, br_int, sbrec_chassis_table_get(ovnsb_idl_loop.idl), chassis,