Skip to contentSkip to conversation

selftests: bonding: fix failover race in bond_options.sh prio test

PATCH In review Pin-yen Lin 3 participants 9 messages Nov 12 – Nov 19

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: bonding: fix failover race in bond_options.sh prio test

The prio test intermittently fails in the arp_ip_target and ns_ip6_target variants:

TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
Current active slave is eth0 but not eth2

The ARP/NS monitor marks a slave down when it has received nothing for too long. With arp_interval 100 and the default arp_missed_max, that is about 250ms for the active slave (eth1) and 350ms for a backup slave (eth0, eth2). Every 100ms, eth1 sends a probe: eth1 receives the reply, and eth0/eth2 receive a copy forwarded by the gateway bridge. Once eth1 is down, its probes reach no one and no slave receives anything, so eth1 normally times out first and the new active slave is picked by prio:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=10   test sets eth1 down
  t=300  monitor: eth1 idle 300ms -> down
                  eth0/eth2 idle 300ms -> up, eth2 picked by prio

But the test takes eth1 down right after bond_check_connection(), whose ping replies only arrive on eth1:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=70   ping reply on eth1 only
  t=85   test sets eth1 down
  t=300  monitor: eth1 idle 230ms -> still up
  t=400  monitor: eth1 idle 330ms -> down
                  eth2 idle 400ms -> down too

eth2 can then no longer be picked. eth0 becomes the active slave if it happened to receive some other packet (e.g. an MLD report), otherwise whichever slave comes back first does. With primary_reselect 1 or 2, the bond keeps eth0 even after eth2 comes back.

Before taking the active slave down, wait two monitor intervals (200ms), so that at least one more probe is sent after the last ping reply and all slaves last received that probe. The miimon variants do not need the wait, but the extra delay is negligible.

Hit in our CI on GCE VMs (4 of 51 runs); the test only uses veth. On the same VMs, 7 of 30 loops of the prio tests failed without this change, and 20 of 20 loops passed with it.

Fixes 481b56e0391e ("selftests: bonding: re-format bond option tests")

---

 .../drivers/net/bonding/bond_options.sh       | 26 ++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)
tools/testing/selftests/drivers/net/bonding/bond_options.sh +22 -4
index 187b478d0ddf..16c1c2d97005 100755
@@ -13,6 +13,24 @@ ALL_TESTS="
 
 lib_dir=$(dirname "$0")
 source ${lib_dir}/bond_topo_3d1c.sh
+
+# The ARP/NS monitor marks a slave down when it has received nothing for too
+# long: ~250ms for the active slave and ~350ms for a backup slave with
+# arp_interval 100. The backups only receive the copies of the active slave's
+# probes that the gateway bridge forwards, but the active slave also gets the
+# replies to the pings in bond_check_connection(). If the active slave goes
+# down right after such a reply, it times out in the same monitor run as the
+# backups, and the new active slave is then not picked by prio. Wait two
+# monitor intervals, so that at least one more probe is sent and all slaves
+# last received that probe.
+bond_link_down()
+{
+	local slave=$1
+
+	sleep 0.2
+	ip -n ${s_ns} link set "$slave" down
+}
+
 c_maddr="33:33:ff:00:00:10"
 g_maddr="33:33:ff:00:02:54"
 
@@ -97,12 +115,12 @@ prio_test()
 	check_active_slave eth1
 
 	# active slave should be the higher prio slave
-	ip -n ${s_ns} link set $active_slave down
+	bond_link_down $active_slave
 	check_active_slave eth2
 	bond_check_connection "fail over"
 
 	# when only 1 slave is up
-	ip -n ${s_ns} link set $active_slave down
+	bond_link_down $active_slave
 	check_active_slave eth0
 	bond_check_connection "only 1 slave up"
 
@@ -134,7 +152,7 @@ prio_test()
 			;;
 		"2")
 			check_active_slave "$pre_active_slave"
-			ip -n ${s_ns} link set $active_slave down
+			bond_link_down $active_slave
 			bond_check_connection "pre_active slave down"
 			check_active_slave "eth1"
 			;;
@@ -153,7 +171,7 @@ prio_test()
 		check_err $? "eth3 prio is not -50"
 		check_active_slave "eth1"
 
-		ip -n ${s_ns} link set $active_slave down
+		bond_link_down $active_slave
 		check_active_slave "eth0"
 		bond_check_connection "change slave prio"
 	fi
Signature · 3 lines
2.56.1.703.gf848ed807c-goog

base-commit: 665b4149e91b781a71bce8637c3a4d7d64dba05f
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Pin-yen Lin

The prio test intermittently fails in the arp_ip_target and ns_ip6_target variants:

TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
Current active slave is eth0 but not eth2

I traced the timing through bond_ab_arp_inspect(). With arp_interval 100 and the default arp_missed_max of 2, the active slave is marked down after 200ms without a receive and the backups after 300ms, matching the timing analysis in the commit message.

All four link-down sites in prio_test() use the new helper, and the Fixes tag is right.

#2 lore raw
In reply to Pin-yen Lin

Hi Pin-yen,

Quoted 35 lines · Pin-yen Lin

The prio test intermittently fails in the arp_ip_target and ns_ip6_target variants:

TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
Current active slave is eth0 but not eth2

The ARP/NS monitor marks a slave down when it has received nothing for too long. With arp_interval 100 and the default arp_missed_max, that is about 250ms for the active slave (eth1) and 350ms for a backup slave (eth0, eth2). Every 100ms, eth1 sends a probe: eth1 receives the reply, and eth0/eth2 receive a copy forwarded by the gateway bridge. Once eth1 is down, its probes reach no one and no slave receives anything, so eth1 normally times out first and the new active slave is picked by prio:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=10   test sets eth1 down
  t=300  monitor: eth1 idle 300ms -> down
                  eth0/eth2 idle 300ms -> up, eth2 picked by prio

But the test takes eth1 down right after bond_check_connection(), whose ping replies only arrive on eth1:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=70   ping reply on eth1 only
  t=85   test sets eth1 down
  t=300  monitor: eth1 idle 230ms -> still up
  t=400  monitor: eth1 idle 330ms -> down
                  eth2 idle 400ms -> down too

eth2 can then no longer be picked. eth0 becomes the active slave if it happened to receive some other packet (e.g. an MLD report), otherwise whichever slave comes back first does. With primary_reselect 1 or 2, the bond keeps eth0 even after eth2 comes back.

Quoted 4 lines

Before taking the active slave down, wait two monitor intervals (200ms), so that at least one more probe is sent after the last ping reply and all slaves last received that probe. The miimon variants do not need the wait, but the extra delay is negligible.

I'm afraid the waiting time is too strict, especially with a debug kernel since delays can happen.

Bjoern is also fixing[1] this issue by pinging a non-existent neighbor to keep traffic flowing. Would you like to test whether that works for you?

[1] https://lore.kernel.org/netdev/[email protected]/

Thanks
Hangbin

Quoted 78 lines

Hit in our CI on GCE VMs (4 of 51 runs); the test only uses veth. On the same VMs, 7 of 30 loops of the prio tests failed without this change, and 20 of 20 loops passed with it.

Fixes 481b56e0391e ("selftests: bonding: re-format bond option tests")

---

 .../drivers/net/bonding/bond_options.sh       | 26 ++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)
tools/testing/selftests/drivers/net/bonding/bond_options.sh +22 -4
index 187b478d0ddf..16c1c2d97005 100755
@@ -13,6 +13,24 @@ ALL_TESTS="
 
 lib_dir=$(dirname "$0")
 source ${lib_dir}/bond_topo_3d1c.sh
+
+# The ARP/NS monitor marks a slave down when it has received nothing for too
+# long: ~250ms for the active slave and ~350ms for a backup slave with
+# arp_interval 100. The backups only receive the copies of the active slave's
+# probes that the gateway bridge forwards, but the active slave also gets the
+# replies to the pings in bond_check_connection(). If the active slave goes
+# down right after such a reply, it times out in the same monitor run as the
+# backups, and the new active slave is then not picked by prio. Wait two
+# monitor intervals, so that at least one more probe is sent and all slaves
+# last received that probe.
+bond_link_down()
+{
+	local slave=$1
+
+	sleep 0.2
+	ip -n ${s_ns} link set "$slave" down
+}
+
 c_maddr="33:33:ff:00:00:10"
 g_maddr="33:33:ff:00:02:54"
 
@@ -97,12 +115,12 @@ prio_test()
 	check_active_slave eth1
 
 	# active slave should be the higher prio slave
-	ip -n ${s_ns} link set $active_slave down
+	bond_link_down $active_slave
 	check_active_slave eth2
 	bond_check_connection "fail over"
 
 	# when only 1 slave is up
-	ip -n ${s_ns} link set $active_slave down
+	bond_link_down $active_slave
 	check_active_slave eth0
 	bond_check_connection "only 1 slave up"
 
@@ -134,7 +152,7 @@ prio_test()
 			;;
 		"2")
 			check_active_slave "$pre_active_slave"
-			ip -n ${s_ns} link set $active_slave down
+			bond_link_down $active_slave
 			bond_check_connection "pre_active slave down"
 			check_active_slave "eth1"
 			;;
@@ -153,7 +171,7 @@ prio_test()
 		check_err $? "eth3 prio is not -50"
 		check_active_slave "eth1"
 
-		ip -n ${s_ns} link set $active_slave down
+		bond_link_down $active_slave
 		check_active_slave "eth0"
 		bond_check_connection "change slave prio"
 	fi
Signature · 3 lines
2.56.1.703.gf848ed807c-goog

base-commit: 665b4149e91b781a71bce8637c3a4d7d64dba05f
#3 lore raw
Quoted 42 lines · Hangbin Liu

Hi Pin-yen,

Quoted 35 lines · Pin-yen Lin

The prio test intermittently fails in the arp_ip_target and ns_ip6_target variants:

TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
Current active slave is eth0 but not eth2

The ARP/NS monitor marks a slave down when it has received nothing for too long. With arp_interval 100 and the default arp_missed_max, that is about 250ms for the active slave (eth1) and 350ms for a backup slave (eth0, eth2). Every 100ms, eth1 sends a probe: eth1 receives the reply, and eth0/eth2 receive a copy forwarded by the gateway bridge. Once eth1 is down, its probes reach no one and no slave receives anything, so eth1 normally times out first and the new active slave is picked by prio:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=10   test sets eth1 down
  t=300  monitor: eth1 idle 300ms -> down
                  eth0/eth2 idle 300ms -> up, eth2 picked by prio

But the test takes eth1 down right after bond_check_connection(), whose ping replies only arrive on eth1:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=70   ping reply on eth1 only
  t=85   test sets eth1 down
  t=300  monitor: eth1 idle 230ms -> still up
  t=400  monitor: eth1 idle 330ms -> down
                  eth2 idle 400ms -> down too

eth2 can then no longer be picked. eth0 becomes the active slave if it happened to receive some other packet (e.g. an MLD report), otherwise whichever slave comes back first does. With primary_reselect 1 or 2, the bond keeps eth0 even after eth2 comes back.

Quoted 4 lines

Before taking the active slave down, wait two monitor intervals (200ms), so that at least one more probe is sent after the last ping reply and all slaves last received that probe. The miimon variants do not need the wait, but the extra delay is negligible.

Quoted 7 lines

I'm afraid the waiting time is too strict, especially with a debug kernel since delays can happen.

Bjoern is also fixing[1] this issue by pinging a non-existent neighbor to keep traffic flowing. Would you like to test whether that works for you?

[1] https://lore.kernel.org/netdev/[email protected]/

BTW, using ping may not able to triger the arp request in time. You can try arping instead.

Thanks
Hangbin

#4 lore raw

Hi Hangbin,

Quoted 47 lines · Hangbin Liu
Quoted 45 lines · Hangbin Liu

Hi Pin-yen,

Quoted 35 lines · Pin-yen Lin

The prio test intermittently fails in the arp_ip_target and ns_ip6_target variants:

TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
Current active slave is eth0 but not eth2

The ARP/NS monitor marks a slave down when it has received nothing for too long. With arp_interval 100 and the default arp_missed_max, that is about 250ms for the active slave (eth1) and 350ms for a backup slave (eth0, eth2). Every 100ms, eth1 sends a probe: eth1 receives the reply, and eth0/eth2 receive a copy forwarded by the gateway bridge. Once eth1 is down, its probes reach no one and no slave receives anything, so eth1 normally times out first and the new active slave is picked by prio:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=10   test sets eth1 down
  t=300  monitor: eth1 idle 300ms -> down
                  eth0/eth2 idle 300ms -> up, eth2 picked by prio

But the test takes eth1 down right after bond_check_connection(), whose ping replies only arrive on eth1:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=70   ping reply on eth1 only
  t=85   test sets eth1 down
  t=300  monitor: eth1 idle 230ms -> still up
  t=400  monitor: eth1 idle 330ms -> down
                  eth2 idle 400ms -> down too

eth2 can then no longer be picked. eth0 becomes the active slave if it happened to receive some other packet (e.g. an MLD report), otherwise whichever slave comes back first does. With primary_reselect 1 or 2, the bond keeps eth0 even after eth2 comes back.

Quoted 4 lines

Before taking the active slave down, wait two monitor intervals (200ms), so that at least one more probe is sent after the last ping reply and all slaves last received that probe. The miimon variants do not need the wait, but the extra delay is negligible.

I'm afraid the waiting time is too strict, especially with a debug kernel since delays can happen.

Quoted 7 lines
Quoted 4 lines

Bjoern is also fixing[1] this issue by pinging a non-existent neighbor to keep traffic flowing. Would you like to test whether that works for you?

[1] https://lore.kernel.org/netdev/[email protected]/

BTW, using ping may not able to triger the arp request in time. You can try arping instead.

Thanks for the pointer, but I believe Bjoern's patch addresses a different problem.

Bjoern's patch keeps the traffic flowing so that idle slaves are kept alive between the test steps. This patch fixes the case where the ping replies from bond_check_connection() only arrive on the active slave right before it is set down. The active slave's failure is then detected one monitor interval late, when the backups have also timed out.

The ARP requests triggered by Bjoern's ping are sent only about once per second, which isn't frequent enough for this failure. I tested Bjoern's patch and confirmed that it didn't fix the issue in our testing environment. We also can't simply use arping instead because iputils arping doesn't support sub-second intervals.

If you're worried that the 200ms sleep is too short, would increasing it to 0.5s or 1s work for you?

Quoted 4 lines

Thanks
Hangbin

Regards,
Pin-yen

#5 lore raw

Hi Pin-yen,

Quoted 53 lines · Pin-yen Lin

Hi Hangbin,

Quoted 50 lines · Hangbin Liu
Quoted 48 lines · Hangbin Liu

Hi Pin-yen,

Quoted 35 lines · Pin-yen Lin

The prio test intermittently fails in the arp_ip_target and ns_ip6_target variants:

TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
Current active slave is eth0 but not eth2

The ARP/NS monitor marks a slave down when it has received nothing for too long. With arp_interval 100 and the default arp_missed_max, that is about 250ms for the active slave (eth1) and 350ms for a backup slave (eth0, eth2). Every 100ms, eth1 sends a probe: eth1 receives the reply, and eth0/eth2 receive a copy forwarded by the gateway bridge. Once eth1 is down, its probes reach no one and no slave receives anything, so eth1 normally times out first and the new active slave is picked by prio:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=10   test sets eth1 down
  t=300  monitor: eth1 idle 300ms -> down
                  eth0/eth2 idle 300ms -> up, eth2 picked by prio

But the test takes eth1 down right after bond_check_connection(), whose ping replies only arrive on eth1:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=70   ping reply on eth1 only
  t=85   test sets eth1 down
  t=300  monitor: eth1 idle 230ms -> still up
  t=400  monitor: eth1 idle 330ms -> down
                  eth2 idle 400ms -> down too

eth2 can then no longer be picked. eth0 becomes the active slave if it happened to receive some other packet (e.g. an MLD report), otherwise whichever slave comes back first does. With primary_reselect 1 or 2, the bond keeps eth0 even after eth2 comes back.

Quoted 4 lines

Before taking the active slave down, wait two monitor intervals (200ms), so that at least one more probe is sent after the last ping reply and all slaves last received that probe. The miimon variants do not need the wait, but the extra delay is negligible.

I'm afraid the waiting time is too strict, especially with a debug kernel since delays can happen.

Bjoern is also fixing[1] this issue by pinging a non-existent neighbor to keep traffic flowing. Would you like to test whether that works for you?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

[1] https://lore.kernel.org/netdev/[email protected]/

BTW, using ping may not able to triger the arp request in time. You can try arping instead.

Thanks for the pointer, but I believe Bjoern's patch addresses a different problem.

I think they are the same issue, as you comment also said

The ARP/NS monitor marks a slave down when it has received nothing for too long.

Quoted 7 lines

Bjoern's patch keeps the traffic flowing so that idle slaves are kept alive between the test steps. This patch fixes the case where the ping replies from bond_check_connection() only arrive on the active slave right before it is set down. The active slave's failure is then detected one monitor interval late, when the backups have also timed out.

The reason is we set arp interval to 100ms, and slowwait also check every 100ms. If the backup slave down at the same check point, e.g.

t=300 monitor: eth1 idle 230ms -> still up
t=400 monitor: eth1 idle 330ms -> down

                  eth2 idle 400ms -> down too

The test failed.

Quoted 9 lines

The ARP requests triggered by Bjoern's ping are sent only about once per second, which isn't frequent enough for this failure. I tested Bjoern's patch and confirmed that it didn't fix the issue in our testing environment. We also can't simply use arping instead because iputils arping doesn't support sub-second intervals.

If you're worried that the 200ms sleep is too short, would increasing it to 0.5s or 1s work for you?

It's not about the sleep time before setting active slave down. I'm afraid about the slowwait checking time. Even we sleep 1s, with arp interval 100, we still only have 100ms checking window. Before the window, the active slave is up, after the window, the backup slave also down. With a debug kernel, this time is a little tight.

So, either we have some background arp traffic, or let's extend the arp interval to a larger one.

What do you think?

Thanks
Hangbin

#6 lore raw

Hi Hangbin,

Quoted 61 lines · Hangbin Liu

Hi Pin-yen,

Quoted 58 lines · Pin-yen Lin

Hi Hangbin,

Quoted 54 lines · Hangbin Liu
Quoted 42 lines · Hangbin Liu

Hi Pin-yen,

Quoted 35 lines · Pin-yen Lin

The prio test intermittently fails in the arp_ip_target and ns_ip6_target variants:

TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL]
Current active slave is eth0 but not eth2

The ARP/NS monitor marks a slave down when it has received nothing for too long. With arp_interval 100 and the default arp_missed_max, that is about 250ms for the active slave (eth1) and 350ms for a backup slave (eth0, eth2). Every 100ms, eth1 sends a probe: eth1 receives the reply, and eth0/eth2 receive a copy forwarded by the gateway bridge. Once eth1 is down, its probes reach no one and no slave receives anything, so eth1 normally times out first and the new active slave is picked by prio:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=10   test sets eth1 down
  t=300  monitor: eth1 idle 300ms -> down
                  eth0/eth2 idle 300ms -> up, eth2 picked by prio

But the test takes eth1 down right after bond_check_connection(), whose ping replies only arrive on eth1:

  t=0    probe: eth1 gets the reply, eth0/eth2 get a copy
  t=70   ping reply on eth1 only
  t=85   test sets eth1 down
  t=300  monitor: eth1 idle 230ms -> still up
  t=400  monitor: eth1 idle 330ms -> down
                  eth2 idle 400ms -> down too

eth2 can then no longer be picked. eth0 becomes the active slave if it happened to receive some other packet (e.g. an MLD report), otherwise whichever slave comes back first does. With primary_reselect 1 or 2, the bond keeps eth0 even after eth2 comes back.

