From patchwork Thu Apr 22 07:30:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1469039 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=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FQpyF0BYkz9sTD for ; Thu, 22 Apr 2021 17:31:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 45F3840584; Thu, 22 Apr 2021 07:31:26 +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 nhc3-i3EvoUG; Thu, 22 Apr 2021 07:31:25 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTP id 7F2AD40500; Thu, 22 Apr 2021 07:31:24 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 56497C000E; Thu, 22 Apr 2021 07:31:24 +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 E5044C000B for ; Thu, 22 Apr 2021 07:31:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C7F6440E4A for ; Thu, 22 Apr 2021 07:31:22 +0000 (UTC) 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 cIiv9ZDGzJpQ for ; Thu, 22 Apr 2021 07:31:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp4.osuosl.org (Postfix) with ESMTPS id 88B10404B5 for ; Thu, 22 Apr 2021 07:31:21 +0000 (UTC) X-Originating-IP: 98.37.104.183 Received: from localhost-live.hsd1.ca.comcast.net (unknown [98.37.104.183]) (Authenticated sender: hzhou@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id AF1EA1C000B; Thu, 22 Apr 2021 07:31:17 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Thu, 22 Apr 2021 00:30:35 -0700 Message-Id: <20210422073038.130392-1-hzhou@ovn.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn 1/4] inc-proc-eng: Call clear_tracked_data before recompute. 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" Cleanup particially tracked data due to some of the change handler executions before falling back to recompute. This is done already in the en_runtime_data_run() implementation, but this patch makes it a generic behavior of the I-P engine. Signed-off-by: Han Zhou --- controller/ovn-controller.c | 17 ----------------- lib/inc-proc-eng.c | 5 +++++ 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 6f7c9ea61..13c03131c 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1412,23 +1412,6 @@ en_runtime_data_run(struct engine_node *node, void *data) struct sset *local_lport_ids = &rt_data->local_lport_ids; struct sset *active_tunnels = &rt_data->active_tunnels; - /* Clear the (stale) tracked data if any. Even though the tracked data - * gets cleared in the beginning of engine_init_run(), - * any of the runtime data handler might have set some tracked - * data and later another runtime data handler might return false - * resulting in full recompute of runtime engine and rendering the tracked - * data stale. - * - * It's possible that engine framework can be enhanced to indicate - * the node handlers (in this case flow_output_runtime_data_handler) - * that its input node had a full recompute. However we would still - * need to clear the tracked data, because we don't want the - * stale tracked data to be accessed outside of the engine, since the - * tracked data is cleared in the engine_init_run() and not at the - * end of the engine run. - * */ - en_runtime_data_clear_tracked_data(data); - static bool first_run = true; if (first_run) { /* don't cleanup since there is no data yet */ diff --git a/lib/inc-proc-eng.c b/lib/inc-proc-eng.c index a6337a1d9..161327404 100644 --- a/lib/inc-proc-eng.c +++ b/lib/inc-proc-eng.c @@ -327,6 +327,11 @@ engine_recompute(struct engine_node *node, bool forced, bool allowed) } /* Run the node handler which might change state. */ + /* Clear tracked data before calling run() so that partially tracked data + * from some of the change handler executions are cleared. */ + if (node->clear_tracked_data) { + node->clear_tracked_data(node->data); + } node->run(node, node->data); node->stats.recompute++; }