On 11/16/26 9:51 AM, Xavier Simonart wrote: > Hi Rosemarie > > Thanks for reviewing this patch. > > On Sat, Nov 14, 2026 at 1:53 AM Rosemarie O'Riorden > <[email protected] <mailto:[email protected]>> wrote: > > Hi Xavier, thanks for the fix. I just have a question below. > > On 11/6/26 4:08 AM, Xavier Simonart via dev wrote: > > Since [0], en_route_exchange has en_sb_cond_seqno as an input > > without change handler. > > en_sb_cond_seqno changes are common with conditional monitoring > > (e.g., a port being claimed), and with no handler such change forces > > a node recompute. > > en_route_exchange is SB_WRITE, so if this recompute occurs while > > OpenFlow has backlog, it gets canceled, which forces a full > > recompute later, including a lflow_run recompute. > > This was caught by sporadic failures of test [1], which was > > validating that no lflow_run occurs when claiming a port. > > > > Replace route_exchange_sb_ro_handler with route_exchange_sb_handler, > > shared by both the 'sb_ro' and 'sb_cond_seqno' inputs. > > It performs the sync when possible, returning > > EN_HANDLED_UNCHANGED/EN_HANDLED_UPDATED instead of EN_UNHANDLED. > > > > It never forces a recompute: > > - when the gate did not move, there is nothing to do. > > - when it did move but SB is not writable, it is safe to wait > > quietly, since 'sb_ro' will fire again when SB becomes writable, > > and we could not have synced this iteration anyway. > > This is unrelated to oflow backlog, as it does not program openflows. > > > > [0] 'controller: Defer route updates until routes load.' > > [1] "ovn-controller incremental processing". > > > > Reported-at: https://redhat.atlassian.net/browse/FDP-4699 > <https://redhat.atlassian.net/browse/FDP-4699> > > Assisted-by: Claude Sonnet 5, Claude Code > > Fixes: a3e697fb9798 ("controller: Defer route updates until routes > load.") > > Signed-off-by: Xavier Simonart <[email protected] > <mailto:[email protected]>> > > --- > > controller/ovn-controller.c | 27 +++++++++++++++++++++------ > > tests/ovn-inc-proc-graph-dump.at <http://ovn-inc-proc-graph- > dump.at> | 4 ++-- > > tests/ovn-performance.at <http://ovn-performance.at> | 21 > +++++++++++++++++++-- > > 3 files changed, 42 insertions(+), 10 deletions(-) > > > > diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c > > index 01b0119b7..c39d9b8d0 100644 > > --- a/controller/ovn-controller.c > > +++ b/controller/ovn-controller.c > > @@ -6168,15 +6168,29 @@ route_exchange_route_table_handler(struct > engine_node *node, void *data) > > return EN_HANDLED_UPDATED; > > } > > > > +/* Change handler shared by the 'sb_ro' and 'sb_cond_seqno' > inputs. */ > > static enum engine_input_handler_result > > -route_exchange_sb_ro_handler(struct engine_node *node OVS_UNUSED, > void *data) > > +route_exchange_sb_handler(struct engine_node *node, void *data) > > { > > struct ed_type_route_exchange *re = data; > > - if (re->sb_changes_pending) { > > - return EN_UNHANDLED; > > + > > + if (!sbrec_server_has_learned_route_table(re->sb_idl)) { > > + return EN_HANDLED_UNCHANGED; > > } > > > > - return EN_HANDLED_UNCHANGED; > > + bool ready = route_exchange_ready(node, re); > > + if (re->initial_routes_loaded == ready && !re- > >sb_changes_pending) { > > + /* The readiness gate did not flip and there is no SB > write left > > + * over from a previous attempt: this event is not > relevant to us. */ > > + return EN_HANDLED_UNCHANGED; > > + } > > + > > + if (!engine_get_context()->ovnsb_idl_txn) { > > + return EN_HANDLED_UNCHANGED; > > + } > > + > > + return route_exchange_sync(node, re) ? EN_HANDLED_UPDATED > > + : EN_HANDLED_UNCHANGED; > > } > > > > > > @@ -7725,11 +7739,12 @@ inc_proc_ovn_controller_init( > > route_exchange_route_table_handler); > > engine_add_input(&en_route_exchange, > &en_route_exchange_status, NULL); > > engine_add_input(&en_route_exchange, &en_sb_ro, > > - route_exchange_sb_ro_handler); > > + route_exchange_sb_handler); > > /* Re-evaluate the initial-dump readiness gate whenever the > SB monitor > > * conditions change (including the final ack of the scoped > > * Advertised_Route dump). */ > > - engine_add_input(&en_route_exchange, &en_sb_cond_seqno, NULL); > > + engine_add_input(&en_route_exchange, &en_sb_cond_seqno, > > + route_exchange_sb_handler); > > > > engine_add_input(&en_addr_sets, &en_sb_address_set, > > addr_sets_sb_address_set_handler); > > diff --git a/tests/ovn-inc-proc-graph-dump.at <http://ovn-inc- > proc-graph-dump.at> b/tests/ovn-inc-proc-graph-dump.at <http://ovn- > inc-proc-graph-dump.at> > > index b3df37a01..7853e5001 100644 > > --- a/tests/ovn-inc-proc-graph-dump.at <http://ovn-inc-proc-graph- > dump.at> > > +++ b/tests/ovn-inc-proc-graph-dump.at <http://ovn-inc-proc-graph- > dump.at> > > @@ -480,8 +480,8 @@ digraph "Incremental-Processing-Engine" { > > SB_port_binding -> route_exchange > [[label="engine_noop_handler"]]; > > route_table_notify -> route_exchange > [[label="route_exchange_route_table_handler"]]; > > route_exchange_status -> route_exchange [[label=""]]; > > - sb_ro -> route_exchange > [[label="route_exchange_sb_ro_handler"]]; > > - sb_cond_seqno -> route_exchange [[label=""]]; > > + sb_ro -> route_exchange [[label="route_exchange_sb_handler"]]; > > + sb_cond_seqno -> route_exchange > [[label="route_exchange_sb_handler"]]; > > garp_rarp [[style=filled, shape=box, fillcolor=white, > label="garp_rarp"]]; > > OVS_open_vswitch -> garp_rarp [[label=""]]; > > SB_chassis -> garp_rarp [[label=""]]; > > diff --git a/tests/ovn-performance.at <http://ovn-performance.at> > b/tests/ovn-performance.at <http://ovn-performance.at> > > index 114917832..de56ca5f8 100644 > > --- a/tests/ovn-performance.at <http://ovn-performance.at> > > +++ b/tests/ovn-performance.at <http://ovn-performance.at> > > @@ -359,11 +359,28 @@ for i in 1 2; do > > [hv1 hv2], [lflow_run], > > [ovn-nbctl --wait=hv acl-add $ls to-lport 1000 'outport > == \"$lp\"' drop] > > ) > > - > > Nit: random empty line deleted > > > # Bind port $lp and wait for it to come up > > + # > > + # Create openflow backlog by pausing ovs/ovsdb. > > + # We can't simply pause ovs to delay flow handling, as this > would also prevent ofport creation. > > + # So, follow this pattern: > > + # 1) Pause ovs to prevent oflow creation, but keep ovsdb > running so we can add interface. > > + # 2) Create interface. > > + # 3) Pause ovs-db and restart ovs. ovs now creates ofport, > but ovsdb is sleeping. > > + # 4) After one second (i.e. enough for ovs to have time to > write ofport), pause ovs and restart ovsdb. > > + # 5) Now ovn-controller should get ofport, claim and program > flows (while ovs is paused). > > + # Sleep 2 more seconds to let ovn-controller handle the > diff, start programming openflows, hitting backlog and cancelling. > > + # If previous pauses are not long enough (which should be > rare), we might miss some failures on buggy code, but this should > not cause flaky tests. > > + # 6) Wake up ovs so flows get programmed. > > + # 7) Wait for port up + sync. > > + # 8) This used to cause recomputes. > > + sleep_ovs hv$i > > OVN_CONTROLLER_EXPECT_NO_HIT( > > [hv$i hv$j], [lflow_run], > > - [as hv$i ovs-vsctl add-port br-int $vif -- set Interface > $vif external-ids:iface-id=$lp && > > + [as hv$i ovs-vsctl --no-wait add-port br-int $vif -- set > Interface $vif external-ids:iface-id=$lp && > > + sleep_ovsdb hv$i && wake_up_ovs hv$i && > > + sleep 1 && sleep_ovs hv$i && wake_up_ovsdb hv$i && > > + sleep 2 && wake_up_ovs hv$i && > > Looking at this test made me recall somewhat recently seeing on the > mailing list that OVS is trying to avoid all sleeps in tests going > forwards. So I was just wondering, could this be done without sleeps? > I'm not sure exactly how it would look... but it's just a thought. Did > you consider this? Do you think it's even feasible? > > Thanks for your suggestion. > I initially skipped this because implementing it cleanly wasn't obvious. > So, I took another look this morning, as I agree avoiding sleeps is > usually a good idea. > It is technically feasible by enabling the relevant debug logs and > waiting for specific log messages instead of using fixed sleeps: > Replace 'sleep 1' with 'waiting for proper ofport' in hv$i/ovs-vswitchd.log > Replace 'sleep 2' with 'waiting for 'ofctrl_put can.t be performed'' in > hv$i/ovn-controller.log > However, after fighting a bit due to the initial sleeps being embedded > in some m4 macros, the cleanest shell equivalent I could come up with > ends up looking like this for resp. 'sleep 1' and 'sleep 2': > seconds=0 && while ! grep -q 'ofport.:1001' hv$i/ovs-vswitchd.log; do > [[ \$seconds -ge 30 ]] && break; sleep 1; seconds=\$((seconds + 1)); done && > seconds=0 && while ! grep -q 'ofctrl_put can.t be performed' hv$i/ovn- > controller.log; do [[ "\$seconds" -ge 30 ]] && break; sleep 1; seconds=\ > $((seconds + 1)); done && > Given how much extra complexity this adds to an already dense macro, and > since the worst-case scenario with the current sleep 1/sleep 2 on a slow > system is simply missing a regression check rather than causing a false- > positive test failure, I think keeping the simple sleep calls is the > better trade-off here. Please let me know if you feel otherwise.
Hi Xavier, thanks for looking into this! That was my concern too, that the replacement for a simple sleep would be some monstrosity like that. Because since we're already inside of the OVN_CONTROLLER_EXPECT_NO_HIT macro, in the middle of a sequence of bash commands, we can't simply use OVS_WAIT_UNTIL... Well, thanks anyways for taking a look! I'm fine with the sleeps then. Acked-by: Rosemarie O'Riorden <[email protected]> > > > Thanks, > Rosemarie > > Thanks > Xavier > > > > check ovn-nbctl wait-until Logical_Switch_Port $lp > 'up=true' && > > check ovn-nbctl --wait=hv sync] > > ) > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
