[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aBBNDOmGiuq_BXT0@fedora>
Date: Tue, 29 Apr 2025 03:52:44 +0000
From: Hangbin Liu <liuhangbin@...il.com>
To: Jay Vosburgh <jv@...sburgh.net>
Cc: Wang Liang <wangliang74@...wei.com>,
Stanislav Fomichev <sdf@...ichev.me>, netdev@...r.kernel.org,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, andrew+netdev@...n.ch,
linux-kernel@...r.kernel.org,
syzbot+48c14f61594bdfadb086@...kaller.appspotmail.com
Subject: Re: [PATCH net v2] bonding: hold ops lock around get_link
On Mon, Apr 28, 2025 at 08:10:40AM -0700, Jay Vosburgh wrote:
> >
> >What if rtnl_trylock() failed? This will return ret directly.
> >Maybe
> > if (slave_dev->ethtool_ops->get_link && rtnl_trylock()) {
> > netdev_lock_ops(slave_dev);
> > ret = slave_dev->ethtool_ops->get_link(slave_dev);
> > netdev_unlock_ops(slave_dev);
> > rtnl_unlock();
> > return ret ? BMSR_LSTATUS : 0;
> > }
>
> This is on me; I had worked up a patch to remove all of this
> logic entirely and deprecate use_carrier, but got sidetracked. Let me
> rebase it and repost it for real.
>
> For reference, the original patch is below; it still needs an
> update to Documentation/networking/bonding.rst.
>
> Subject: [PATCH RFC net-next] bonding: Remove support for use_carrier
>
> Remove the implementation of use_carrier, the link monitoring
> method that utilizes ethtool or ioctl to determine the link state of an
> interface in a bond. The ability to set or query the use_carrier option
> remains, but bonding now always behaves as if use_carrier=1, which relies
> on netif_carrier_ok() to determine the link state of interfaces.
>
> To avoid acquiring RTNL many times per second, bonding inspects
> link state under RCU, but not under RTNL. However, ethtool
> implementations in drivers may sleep, and therefore this strategy is
> unsuitable for use with calls into driver ethtool functions.
>
> The use_carrier option was introduced in 2003, to provide
> backwards compatibility for network device drivers that did not support
> the then-new netif_carrier_ok/on/off system. Device drivers are now
> expected to support netif_carrier_*, and the use_carrier backwards
> compatibility logic is no longer necessary.
>
> Link: https://lore.kernel.org/lkml/000000000000eb54bf061cfd666a@google.com/
> Link: https://lore.kernel.org/netdev/20240718122017.d2e33aaac43a.I10ab9c9ded97163aef4e4de10985cd8f7de60d28@changeid/
> Signed-off-by: Jay Vosburgh <jv@...sburgh.net>
>
Thanks, The patch looks good to me.
Regards
Hangbin
Powered by blists - more mailing lists