[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXGohVBmvaYIYt2w@fedora>
Date: Thu, 22 Jan 2026 04:33:09 +0000
From: Hangbin Liu <liuhangbin@...il.com>
To: Tonghao Zhang <tonghao@...aicloud.com>
Cc: netdev@...r.kernel.org, Jay Vosburgh <jv@...sburgh.net>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, Jonathan Corbet <corbet@....net>,
Andrew Lunn <andrew+netdev@...n.ch>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Jason Xing <kerneljasonxing@...il.com>
Subject: Re: [PATCH net-next v5 1/4] net: bonding: use workqueue to make sure
peer notify updated in lacp mode
On Sun, Jan 18, 2026 at 12:21:11PM +0800, Tonghao Zhang wrote:
> The rtnl lock might be locked, preventing ad_cond_set_peer_notif() from
> acquiring the lock and updating send_peer_notif. This patch addresses
> the issue by using a workqueue. Since updating send_peer_notif does
> not require high real-time performance, such delayed updates are entirely
> acceptable.
>
> In fact, checking this value and using it in multiple places, all operations
> are protected at the same time by rtnl lock, such as
> - read send_peer_notif
> - send_peer_notif--
> - bond_should_notify_peers
>
> By the way, rtnl lock is still required, when accessing bond.params.* for
> updating send_peer_notif. In lacp mode, resetting send_peer_notif in
> workqueue is safe, simple and effective way.
>
> Additionally, this patch introduces bond_peer_notify_may_events(), which
> is used to check whether an event should be sent. This function will be
> used in both patch 1 and 2.
>
> Cc: Jay Vosburgh <jv@...sburgh.net>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: Simon Horman <horms@...nel.org>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Andrew Lunn <andrew+netdev@...n.ch>
> Cc: Nikolay Aleksandrov <razor@...ckwall.org>
> Cc: Hangbin Liu <liuhangbin@...il.com>
> Cc: Jason Xing <kerneljasonxing@...il.com>
> Suggested-by: Hangbin Liu <liuhangbin@...il.com>
> Signed-off-by: Tonghao Zhang <tonghao@...aicloud.com>
> ---
> v5:
> - introduce the common bond_peer_notify_may_events used in patch 1 and 2.
> v4:
> - keep the netdevice notifier order.
> v2/3:
> - no change
> v1:
> - This patch is actually version v3, https://patchwork.kernel.org/project/netdevbpf/patch/20251118090305.35558-1-tonghao@bamaicloud.com/
> - add a comment why we use the trylock.
> - add this patch to series
> ---
> drivers/net/bonding/bond_3ad.c | 7 +---
> drivers/net/bonding/bond_main.c | 66 ++++++++++++++++++++++++++-------
> include/net/bonding.h | 2 +
> 3 files changed, 56 insertions(+), 19 deletions(-)
[...]
>
> +/* Peer notify events post. Holds only RTNL */
> +static void bond_peer_notify_may_events(struct bonding *bond, bool force)
> +{
> + bool notified = false;
> +
> + if (bond_should_notify_peers(bond)) {
> + notified = true;
> + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
> + }
> +
> + if (notified || force)
> + bond->send_peer_notif--;
> +}
If there is a new version, maybe change the logic to
static void bond_peer_notify_may_events(struct bonding *bond, bool force)
{
bool do_notify = bond_should_notify_peers(bond);
if (do_notify)
call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
if (do_notify || force)
bond->send_peer_notif--;
}
Others looks good to me.
Reviewed-by: Hangbin Liu <liuhangbin@...il.com>
Powered by blists - more mailing lists