Skip to content

Commit 9054c40

Browse files
simonartxavieralmusil
authored andcommitted
northd: Fix 100% CPU when northd is paused.
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: a8a4463 ("inc-engine: Adjust the force recompute API.") Signed-off-by: Xavier Simonart <xsimonar@redhat.com> Acked-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ales Musil <amusil@redhat.com> (cherry picked from commit 8651a32)
1 parent e43f1cf commit 9054c40

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

northd/ovn-northd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ main(int argc, char *argv[])
11721172
ovsdb_idl_wait(ovnsb_idl_loop.idl);
11731173

11741174
/* Force a full recompute next time we become active. */
1175-
inc_proc_northd_force_recompute_immediate();
1175+
inc_proc_northd_force_recompute();
11761176
}
11771177

11781178
if (clear_idl_track) {
@@ -1240,6 +1240,7 @@ ovn_northd_pause(struct unixctl_conn *conn, int argc OVS_UNUSED,
12401240
struct northd_state *state = state_;
12411241
state->paused = true;
12421242

1243+
poll_immediate_wake();
12431244
unixctl_command_reply(conn, NULL);
12441245
}
12451246

tests/ovn-northd.at

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,13 @@ Status: paused
858858
AS_BOX([Verify that ovn-northd is paused])
859859
# Now ovn-northd won't respond by adding a datapath, because it's paused.
860860
check ovn-nbctl ls-add sw0
861+
cnt1=$(as northd ovn-appctl -t ovn-northd coverage/read-counter poll_zero_timeout)
861862
check sleep 5
863+
cnt2=$(as northd ovn-appctl -t ovn-northd coverage/read-counter poll_zero_timeout)
864+
delta=$((cnt2 - cnt1))
865+
echo "$cnt1 poll_zero_timeout before sleep(5), and $cnt2 after"
866+
AT_CHECK([test $((cnt2 - cnt1)) -lt 100])
867+
862868
check_row_count Datapath_Binding 0
863869

864870
# Do not resume both main and backup right after each other

0 commit comments

Comments
 (0)