On Mon, Oct 4, 2021 at 5:29 AM Anton Ivanov <anton.iva...@cambridgegreys.com> wrote: > > > On 03/10/2021 23:45, Han Zhou wrote: > > When parallel build is used, od->group can be updated by threads outside > > of the function do_ovn_lflow_add_pd (for lb related flow building). So > > use the function ovn_dp_group_add_with_reference() to update it in > > function do_ovn_lflow_add() when it is not a newly created flow. > > > > Signed-off-by: Han Zhou <hz...@ovn.org> > > --- > > northd/northd.c | 42 +++++++++++++++++++++--------------------- > > 1 file changed, 21 insertions(+), 21 deletions(-) > > > > diff --git a/northd/northd.c b/northd/northd.c > > index 027c5b170..afd812700 100644 > > --- a/northd/northd.c > > +++ b/northd/northd.c > > @@ -4299,6 +4299,26 @@ ovn_lflow_init(struct ovn_lflow *lflow, struct > > ovn_datapath *od, > > } > > } > > > > +static bool > > +ovn_dp_group_add_with_reference(struct ovn_lflow *lflow_ref, > > + struct ovn_datapath *od) > > + OVS_NO_THREAD_SAFETY_ANALYSIS > > +{ > > + if (!use_logical_dp_groups || !lflow_ref) { > > + return false; > > + } > > + > > + if (use_parallel_build) { > > + ovs_mutex_lock(&lflow_ref->odg_lock); > > + hmapx_add(&lflow_ref->od_group, od); > > + ovs_mutex_unlock(&lflow_ref->odg_lock); > > + } else { > > + hmapx_add(&lflow_ref->od_group, od); > > + } > > + > > + return true; > > +} > > + > > /* Adds a row with the specified contents to the Logical_Flow table. > > * Version to use with dp_groups + parallel - when locking is required. > > * > > @@ -4351,7 +4371,7 @@ do_ovn_lflow_add(struct hmap *lflow_map, struct > > ovn_datapath *od, > > old_lflow = ovn_lflow_find(lflow_map, NULL, stage, priority, > > match, > > actions, ctrl_meter, hash); > > if (old_lflow) { > > - hmapx_add(&old_lflow->od_group, od); > > + ovn_dp_group_add_with_reference(old_lflow, od); > > return old_lflow; > > } > > } > > @@ -4466,26 +4486,6 @@ ovn_lflow_add_at(struct hmap *lflow_map, struct > > ovn_datapath *od, > > io_port, ctrl_meter, stage_hint, where, > > hash); > > } > > > > -static bool > > -ovn_dp_group_add_with_reference(struct ovn_lflow *lflow_ref, > > - struct ovn_datapath *od) > > - OVS_NO_THREAD_SAFETY_ANALYSIS > > -{ > > - if (!use_logical_dp_groups || !lflow_ref) { > > - return false; > > - } > > - > > - if (use_parallel_build) { > > - ovs_mutex_lock(&lflow_ref->odg_lock); > > - hmapx_add(&lflow_ref->od_group, od); > > - ovs_mutex_unlock(&lflow_ref->odg_lock); > > - } else { > > - hmapx_add(&lflow_ref->od_group, od); > > - } > > - > > - return true; > > -} > > - > > /* Adds a row with the specified contents to the Logical_Flow table. */ > > #define ovn_lflow_add_with_hint__(LFLOW_MAP, OD, STAGE, PRIORITY, MATCH, \ > > ACTIONS, IN_OUT_PORT, CTRL_METER, \ > > > +1 >
Acked-by: Numan Siddique <num...@ovn.org> Numan > -- > Anton R. Ivanov > Cambridgegreys Limited. Registered in England. Company Number 10273661 > https://www.cambridgegreys.com/ > > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev