diff mbox series

[ovs-dev,v3,1/5] inc-proc-eng: Call clear_tracked_data before recompute.

Message ID 20210427234114.1840474-2-hzhou@ovn.org
State Accepted
Headers show
Series Fix port group conjunction flow explosion problem. | expand

Commit Message

Han Zhou April 27, 2021, 11:41 p.m. UTC
Cleanup partially 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 <hzhou@ovn.org>
---
 controller/ovn-controller.c | 17 -----------------
 lib/inc-proc-eng.c          |  6 ++++++
 2 files changed, 6 insertions(+), 17 deletions(-)

Comments

Mark Gray April 29, 2021, 4:32 p.m. UTC | #1
On 28/04/2021 00:41, Han Zhou wrote:
> Cleanup partially 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 <hzhou@ovn.org>
> ---
>  controller/ovn-controller.c | 17 -----------------
>  lib/inc-proc-eng.c          |  6 ++++++
>  2 files changed, 6 insertions(+), 17 deletions(-)

Acked-by: Mark D. Gray <mark.d.gray@redhat.com>
diff mbox series

Patch

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..c349efb22 100644
--- a/lib/inc-proc-eng.c
+++ b/lib/inc-proc-eng.c
@@ -326,6 +326,12 @@  engine_recompute(struct engine_node *node, bool forced, bool allowed)
         return;
     }
 
+    /* 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);
+    }
+
     /* Run the node handler which might change state. */
     node->run(node, node->data);
     node->stats.recompute++;