On 2/22/24 16:54, Adrian Moreno wrote: > In order to properly balance bond traffic, ofproto/bond periodically > reads usage statistics of the post-recirculation rules (which are added > to a hidden internal table). > > To do that, each "struct bond_entry" (which represents a hash within a > bond) stores the last seen statistics for its rule. When a hash is moved > to another member (due to a bond rebalance or the previous member going > down), the rule is typically just modified, i.e: same match different > actions. In this case, statistics are preserved and accounting continues > to work. > > However, if the rule gets completely deleted (e.g: when all bond members > go down) and then re-created, the new rule will have 0 tx_bytes but its > associated entry will still store a non-zero last-seen value. > This situation leads to an overflow of the delta calculation (computed > as [current_stats_value - last_seen_value]), which can affect traffic > as the hash will be considered to carry a lot of traffic and rebalancing > will kick in. > > In order to fix this situation, reset the value of last seen statistics > on rule deletion. > > Implementation notes: > Modifying pr_tx_bytes requires write-locking the global rwlock but a > lockless version of update_recirc_rules was being maintained to avoid locking > on bon_unref(). > Considering the small impact of locking during bond removal, removing the > lockless version and relying on clang's thread safety analysis is preferred. > > Also, folding Ilya's [1], i.e: fixing thread safety annotation in > update_recirc_rules() to require holding write-lock. > > [1] > https://patchwork.ozlabs.org/project/openvswitch/patch/[email protected]/ > > Reported-at: https://github.com/openvswitch/ovs-issues/issues/319 > Co-authored-by: Ilya Maximets <[email protected]> > Signed-off-by: Ilya Maximets <[email protected]> > Signed-off-by: Adrian Moreno <[email protected]> > ---
Thanks! Applied and backported down to 2.17. Best regards, Ilya Maximets. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
