ovn-ic needs to recompute next time it resumes from a paused ovn-ic.
However, it should not force an immediate wake up in every paused
loop, using 100% CPU time.
When ovn-ic receives unixctl command "pause", it should wake up
once, so it can handle the "pause" in the next loop, release the
different locks and force a full recompute next time it becomes active.

Fixes: 782b8b535438 ("ovn-ic: Introduce incremental processing.")
Signed-off-by: Xavier Simonart <[email protected]>
---
 ic/ovn-ic.c     | 3 ++-
 tests/ovn-ic.at | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index 9611f477d..b5c961d2d 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -4077,7 +4077,7 @@ main(int argc, char *argv[])
             ovsdb_idl_wait(ovnisb_unlocked_idl_loop.idl);
 
             /* Force a full recompute next time we become active. */
-            inc_proc_ic_force_recompute_immediate();
+            inc_proc_ic_force_recompute();
         }
 
         if (clear_idl_track) {
@@ -4126,6 +4126,7 @@ ovn_ic_pause(struct unixctl_conn *conn, int argc 
OVS_UNUSED,
     struct ic_state *state = state_;
     state->paused = true;
 
+    poll_immediate_wake();
     unixctl_command_reply(conn, NULL);
 }
 
diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index 6f4a5b381..007ba0eb8 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -4844,6 +4844,7 @@ ovn_as az1
 check ovn-ic-nbctl ts-add ts1
 
 wait_row_count ic-sb:Datapath_Binding 1 transit_switch=ts1
+cnt1=$(as az1 ovn-appctl -t ic/ovn-ic coverage/read-counter poll_zero_timeout)
 as az1 check ovn-appctl -t ic/ovn-ic pause
 
 ovn_as az2
@@ -4853,6 +4854,10 @@ wait_row_count ic-sb:Datapath_Binding 1 
transit_switch=ts2
 check_row_count ic-sb:Datapath_Binding 2
 check_column "ts1 ts2" ic-sb:Datapath_Binding transit_switch
 
+cnt2=$(as az1 ovn-appctl -t ic/ovn-ic coverage/read-counter poll_zero_timeout)
+echo "$cnt1 poll_zero_timeout before pause; $cnt2 now"
+AT_CHECK([test $((cnt2 - cnt1)) -lt 100])
+
 as az1 check ovn-appctl -t ic/ovn-ic resume
 
 as az2 check ovn-appctl -t ic/ovn-ic pause
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to