Quoted 4 lines

Before taking the active slave down, wait two monitor intervals (200ms), so that at least one more probe is sent after the last ping reply and all slaves last received that probe. The miimon variants do not need the wait, but the extra delay is negligible.

Quoted 7 lines

I'm afraid the waiting time is too strict, especially with a debug kernel since delays can happen.

Bjoern is also fixing[1] this issue by pinging a non-existent neighbor to keep traffic flowing. Would you like to test whether that works for you?

[1] https://lore.kernel.org/netdev/[email protected]/

BTW, using ping may not able to triger the arp request in time. You can try arping instead.

Quoted 7 lines
Quoted 2 lines

Thanks for the pointer, but I believe Bjoern's patch addresses a different problem.

I think they are the same issue, as you comment also said

The ARP/NS monitor marks a slave down when it has received nothing for too long.

This is the existing behavior of the bonding driver, and the prio test uses it to check which backup slave takes over. Slaves being marked down is not the root cause of the test failure. Instead, the root cause is the ping replies described below.

Quoted 9 lines
Quoted 8 lines

Bjoern's patch keeps the traffic flowing so that idle slaves are kept alive between the test steps. This patch fixes the case where the ping replies from bond_check_connection() only arrive on the active slave right before it is set down. The active slave's failure is then detected one monitor interval late, when the backups have also timed out.

Quoted 8 lines

The reason is we set arp interval to 100ms, and slowwait also check every 100ms. If the backup slave down at the same check point, e.g.

t=300 monitor: eth1 idle 230ms -> still up
t=400 monitor: eth1 idle 330ms -> down

                  eth2 idle 400ms -> down too

The test failed.

I don't think the slowwait interval makes a difference here.

The ARP monitor decides which slave becomes active, and slowwait only reads the result afterwards. The test expects the active slave and the backups to time out in different monitor runs, so that a backup can take over. In the example above, eth2 is already down when the bond picks the new active slave, no matter when slowwait polls.

Quoted 17 lines
Quoted 10 lines

The ARP requests triggered by Bjoern's ping are sent only about once per second, which isn't frequent enough for this failure. I tested Bjoern's patch and confirmed that it didn't fix the issue in our testing environment. We also can't simply use arping instead because iputils arping doesn't support sub-second intervals.

If you're worried that the 200ms sleep is too short, would increasing it to 0.5s or 1s work for you?

It's not about the sleep time before setting active slave down. I'm afraid about the slowwait checking time. Even we sleep 1s, with arp interval 100, we still only have 100ms checking window. Before the window, the active slave is up, after the window, the backup slave also down. With a debug kernel, this time is a little tight.

Quoted 4 lines

So, either we have some background arp traffic, or let's extend the arp interval to a larger one.

What do you think?

I agree that a 100ms ARP interval could be too short in environments like a debug kernel.

Background ARP traffic doesn't widen that window, though: it is sent through the active slave, so once the active slave is set down, nothing reaches the backups. It could only help with the ping reply race if it were very frequent; Bjoern's patch triggers about one ARP request per second and didn't fix the failures in our testing.

Increasing the ARP interval alone won't address the ping reply race, but it should help in environments like a debug kernel. I'd prefer to keep this patch focused on the ping reply race and send the ARP interval change as a follow-up, but I can fold it into v2 if you prefer.

Quoted 3 lines

Thanks
Hangbin

Regards,
Pin-yen

#7 lore raw

Hi Pin-yen,

Quoted 11 lines · Pin-yen Lin

Hi Hangbin,

Quoted 8 lines · Hangbin Liu

Hi Pin-yen,

Quoted 2 lines · Pin-yen Lin

Thanks for the pointer, but I believe Bjoern's patch addresses a different problem.

I think they are the same issue, as you comment also said

Quoted 7 lines
Quoted 2 lines

The ARP/NS monitor marks a slave down when it has received nothing for too long.

This is the existing behavior of the bonding driver, and the prio test uses it to check which backup slave takes over. Slaves being marked down is not the root cause of the test failure. Instead, the root cause is the ping replies described below.

If the backup slaves are not mark down, we can active the correct slave based on the priority, right? I think that's the root cause. The ping testing is just for checking connectivity.

Quoted 19 lines
Quoted 10 lines
Quoted 9 lines

Bjoern's patch keeps the traffic flowing so that idle slaves are kept alive between the test steps. This patch fixes the case where the ping replies from bond_check_connection() only arrive on the active slave right before it is set down. The active slave's failure is then detected one monitor interval late, when the backups have also timed out.

Quoted 8 lines

The reason is we set arp interval to 100ms, and slowwait also check every 100ms. If the backup slave down at the same check point, e.g.

t=300 monitor: eth1 idle 230ms -> still up
t=400 monitor: eth1 idle 330ms -> down

                  eth2 idle 400ms -> down too

The test failed.

Quoted 7 lines

I don't think the slowwait interval makes a difference here.

The ARP monitor decides which slave becomes active, and slowwait only reads the result afterwards. The test expects the active slave and the backups to time out in different monitor runs, so that a backup can take over. In the example above, eth2 is already down when the bond picks the new active slave, no matter when slowwait polls.

My idea is, by extending the arp interval, there is a larger gap. e.g.

t=300 monitor: eth1 still up
^^ slowwait check, incorrect active slave
t=400 monitor: eth1 down
eth2 still up, should become active slave
t=500 monitor: eth1 down
eth2 still up, active slave
^^ slowwait check, correct active

Quoted 22 lines
Quoted 17 lines
Quoted 10 lines

The ARP requests triggered by Bjoern's ping are sent only about once per second, which isn't frequent enough for this failure. I tested Bjoern's patch and confirmed that it didn't fix the issue in our testing environment. We also can't simply use arping instead because iputils arping doesn't support sub-second intervals.

If you're worried that the 200ms sleep is too short, would increasing it to 0.5s or 1s work for you?

It's not about the sleep time before setting active slave down. I'm afraid about the slowwait checking time. Even we sleep 1s, with arp interval 100, we still only have 100ms checking window. Before the window, the active slave is up, after the window, the backup slave also down. With a debug kernel, this time is a little tight.

Quoted 4 lines

So, either we have some background arp traffic, or let's extend the arp interval to a larger one.

What do you think?

Quoted 8 lines

I agree that a 100ms ARP interval could be too short in environments like a debug kernel.

Background ARP traffic doesn't widen that window, though: it is sent through the active slave, so once the active slave is set down, nothing reaches the backups. It could only help with the ping reply race if it were very frequent; Bjoern's patch triggers about one ARP request per second and didn't fix the failures in our testing.

For background traffic, I mean let the client send the arp requests, not from active slave of server. With arp_validate 0, the backup slaves will update last_rx and won't be down with idle.

Quoted 6 lines

Increasing the ARP interval alone won't address the ping reply race, but it should help in environments like a debug kernel. I'd prefer to keep this patch focused on the ping reply race and send the ARP interval change as a follow-up, but I can fold it into v2 if you prefer.

Doesn't extending the arp_interval (e.g. to 500) resolve your issue? Are you still able to reproduce the problem?

Thanks
Hangbin

#8 lore raw

Hi Hangbin,

Quoted 17 lines · Hangbin Liu

Hi Pin-yen,

Quoted 14 lines · Pin-yen Lin

Hi Hangbin,

Quoted 10 lines · Hangbin Liu

Hi Pin-yen,

Quoted 2 lines · Pin-yen Lin

Thanks for the pointer, but I believe Bjoern's patch addresses a different problem.

I think they are the same issue, as you comment also said

The ARP/NS monitor marks a slave down when it has received nothing for too long.

Quoted 8 lines
Quoted 4 lines

This is the existing behavior of the bonding driver, and the prio test uses it to check which backup slave takes over. Slaves being marked down is not the root cause of the test failure. Instead, the root cause is the ping replies described below.

If the backup slaves are not mark down, we can active the correct slave based on the priority, right? I think that's the root cause. The ping testing is just for checking connectivity.

Yes, I get your point now. If we keep backup slaves up all the time, the ping reply packets won't affect the test result.

