netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Jay Vosburgh <jv@jvosburgh.net>
Cc: Wang Liang <wangliang74@huawei.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
	linux-kernel@vger.kernel.org,
	syzbot+48c14f61594bdfadb086@syzkaller.appspotmail.com
Subject: Re: [PATCH net v2] bonding: hold ops lock around get_link
Date: Tue, 29 Apr 2025 03:52:44 +0000	[thread overview]
Message-ID: <aBBNDOmGiuq_BXT0@fedora> (raw)
In-Reply-To: <804583.1745853040@famine>

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@jvosburgh.net>
> 

Thanks, The patch looks good to me.

Regards
Hangbin

      reply	other threads:[~2025-04-29  3:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10 16:11 [PATCH net v2] bonding: hold ops lock around get_link Stanislav Fomichev
2025-04-12  2:01 ` patchwork-bot+netdevbpf
2025-04-27  3:06 ` Wang Liang
2025-04-28  2:02   ` Hangbin Liu
2025-04-28 15:10     ` Jay Vosburgh
2025-04-29  3:52       ` Hangbin Liu [this message]

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=aBBNDOmGiuq_BXT0@fedora \
    --to=liuhangbin@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=syzbot+48c14f61594bdfadb086@syzkaller.appspotmail.com \
    --cc=wangliang74@huawei.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;
as well as URLs for NNTP newsgroup(s).