Yes, this diff is from main. To trigger an initial bug it is enough to create a new ls/lr while all available tunnel ids are used for datapaths (4095). This is because we need to enter ovn_allocate_tnlid() with *hint=0 to trigger infinite loop. That is why I suggest just to create 4095 LSs and then create another one. I’ve tested this diff and see that northd goes to 100% CPU and doesn’t print warn log about ids exhaustion.
> On 4 Apr 2024, at 23:34, Ihar Hrachyshka <ihrac...@redhat.com> wrote: > > On Thu, Apr 4, 2024 at 3:56 PM Vladislav Odintsov <odiv...@gmail.com> wrote: > >> Thanks Ihar for the patch. >> >> It definitely triggers the bug mentioned in Fixes commit, but how do you >> like next diff as an alternative? >> It seems a little easier to me, because it shows the real limit and the >> situation where the problem was (separate ls-add): >> > > Is it a diff from main? I don't think it will trigger the issue. The key is > to trigger northd to change its max cap for tunnel ids AFTER it bumped hint > beyond the "vxlan mode max tun_id" (which is why I have to create vxlan > chassis AFTER I create enough LSs to get into unsafe territory.) > > Note: I haven't tried your version yet; I may check your version some time > later. So it's the initial thought only. > > >> >> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at >> index 6edb1129e..cef144f10 100644 >> --- a/tests/ovn-northd.at >> +++ b/tests/ovn-northd.at >> @@ -2862,13 +2862,18 @@ ovn-sbctl \ >> >> cmd="ovn-nbctl --wait=sb" >> >> -for i in {1..4097}; do >> +for i in {1..4095}; do >> cmd="${cmd} -- ls-add lsw-${i}" >> done >> >> eval $cmd >> >> -check_row_count nb:Logical_Switch 4097 >> +check_row_count nb:Logical_Switch 4095 >> +wait_row_count sb:Datapath_Binding 4095 >> + >> +ovn-nbctl ls-add lsw-exhausted >> + >> +check_row_count nb:Logical_Switch 4096 >> wait_row_count sb:Datapath_Binding 4095 >> >> OVS_WAIT_UNTIL([grep "all datapath tunnel ids exhausted" >> northd/ovn-northd.log]) >> >> >> On 4 Apr 2024, at 20:13, Ihar Hrachyshka <ihrac...@redhat.com> wrote: >> >> The original version of the scenario passed with or without the fix. >> >> Fixes: a1f165a7b807 ("northd: fix infinite loop in ovn_allocate_tnlid()") >> Signed-off-by: Ihar Hrachyshka <ihrac...@redhat.com> >> --- >> tests/ovn-northd.at | 17 +++++++++++------ >> 1 file changed, 11 insertions(+), 6 deletions(-) >> >> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at >> index fc2c972a4..e8ea8b050 100644 >> --- a/tests/ovn-northd.at >> +++ b/tests/ovn-northd.at >> @@ -2826,11 +2826,6 @@ OVN_FOR_EACH_NORTHD_NO_HV([ >> AT_SETUP([check tunnel ids exhaustion]) >> ovn_start >> >> -# Create a fake chassis with vxlan encap to lower MAX DP tunnel key to >> 2^12 >> -ovn-sbctl \ >> - --id=@e create encap chassis_name=hv1 ip="192.168.0.1" type="vxlan" \ >> - -- --id=@c create chassis name=hv1 encaps=@e >> - >> cmd="ovn-nbctl --wait=sb" >> >> for i in {1..4097}; do >> @@ -2840,7 +2835,17 @@ done >> eval $cmd >> >> check_row_count nb:Logical_Switch 4097 >> -wait_row_count sb:Datapath_Binding 4095 >> +wait_row_count sb:Datapath_Binding 4097 >> + >> +# Now create a fake chassis with vxlan encap to lower MAX DP tunnel key >> to 2^12 >> +ovn-sbctl \ >> + --id=@e create encap chassis_name=hv1 ip="192.168.0.1" type="vxlan" \ >> + -- --id=@c create chassis name=hv1 encaps=@e >> + >> +ovn-nbctl --wait=sb ls-add lsw-exhausted >> + >> +check_row_count nb:Logical_Switch 4098 >> +wait_row_count sb:Datapath_Binding 4097 >> >> OVS_WAIT_UNTIL([grep "all datapath tunnel ids exhausted" >> northd/ovn-northd.log]) >> >> -- >> 2.41.0 >> >> _______________________________________________ >> dev mailing list >> d...@openvswitch.org >> https://mail.openvswitch.org/mailman/listinfo/ovs-dev >> >> >> >> >> >> Regards, >> Vladislav Odintsov >> >> > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev Regards, Vladislav Odintsov _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev