mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: hangbin.liu@linux.dev
Cc: jv@jvosburgh.net, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	tonghao@bamaicloud.com, razor@blackwall.org, shuah@kernel.org,
	jiangjiehua1@huawei.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net 2/3] bonding: update slave array on link change for broadcast mode
Date: Fri, 27 Nov 2026 03:15:57 +0000	[thread overview]
Message-ID: <179574935712.3135.18271637068349106750@kernel.org> (raw)
In-Reply-To: <20261126-bond_broadcast_updelay-v1-2-188e5538d6ca@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message says the patch makes the broadcast
  usable_slaves snapshot 'follow link transitions the same way balance-…
- [Medium] Because broadcast now publishes usable_slaves (the revert,
  which this patch relies on), switching a broadcast bond to balance-rr…
- [Low] The series ordering is not bisect-safe, and the dependency
  between the two patches is not recorded in tags.

--

bonding: update slave array on link change for broadcast mode

This adds a BOND_MODE_BROADCAST case to bond_miimon_link_change(), so the
usable_slaves snapshot is rebuilt on miimon link transitions. That keeps
the ignore_updelay decision in bond_miimon_inspect() in line with the
current slave link states. It depends on a revert of 45fc134bcfad so that
bond_set_slave_arr() publishes the array for broadcast.

> Add the broadcast case so the snapshot follows link transitions the
> same way balance-xor does. This needs the revert of 45fc134bcfad as
> a prerequisite: with 45fc134bcfad applied, bond_set_slave_arr()
> discards the refreshed array for broadcast.
>
> Fixes: e0caeb24f538 ("net: bonding: update the slave array for broadcast mode")

[Severity: Low]
Is the series order bisect-safe? The revert of 45fc134bcfad is applied
before this patch. On its own, it makes bond_set_slave_arr() publish
usable_slaves for broadcast again, but nothing rebuilds the array on
miimon link changes yet.

At that intermediate commit, a batch enslave with updelay leaves the new
slaves in BOND_LINK_BACK. The snapshot taken at enslave time then has
count == 0 and is never refreshed, so bond_miimon_inspect() ignores
updelay permanently. That is the bug 45fc134bcfad fixed.

If this patch went first, it would be a no-op under 45fc134bcfad, and
every commit in the series would be correct.

Also, this patch carries Fixes: e0caeb24f538, but the revert it depends on
has no Fixes: tag and no dependency annotation. 45fc134bcfad is likely
already in stable trees.

Would a tag-driven backport of only this patch leave the stale snapshot
behaviour unchanged there?

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index d6675e87d06b6..b1efbdf597ec4 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2780,6 +2780,7 @@ static void bond_miimon_link_change(struct bonding *bond,
>  		bond_alb_handle_link_change(bond, slave, link);
>  		break;
>  	case BOND_MODE_XOR:
> +	case BOND_MODE_BROADCAST:
>  		bond_update_slave_arr(bond, NULL);
>  		break;
>  	}

[Severity: Medium]
The commit message says the snapshot follows link transitions "the same
way balance-xor does". Does that hold outside the MII monitor?

balance-xor also rebuilds the array when the ARP load-balance monitor
changes a slave's link state. Broadcast is still left out there:

drivers/net/bonding/bond_main.c:bond_loadbalance_arp_mon() {
    ...
		if (slave_state_changed) {
			bond_slave_state_change(bond);
			if (BOND_MODE(bond) == BOND_MODE_XOR)
				bond_update_slave_arr(bond, NULL);
		}
    ...
}

Broadcast can use ARP monitoring, because bond_mode_uses_arp() only
excludes BOND_MODE_8023AD, BOND_MODE_TLB and BOND_MODE_ALB.
bond_slave_netdev_event() also skips broadcast, since
bond_mode_can_use_xmit_hash() is false for it. So under ARP monitoring,
the broadcast snapshot keeps the state from the last enslave or release.

bond_option_miimon_set() can switch the bond from ARP monitoring to
miimon at runtime. It zeroes arp_interval, cancels arp_work and queues
mii_work, but it does not rebuild the slave array. params.updelay
survives the switch.

For example, slaves enslaved with carrier under ARP monitoring are marked
BOND_LINK_UP and counted in usable_slaves. Later the ARP monitor marks
them BOND_LINK_DOWN, but the snapshot is not refreshed. Once miimon is
enabled, bond_miimon_inspect() sees usable_slaves->count != 0:

	if (usable_slaves && usable_slaves->count == 0)
		ignore_updelay = true;

Recovering slaves then wait out updelay even though the bond has no usable
link.

The reverse case also happens. If slaves are enslaved without carrier,
count == 0 and updelay is wrongly ignored. Either state lasts until the
first miimon commit reaches bond_miimon_link_change().

Should BOND_MODE_BROADCAST also be added to the condition in
bond_loadbalance_arp_mon()?

[Severity: Medium]
Now that broadcast publishes usable_slaves, does a switch from broadcast
to balance-rr leave a stale snapshot behind?

Releasing the last broadcast slave goes through __bond_release_one():

	if (bond_mode_can_use_xmit_hash(bond) ||
	    BOND_MODE(bond) == BOND_MODE_BROADCAST)
		bond_update_slave_arr(bond, slave);

This runs after bond_upper_dev_unlink(), so the slave list is already
empty. The result is a non-NULL usable_slaves with count == 0, and after
the revert that array is kept for broadcast.

Neither bond_option_mode_set() nor bond_close() resets the arrays.

In balance-rr, nothing rebuilds the array afterwards:

  - bond_enslave() and __bond_release_one() only rebuild for xmit-hash
    modes or broadcast
  - bond_open() and bond_slave_netdev_event() only rebuild when
    bond_mode_can_use_xmit_hash() is true
  - bond_miimon_link_change() has no BOND_MODE_ROUNDROBIN case

So in balance-rr, bond_miimon_inspect() would see count == 0 on every
pass. It would set ignore_updelay = true and force slave->delay to 0 for
every recovering slave.

Documentation/networking/bonding.rst section 13.1 says updelay is ignored
only when the bond has no active links.

In the baseline tree with 45fc134bcfad, broadcast never published
usable_slaves, so a switch from broadcast to balance-rr left it NULL. The
same missing reset on mode change already existed for a switch from
balance-xor to balance-rr.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-bond_broadcast_updelay-v1-0-188e5538d6ca%40kylinos.cn

  reply	other threads:[~2026-11-27  3:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  2:30 [PATCH net 0/3] bonding: ignore updelay when no active links " Hangbin Liu
2026-11-26  2:30 ` [PATCH net 1/3] Revert "bonding: do not set usable_slaves for broadcast mode" Hangbin Liu
2026-11-27  3:15   ` netdev-bot+sashiko
2026-11-26  2:30 ` [PATCH net 2/3] bonding: update slave array on link change for broadcast mode Hangbin Liu
2026-11-27  3:15   ` netdev-bot+sashiko [this message]
2026-11-27  6:00     ` Hangbin Liu
2026-11-26  2:30 ` [PATCH net 3/3] selftests: bonding: add recovery updelay test " Hangbin Liu
2026-11-27  3:15   ` netdev-bot+sashiko
2026-11-26  2:32 ` [PATCH net 0/3] bonding: ignore updelay when no active links " netdev-bot+sinfo
2026-11-26  7:28 ` jiangjiehua (A)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179574935712.3135.18271637068349106750@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hangbin.liu@linux.dev \
    --cc=jiangjiehua1@huawei.com \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=shuah@kernel.org \
    --cc=tonghao@bamaicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®