This is a similar patch as [0] but for northd.
ovn-northd needs to recompute next time it resumes from a paused ovn-northd.
However, it should not force an immediate wake-up in every paused
loop, using 100% CPU time.
When ovn-northd receives unixctl command "pause", it should wake-up
once, so it can handle the "pause" in next loop, release the
different locks and force a full recompute next time it becomes active.

[0] Fix 100% CPU when ovn-ic is paused.

Fixes: a8a446360587 ("inc-engine: Adjust the force recompute API.")
Signed-off-by: Xavier Simonart <[email protected]>
---
 northd/ovn-northd.c | 3 ++-
 tests/ovn-northd.at | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 7a64a6ef2..8221ab6a7 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -1173,7 +1173,7 @@ main(int argc, char *argv[])
             ovsdb_idl_wait(ovnsb_idl_loop.idl);
 
             /* Force a full recompute next time we become active. */
-            inc_proc_northd_force_recompute_immediate();
+            inc_proc_northd_force_recompute();
         }
 
         if (clear_idl_track) {
@@ -1237,6 +1237,7 @@ ovn_northd_pause(struct unixctl_conn *conn, int argc 
OVS_UNUSED,
     struct northd_state  *state = state_;
     state->paused = true;
 
+    poll_immediate_wake();
     unixctl_command_reply(conn, NULL);
 }
 
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 7f4a88d4e..02f517abd 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -858,7 +858,13 @@ Status: paused
 AS_BOX([Verify that ovn-northd is paused])
 # Now ovn-northd won't respond by adding a datapath, because it's paused.
 check ovn-nbctl ls-add sw0
+cnt1=$(as northd ovn-appctl -t ovn-northd coverage/read-counter 
poll_zero_timeout)
 check sleep 5
+cnt2=$(as northd ovn-appctl -t ovn-northd coverage/read-counter 
poll_zero_timeout)
+delta=$((cnt2 - cnt1))
+echo "$cnt1 poll_zero_timeout before sleep(5), and $cnt2 after"
+AT_CHECK([test $((cnt2 - cnt1)) -lt 100])
+
 check_row_count Datapath_Binding 0
 
 # Do not resume both main and backup right after each other
-- 
2.47.1

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

Reply via email to