netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <jv@jvosburgh.net>,
	Andy Gospodarek <andy@greyhouse.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Simon Horman <horms@kernel.org>, Jianbo Liu <jianbol@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 0/2] bond: fix xfrm offload feature during init
Date: Fri, 13 Dec 2024 19:31:27 -0800	[thread overview]
Message-ID: <20241213193127.4c31ef80@kernel.org> (raw)
In-Reply-To: <Z1vfsAyuxcohT7th@fedora>

On Fri, 13 Dec 2024 07:18:08 +0000 Hangbin Liu wrote:
> On Thu, Dec 12, 2024 at 06:27:34AM -0800, Jakub Kicinski wrote:
> > On Wed, 11 Dec 2024 07:11:25 +0000 Hangbin Liu wrote:  
> > > The first patch fixes the xfrm offload feature during setup active-backup
> > > mode. The second patch add a ipsec offload testing.  
> > 
> > Looks like the test is too good, is there a fix pending somewhere for
> > the BUG below? We can't merge the test before that:  
> 
> This should be a regression of 2aeeef906d5a ("bonding: change ipsec_lock from
> spin lock to mutex"). As in xfrm_state_delete we called spin_lock_bh(&x->lock)
> for the xfrm state delete.
> 
> But I'm not sure if it's proper to release the spin lock in bond code.
> This seems too specific.
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 7daeab67e7b5..69563bc958ca 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -592,6 +592,7 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs)
>  	real_dev->xfrmdev_ops->xdo_dev_state_delete(xs);
>  out:
>  	netdev_put(real_dev, &tracker);
> +	spin_unlock_bh(&xs->lock);
>  	mutex_lock(&bond->ipsec_lock);
>  	list_for_each_entry(ipsec, &bond->ipsec_list, list) {
>  		if (ipsec->xs == xs) {
> @@ -601,6 +602,7 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs)
>  		}
>  	}
>  	mutex_unlock(&bond->ipsec_lock);
> +	spin_lock_bh(&xs->lock);
>  }
>  
> 
> What do you think?

Re-locking doesn't look great, glancing at the code I don't see any
obvious better workarounds. Easiest fix would be to don't let the
drivers sleep in the callbacks and then we can go back to a spin lock.
Maybe nvidia people have better ideas, I'm not familiar with this
offload.

  reply	other threads:[~2024-12-14  3:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11  7:11 [PATCH net 0/2] bond: fix xfrm offload feature during init Hangbin Liu
2024-12-11  7:11 ` [PATCH net 1/2] bonding: fix xfrm offload feature setup on active-backup mode Hangbin Liu
2024-12-12  9:19   ` Nikolay Aleksandrov
2024-12-12  9:39     ` Hangbin Liu
2024-12-12  9:43       ` Nikolay Aleksandrov
2024-12-13  3:10         ` Hangbin Liu
2024-12-11  7:11 ` [PATCH net 2/2] selftests: bonding: add ipsec offload test Hangbin Liu
2024-12-12 14:27 ` [PATCH net 0/2] bond: fix xfrm offload feature during init Jakub Kicinski
2024-12-13  7:18   ` Hangbin Liu
2024-12-14  3:31     ` Jakub Kicinski [this message]
2025-01-02  2:44       ` Hangbin Liu
2025-01-02  3:33         ` Jianbo Liu
2025-01-03 11:05           ` Hangbin Liu
2025-01-06 10:47           ` Hangbin Liu
2025-01-08  2:46             ` Hangbin Liu
2025-01-08  3:40               ` Jianbo Liu
2025-01-08  7:14                 ` Hangbin Liu
2025-01-09  1:26                   ` Jianbo Liu
2025-01-09  8:37                     ` Hangbin Liu
2025-01-09  9:51                       ` Jianbo Liu
2025-01-09 10:17                         ` Hangbin Liu
2025-01-09 12:21                           ` Jianbo Liu
2025-01-15  9:19                   ` Hangbin Liu
2025-01-17  7:54                     ` Steffen Klassert
2025-01-20 16:16                       ` Cosmin Ratiu
2025-01-20 23:59                         ` Hangbin Liu
2025-02-20 10:48                           ` Cosmin Ratiu
2025-02-20 11:18                             ` Hangbin Liu
2025-02-20 11:33                               ` Cosmin Ratiu

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=20241213193127.4c31ef80@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jianbol@nvidia.com \
    --cc=jv@jvosburgh.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=shuah@kernel.org \
    --cc=tariqt@nvidia.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).