Quoted 31 lines
Quoted 20 lines
Quoted 11 lines
Quoted 10 lines

Bjoern's patch keeps the traffic flowing so that idle slaves are kept alive between the test steps. This patch fixes the case where the ping replies from bond_check_connection() only arrive on the active slave right before it is set down. The active slave's failure is then detected one monitor interval late, when the backups have also timed out.

Quoted 8 lines

The reason is we set arp interval to 100ms, and slowwait also check every 100ms. If the backup slave down at the same check point, e.g.

t=300 monitor: eth1 idle 230ms -> still up
t=400 monitor: eth1 idle 330ms -> down

                  eth2 idle 400ms -> down too

The test failed.

Quoted 7 lines

I don't think the slowwait interval makes a difference here.

The ARP monitor decides which slave becomes active, and slowwait only reads the result afterwards. The test expects the active slave and the backups to time out in different monitor runs, so that a backup can take over. In the example above, eth2 is already down when the bond picks the new active slave, no matter when slowwait polls.

My idea is, by extending the arp interval, there is a larger gap. e.g.

Quoted 7 lines

t=300 monitor: eth1 still up
^^ slowwait check, incorrect active slave
t=400 monitor: eth1 down
eth2 still up, should become active slave
t=500 monitor: eth1 down
eth2 still up, active slave
^^ slowwait check, correct active

Shouldn't eth2 become the active slave at t=400? In the failing case, eth2 is also down at t=400 so it can't be picked.

Quoted 32 lines
Quoted 23 lines
Quoted 18 lines
Quoted 11 lines

The ARP requests triggered by Bjoern's ping are sent only about once per second, which isn't frequent enough for this failure. I tested Bjoern's patch and confirmed that it didn't fix the issue in our testing environment. We also can't simply use arping instead because iputils arping doesn't support sub-second intervals.

If you're worried that the 200ms sleep is too short, would increasing it to 0.5s or 1s work for you?

It's not about the sleep time before setting active slave down. I'm afraid about the slowwait checking time. Even we sleep 1s, with arp interval 100, we still only have 100ms checking window. Before the window, the active slave is up, after the window, the backup slave also down. With a debug kernel, this time is a little tight.

Quoted 4 lines

So, either we have some background arp traffic, or let's extend the arp interval to a larger one.

What do you think?

Quoted 8 lines

I agree that a 100ms ARP interval could be too short in environments like a debug kernel.

Background ARP traffic doesn't widen that window, though: it is sent through the active slave, so once the active slave is set down, nothing reaches the backups. It could only help with the ping reply race if it were very frequent; Bjoern's patch triggers about one ARP request per second and didn't fix the failures in our testing.

Quoted 3 lines

For background traffic, I mean let the client send the arp requests, not from active slave of server. With arp_validate 0, the backup slaves will update last_rx and won't be down with idle.

I see. If the ARP requests are sent from the client, the backup slaves can receive them and will stay up during the test.

Quoted 10 lines
Quoted 7 lines

Increasing the ARP interval alone won't address the ping reply race, but it should help in environments like a debug kernel. I'd prefer to keep this patch focused on the ping reply race and send the ARP interval change as a follow-up, but I can fold it into v2 if you prefer.

Doesn't extending the arp_interval (e.g. to 500) resolve your issue? Are you still able to reproduce the problem?

Yes, I can still reproduce this. Simply extending the arp_interval to 500 does not fix our issue. I still saw failures in 9 of 20 runs.

However, with arp_interval=500 and a background arping from the client, the issue no longer reproduces. Both of them are needed:
arping only sends one request per second, which is enough for the ~1.75s backup timeout at arp_interval=500 but not for the ~350ms one at arp_interval=100.

Bjoern's v1 patch sends the ARP requests from the server, so it doesn't fix our issue. I can prepare a v2 to remove the sleep, increase the arp_interval to 500, and add a background arping from the client, unless Bjoern prefers to include the client-side arping in his v2. How would you like to proceed?

Quoted 3 lines

Thanks
Hangbin

Regards,
Pin-yen