Skip to content

Commit cecb958

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 6b5b0e7 commit cecb958

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
@@ -1180,7 +1180,7 @@ main(int argc, char *argv[])
11801180
ovsdb_idl_wait(ovnsb_idl_loop.idl);
11811181

11821182
/* Force a full recompute next time we become active. */
1183-
inc_proc_northd_force_recompute_immediate();
1183+
inc_proc_northd_force_recompute();
11841184
}
11851185

11861186
if (clear_idl_track) {
@@ -1248,6 +1248,7 @@ ovn_northd_pause(struct unixctl_conn *conn, int argc OVS_UNUSED,
12481248
struct northd_state *state = state_;
12491249
state->paused = true;
12501250

1251+
poll_immediate_wake();
12511252
unixctl_command_reply(conn, NULL);
12521253
}
12531254

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)